0

我到目前为止,

#更改保证金 client.futures_change_margin_type(symbol = symbol_buy, marginType = 'ISOLATED')

#改变杠杆 client.futures_change_leverage(symbol = symbol_buy,leverage = 1)

shared.client.futures_create_order(symbol=symbol_buy, side = 'SELL', type='TRAILING_STOP_LOSS', 数量 = 100)

因此我在下面收到此错误


BinanceAPIException Traceback (last last call last) in 3 4 #orderdetails_buy = shared.client_future.futures_create_order( symbol=symbol_buy, side = 'BUY', type='MARKET', quantity = 100) ----> 5 orderdetails_sell = shared。 client_future.futures_create_order(symbol_buy, side = 'SELL', type='TRAILING_STOP_LOSS', 数量 = 100) 6

C:\ProgramData\Anaconda3\lib\site-packages\binance\client.py in futures_create_order(self, **params) 5289 5290 """ -> 5291 return self._request_futures_api('post', 'order', True,数据=参数)5292 5293 def futures_place_batch_order(自我,**参数):

C:\ProgramData\Anaconda3\lib\site-packages\binance\client.py in _request_futures_api(self, method, path, signed, **kwargs) 331 uri = self._create_futures_api_uri(path) 332 --> 333 return self. _request(method, uri, signed, True, **kwargs) 334 335 def _request_futures_data_api(self, method, path, signed=False, **kwargs) -> Dict:

C:\ProgramData\Anaconda3\lib\site-packages\binance\client.py in _request(self, method, uri, signed, force_params, **kwargs) 307 308 self.response = getattr(self.session, method)( uri, **kwargs) --> 309 返回 self._handle_response(self.response) 310 311 @staticmethod

C:\ProgramData\Anaconda3\lib\site-packages\binance\client.py in _handle_response(response) 316 """ 317 if not (200 <= response.status_code < 300): --> 318 raise BinanceAPIException(response, response.status_code,response.text)319尝试:320返回response.json()

BinanceAPIException: APIError(code=-1116): 无效的订单类型。

4

1 回答 1

1

您现在可能已经解决了这个问题,但是对于币安期货,我认为目前还没有通过 API 的 TRAILING_STOP_LOSS 交易类型,可用的订单类型是(来自文档):

订单类型(orderTypes, type):

  • 限制
  • 市场
  • 停止
  • STOP_MARKET
  • 获利
  • TAKE_PROFIT_MARKET
  • TRAILING_STOP_MARKET

[https://binance-docs.github.io/apidocs/futures/en/#public-endpoints-info][1]

于 2021-07-12T09:14:34.587 回答