gateio / gateapi-python

256 stars 96 forks source link

u本位合约api测试地址有么 #20

Closed Jastyle closed 4 years ago

Jastyle commented 4 years ago

请问u本位合约的api测试地址有么,我用https://fx-api-testnet.gateio.ws/api/v4这个测试地址获取仓位,报{"label":"CONTRACT_NOT_FOUND"}错误,币本位正常。

revilwang commented 4 years ago

请提供具体的代码

Jastyle commented 4 years ago

configuration.host = "https://fx-api-testnet.gateio.ws/api/v4" GateSwapApi = gate_api.FuturesApi(gate_api.ApiClient(configuration)) CONTRACT = 'BTC_USD' BTC_SETTLE = 'btc' USDT_SETTLE = 'usdt'

if name == 'main': position = GateSwapApi.get_position(settle=USDT_SETTLE, contract=CONTRACT) print(position)

revilwang commented 4 years ago

你应该是把 contract 的名字写错了,可以通过 list_futures_contracts 查询到所有支持的列表

supported = [x.name for x in GateSwapApi.list_futures_contracts(settle=USDT_SETTLE)]
Jastyle commented 4 years ago

 ̄□ ̄||,谢谢!