gateio / gateapi-python

256 stars 96 forks source link

不能创建永续合约订单,提示: INVALID_PROTOCOL / Can't Create FuturesOrder #10

Closed qisikai closed 5 years ago

qisikai commented 5 years ago

代码是这样的: Code:

   print(symbol)
    futures_order = gate_api.FuturesOrder(contract=symbol, size=-1 * quantity, price=price,reduce_only=False,tif="gtc")  # FuturesOrder

    try:

        # Create a futures order

        api_response = self.api_instance.create_futures_order(futures_order)
        print(api_response)
        return api_response
    except ApiException as e:
        print("Exception when calling FuturesApi->create_futures_order: %s\n" % e)
        raise e

输出是这样的: Output:

BTC_USD

Exception when calling FuturesApi->create_futures_order: (400) Reason: Bad Request HTTP response headers: HTTPHeaderDict({'Date': 'Sun, 26 May 2019 06:10:07 GMT', 'Content-Type': 'application/json', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Server': 'openresty/1.13.6.1'}) HTTP response body: {"label":"INVALID_PROTOCOL","detail":"invalid argument: #3"}

revilwang commented 5 years ago

参数的内容有问题,请确认下您输入的具体参数是否符合要求