我正在尝试使用 ccxt ccxt-1.39.93, Python 3 平仓 Binance Futures。
# fetch position
position = binance.fetch_balance()['info']['positions']
pos = [p for p in position if p['symbol'] == "ETHUSDT"][0]
ticker = get_binance_futures(fetch_only=True)
close_position = binance.create_order(symbol=symbol, type="TAKE_PROFIT_MARKET", side="buy", amount=pos['positionAmt'], price=ticker , params={"closePosition": True, "stopPrice": ticker})
我想关闭当前位置。但是得到了这个错误:
ccxt.base.errors.ExchangeError: binance {"code":-2021,"msg":"Order would immediately trigger."}
是否有一种简单的方法可以以给定代码的市场或现货价格关闭当前头寸?