In the official bybit api, the api for spot seems to be missing. The inverse perp api is still there, and you can get the order and price as follows
import bybit
client = bybit.bybit(test=False, api_key="yyyy", api_secret="xxxx")
client.Market.Market_orderbook(symbol="BTCUSDT").result()
How can I get the price and place an order for BTCUSDT in bybit's spot? If the official API doesn't work, CCXT is fine.
Currently CCXT
don't support Bybit SPOT market in the Unified API, however CCXT map every exchange enpoint with the Implicit API.
Each implicit method gets a unique name which is constructed from the
.api
definition. For example, a private HTTPS PUThttps://api.exchange.com/order/{id}/cancel
endpoint will have a corresponding exchange method named.privatePutOrderIdCancel()
/.private_put_order_id_cancel()
. A public HTTPS GEThttps://api.exchange.com/market/ticker/{pair}
endpoint would result in the corresponding method named.publicGetTickerPair()
/.public_get_ticker_pair()
, and so on.
As you can see each exchange method name is a concatenated string consisting of type (public or private), HTTP method (GET, POST, PUT, DELETE) and endpoint URL path accessible in both camelCase
and under_score
notations.
So in your case the enpoint to place a SPOT order on Bybit is a private POST /spot/v1/order
and the corresponding implicit method is .privatePostSpotV1Order()
/.private_post_spot_v1_order()
.
The endpoints to get price data (it depends on what you meen) are all those listed here. So e.g. to query all SPOT symbols the public enpoint is GET /spot/v1/symbols
and the corresponding method named .publicGetSpotV1Symbols()
/.public_get_spot_v1_symbols()
.