bybit-exchange / pybit

Official Python3 API connector for Bybit's HTTP and WebSockets APIs.
Other
408 stars 133 forks source link

The price received from websocket arent right #123

Closed RayXie29 closed 1 year ago

RayXie29 commented 1 year ago

I am using pybit 5.1.1 and subscribe the spot orderbook stream with WebSocket in unified_trading.py And I noticed that the prices I received aren't the same as bybit APP showing. Here is the example, I subscribe the orderbook stream of FITFIUSDT pair. The actual bid 1 price of FITFIUSDT should be 0.011018, but instead the bid1 I received from websocket is 0.01104. I guess there are something wrong when you update the orderbook delta.

dextertd commented 1 year ago

Are you passing testnet=True? If you are, you should look at the data on testnet.bybit.com. It is distinct from the data on bybit.com.

RayXie29 commented 1 year ago

No, I checked the testnet argument, I sent False to it.

dextertd commented 1 year ago

There are two FITFIUSDT markets which have distinct orderbooks, the USDT perpetual, and the spot market.

https://www.bybit.com/trade/usdt/FITFIUSDT https://www.bybit.com/en-US/trade/spot/FITFI/USDT

Could you be looking at the spot websocket but the perpetual website and trying to compare them?

If you still think this is not the reason, please share the exact sources of data you are comparing so that I can try and reproduce the issue.