Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix instrument types in symbol parsing on Bitmex. #981

Merged
merged 1 commit into from
Jun 17, 2023

Conversation

agijsberts
Copy link
Contributor

Description of code - what bug does this fix / what feature does this add?

This fix resolves two related bugs in the symbol handling for Bitmex. Firstly, it properly decodes instrument types, including disambiguating SPOT and PERPETUAL symbols. Since both have the same counter and base currency, formerly the spot instrument would overwrite the perpetual instrument simply because it came later in the active instruments rest endpoint. For example, during parsing the normalized symbol BTC-USDT-PERP would first (correctly) refer to Bitmex instrument XBTUSDT and later be overwritten to refer to Bitmex's spot market XBT_USDT (yes, the naming is indeed confusing).

This fix resolves a second bug, in that Bitmex has two ETH-USD-PERP instruments, namely ETHUSD and ETHUSD_ETH. Also in this case the latter, much less active instrument would overwrite the former. In case of ambiguity, this fix therefore gives precedence to the first match.

I think this PR will resolve #905. Note that the instrument types were taking from the official documentation. An obvious consequence of this fix is that cryptofeed will support Bitmex's spot markets.

  • - Tested
  • - Changelog updated
  • - Tests run and pass
  • - Flake8 run and all errors/warnings resolved
  • - Contributors file updated (optional)

@bmoscon bmoscon merged commit 81b7e66 into bmoscon:master Jun 17, 2023
@agijsberts agijsberts deleted the bitmex_symbolmapping branch January 13, 2024 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ETHUSDT book is not updated in Bitmex
2 participants