'How to make SPOT market order on Bybit with ccxt?

I am using ccxt library to work with exchange. Struggling with making market order on Bybit. How it can be fixed? The error i've got is TypeError: Exchange.request() takes from 1 to 3 positional arguments but 5 were given

 bybit_spot = ccxt.bybit({
        "apiKey": config.bybit_API_KEY,
        "secret": config.bybit_SECRET_KEY,
        "options": {'defaultType': 'spot' }})
    bybit_spot.private_post_spot_v1_order("GMTUSDT", "buy", "market", amount)


Solution 1:[1]

Where are you getting private_post_spot_v1_order method from? It doesn't seem to be a ccxt method as far as I can see. The correct method for place an order is createOrder as defined in the manual.

Here is a working example with binance but it should be the same for bybit:

import ccxt
exchange = ccxt.binance({
    'apiKey': '...',
    'secret': '...',
})

exchange.createOrder('BTC/USDT', 'market', 'sell', 0.1)

Let me know if it doesn't work and I will open an account with bybit to test it there.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1