Skip to content

Commit

Permalink
Merge branch 'master' into bybit-spot
Browse files Browse the repository at this point in the history
  • Loading branch information
bmoscon authored Nov 5, 2023
2 parents d327e5d + e803189 commit 5fcc704
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 11 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* Bugfix: InfluxDB none type conversions
* New Exchange: GateIO Futures
* Feature: Added support for Bybit spot orderbook and trade websocket endpoints
* Bugfix: Fix instrument types in symbol parsing on Bitmex
* Bugfix: fix crash issue when init symbol data on Kraken Futures

### 2.3.2 (2023-05-27)
* Bugfix: Fix Socket backend
Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/backends/aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class AggregateCallback:
def __init__(self, handler):
self.handler = handler
if hasattr(self.handler, '__class__'):
if not callable(self.handler):
setattr(self, 'start', self.handler.start)
setattr(self, 'stop', self.handler.stop)
self.__name__ = self.handler.__class__
Expand Down
22 changes: 15 additions & 7 deletions cryptofeed/exchanges/bitmex.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from yapic import json

from cryptofeed.defines import BID, ASK, BITMEX, BUY, CANCELLED, FILLED, FUNDING, FUTURES, L2_BOOK, LIMIT, LIQUIDATIONS, MARKET, OPEN, OPEN_INTEREST, ORDER_INFO, PERPETUAL, SELL, TICKER, TRADES, UNFILLED
from cryptofeed.defines import BID, ASK, BITMEX, BUY, CANCELLED, FILLED, FUNDING, FUTURES, L2_BOOK, LIMIT, LIQUIDATIONS, MARKET, OPEN, OPEN_INTEREST, ORDER_INFO, PERPETUAL, SELL, SPOT, TICKER, TRADES, UNFILLED
from cryptofeed.feed import Feed
from cryptofeed.symbols import Symbol
from cryptofeed.connection import AsyncConnection, RestEndpoint, Routes, WebsocketEndpoint
Expand Down Expand Up @@ -49,15 +49,23 @@ def _parse_symbol_data(cls, data: dict) -> Tuple[Dict, Dict]:
base = entry['rootSymbol'].replace("XBT", "BTC")
quote = entry['quoteCurrency'].replace("XBT", "BTC")

stype = PERPETUAL
if entry['expiry']:
if entry['typ'] == 'FFWCSX':
stype = PERPETUAL
elif entry['typ'] == 'FFCCSX':
stype = FUTURES
elif entry['typ'] == 'IFXXXP':
stype = SPOT
else:
LOG.info('Unsupported type %s for instrument %s', entry['typ'], entry['symbol'])

s = Symbol(base, quote, type=stype, expiry_date=entry['expiry'])
ret[s.normalized] = entry['symbol']
info['tick_size'][s.normalized] = entry['tickSize']
info['instrument_type'][s.normalized] = stype
info['is_quanto'][s.normalized] = entry['isQuanto']
if s.normalized not in ret:
ret[s.normalized] = entry['symbol']
info['tick_size'][s.normalized] = entry['tickSize']
info['instrument_type'][s.normalized] = stype
info['is_quanto'][s.normalized] = entry['isQuanto']
else:
LOG.info('Ignoring duplicate symbol mapping %s<=>%s', s.normalized, entry['symbol'])

return ret, info

Expand Down
4 changes: 3 additions & 1 deletion cryptofeed/exchanges/kraken_futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ def timestamp_normalize(cls, ts: float) -> float:

@classmethod
def _parse_symbol_data(cls, data: dict) -> Tuple[Dict, Dict]:
# Docs, https://support.kraken.com/hc/en-us/articles/360022835891-Ticker-symbols
_kraken_futures_product_type = {
'FI': 'Inverse Futures',
'FV': 'Vanilla Futures',
'PI': 'Perpetual Inverse Futures',
'FF': 'Fixed Maturity Linear Futures',
'PF': 'Perpetual Linear Multi-Collateral Futures',
'PV': 'Perpetual Vanilla Futures',
'IN': 'Real Time Index',
Expand All @@ -63,7 +65,7 @@ def _parse_symbol_data(cls, data: dict) -> Tuple[Dict, Dict]:
stype = FUTURES
symbol, expiry = symbol.split("_")
symbol = symbol.replace('XBT', 'BTC')
base, quote = symbol[:len(symbol) - 3], symbol[-3:]
base, quote = symbol[:-3], symbol[-3:]

s = Symbol(base, quote, type=stype, expiry_date=expiry)

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
aiodns>=1.1 # aiodns speeds up DNS resolving
aiofile>=2.0.0
aiohttp==3.8.4
aiohttp==3.8.5
cchardet
cython
order_book==0.6.0
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def run_tests(self):
"requests>=2.18.4",
"websockets>=10.0",
"pyyaml",
"aiohttp==3.8.4",
"aiohttp==3.8.5",
"aiofile>=2.0.0",
"yapic.json>=1.6.3",
'uvloop ; platform_system!="Windows"',
Expand Down

0 comments on commit 5fcc704

Please sign in to comment.