Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasbs17 committed Jan 17, 2024
1 parent 0420a45 commit a88c95f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cryptofeed/exchanges/coinbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
associated with this software.
'''
import asyncio
import datetime
import hashlib
import hmac
import logging
Expand Down Expand Up @@ -143,10 +144,9 @@ async def _pair_level2_snapshot(self, msg: dict, timestamp: float):

await self.book_callback(L2_BOOK, self._l2_book[pair], timestamp, raw=msg)

async def _pair_level2_update(self, msg: dict, timestamp: float):
async def _pair_level2_update(self, msg: dict, timestamp: float, ts: datetime):
pair = self.exchange_symbol_to_std_symbol(msg['product_id'])
delta = {BID: [], ASK: []}
ts = self.timestamp_normalize(msg['timestamp'])
for update in msg['updates']:
side = BID if update['side'] == 'bid' else ASK
price = Decimal(update['price_level'])
Expand Down Expand Up @@ -226,7 +226,7 @@ async def message_handler(self, msg: str, conn: AsyncConnection, timestamp: floa
pass # TODO: do we want to implement trades snapshots?
elif msg['channel'] == 'l2_data':
if event.get('type') == 'update':
await self._pair_level2_update(event, timestamp)
await self._pair_level2_update(event, timestamp, msg['timestamp'])
elif event.get('type') == 'snapshot':
await self._pair_level2_snapshot(event, timestamp)
elif msg['channel'] == 'subscriptions':
Expand Down

0 comments on commit a88c95f

Please sign in to comment.