CCXT Bybit, Cannot create order in One-Way Mode

1.3k views Asked by At

The below script works fine in "Hedge Mode". However, if I change the Position Mode to "One-Way Mode", I got an error, "position idx not match position mode". I've googled for a while and still cannot find the solution, please kindly help, thanks!

import ccxt
import config

asset_symbol = 'BTC/USDT:USDT'
order_size = 0.001

ex = ccxt.bybit(
    {'enableRateLimit': True,
     'apiKey': config.api_keys[asset_symbol],
     'secret': config.api_secrets[asset_symbol]}
)

response = ex.create_market_buy_order(symbol=asset_symbol, amount=order_size)

enter image description here

enter image description here

0

There are 0 answers