python如何用ccxt做Bybit期货订单?

How to make a Bybit futures order with ccxt in python?

我在Bybit使用ccxt
我可以通过以下代码订购 BTCUSD(Futures Perp)。

import ccxt

bybit = ccxt.bybit({
    "apiKey":"my api",
    "secret":"my secret"
})

symbol = 'BTC/USD'
order_type = 'limit'
side = 'buy'
amount = 1
price = 10000

order = bybit.create_order(symbol, order_type, side, amount, price, {
   'qty': amount
})

但是↓这段代码return "ret_msg":"无效符号".

symbol = 'BTCUSDU21'
order_type = 'limit'
side = 'sell'
amount = 1
price = 50000

order = bybit.create_order(symbol, order_type, side, amount, price, {
   'qty': amount
})

我想下单BTCUSDU21(反向期货)☹

您需要将所有这些参数作为字典传递,我建议使用 futuresPrivatePostOrderCreate() 方法。

order = bybit.futuresPrivatePostOrderCreate({
'symbol':"symbol", 
'side' : side,
'order_type' : 'Limit',
'qty' : amount,
'time_in_force': "GoodTillCancel",
'price' : price
})