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 fetching symbols from bitmex and bit.com #1052

Merged
merged 4 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ Cryptofeed was originally created by Bryant Moscon, but many others have contrib
* [Jonggyun Kim](https://github.com/gyunt) - <[email protected]>
* [QuasarDB](https://quasar.ai/)
* [Thomas Bouamoud](https://github.com/thomasbs17) - <[email protected]>
* [Carlo Eugster](https://github.com/carloe) - <[email protected]>
* [Carlo Eugster](https://github.com/carloe) - <[email protected]>
* [Marten Schlüter](https://github.com/maschlr)
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* Update: Bybit migrate to API V5 for public streams
* Bugfix: Handle None ids for Kraken trades in QuestDB
* Bugfix: Handle OrderChanged event in IndependentReserve
* Bugfix: Remove deprecated `USD` currency from bit.com
* Bugfix: Make `entry` key optional when retrieving symbols for BitMex

### 2.4.0 (2024-01-07)
* Update: Fix tests
Expand Down
6 changes: 3 additions & 3 deletions cryptofeed/exchanges/bitdotcom.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import logging
from decimal import Decimal
import time
from typing import Dict, List, Tuple, Union
from typing import Dict, Tuple
from collections import defaultdict
import hashlib
import hmac
Expand Down Expand Up @@ -51,9 +51,9 @@ def __init__(self, *args, **kwargs):
self._sequence_no = defaultdict(int)

@classmethod
def _symbol_endpoint_prepare(cls, ep: RestEndpoint) -> Union[List[str], str]:
def _symbol_endpoint_prepare(cls, ep: RestEndpoint) -> str:
if ep.routes.currencies:
return [ep.route('instruments').format(currency) for currency in ('USD', 'USDT')]
return ep.route('instruments').format('USDT')
return ep.route('instruments')

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/exchanges/bitmex.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def _parse_symbol_data(cls, data: dict) -> Tuple[Dict, Dict]:
else:
LOG.info('Unsupported type %s for instrument %s', entry['typ'], entry['symbol'])

s = Symbol(base, quote, type=stype, expiry_date=entry['expiry'])
s = Symbol(base, quote, type=stype, expiry_date=entry.get('expiry'))
if s.normalized not in ret:
ret[s.normalized] = entry['symbol']
info['tick_size'][s.normalized] = entry['tickSize']
Expand Down