Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 ccxt 连接到 ByBit 并创建订单。
symbol = 'SOLUSDT' trade_res = exchange.create_order(symbol, amount=1, type='Market', side='Buy')
上面的代码片段用 USDT 买入 1 SOL。当我尝试通过下达卖单来平仓时,我看到 ByBit 在 SOL 上放置了另一个空头头寸,而没有平仓多头头寸(控制台中出现 2 个头寸):
如何使用 ccxt 关闭 ByBit 上的当前仓位?
添加reduce_only到params退出期货订单
reduce_only
params
symbol = 'SOLUSDT' trade_res = exchange.create_order(symbol, amount=1, type='Market', side='sell', params={'reduce_only': true})
在某些交易所,参数是reduceOnly
reduceOnly