feat(bybit): Add spot support and migrate to API V5#1017
feat(bybit): Add spot support and migrate to API V5#1017bmoscon merged 2 commits intobmoscon:masterfrom
Conversation
|
|
||
| @staticmethod | ||
| def convert_to_spot_name(cls, pair): | ||
| # Bybit spot and USDT perps use the same symbol name. To distinguish them, use a slash to separate the base and quote. |
There was a problem hiding this comment.
I'm confused by this comment - does this mean if I want to subscribe I'd need to do something like BTC|USDT?
There was a problem hiding this comment.
Here it adds a slash to spot pairs in order to build proper normalized dict (as linear and spot symbols are identical)
Then in message_handler it gets the market (spot | perp) from url line and then passes market parameter to a functions _candle, _trade and _book. These functions receive spot and perp pair information from the websocket, where both are formatted as 'BTCUSDT'
Then convert_to_spot_name function adds slash in order to properly use normalized dict later in the code for spot pairs.
This approach may seem complex, but I haven't found a clearer way to implement it.
Short answer on your question - no, no needs to add anything special to subscribe.
bmoscon
left a comment
There was a problem hiding this comment.
I left a comment about part of the code I'm unsure about. Other than that, looks ready to merge once thats resolved
|
@kosmodromov - thanks for the PR - just one question for you, then we can merge this. |
This PR adds support for the spot market on Bybit exchange and migrate to V5 API.
Updated market data endpoints:
Only linear futures is supported. No inverse futures support.
Private endpoints remain unmodified.
Fixes: #1010 #1012