I use ccxt for Bybit.
I can order BTCUSD(Futures Perp) by following code.
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
})
But ↓this code return "ret_msg":"invalid symbol".
symbol = 'BTCUSDU21'
order_type = 'limit'
side = 'sell'
amount = 1
price = 50000
order = bybit.create_order(symbol, order_type, side, amount, price, {
'qty': amount
})
I wanna place order in BTCUSDU21(Inverse Futures)☹
You need to pass all those parameters as a dict and I would recommend using the futuresPrivatePostOrderCreate() method.
order = bybit.futuresPrivatePostOrderCreate({
'symbol':"symbol",
'side' : side,
'order_type' : 'Limit',
'qty' : amount,
'time_in_force': "GoodTillCancel",
'price' : price
})