From 4997c32d02e3cdebf0d37501860a66db093878a4 Mon Sep 17 00:00:00 2001 From: Thomas Bouamoud Date: Wed, 17 Jan 2024 12:00:46 +0000 Subject: [PATCH] bug fix --- cryptofeed/exchanges/coinbase.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cryptofeed/exchanges/coinbase.py b/cryptofeed/exchanges/coinbase.py index 2b4fec678..a0c8d0ed8 100644 --- a/cryptofeed/exchanges/coinbase.py +++ b/cryptofeed/exchanges/coinbase.py @@ -93,6 +93,11 @@ def __reset(self): self.order_map = {} self.order_type_map = {} self.seq_no = None + # sequence number validation only works when the FULL data stream is enabled + chan = self.std_channel_to_exchange(L2_BOOK) + if chan in self.subscription: + pairs = self.subscription[chan] + self.seq_no = {pair: None for pair in pairs} self._l2_book = {} async def _ticker(self, msg: dict, timestamp: float): @@ -255,4 +260,4 @@ async def _subscribe(chan: str, product_ids: list): await _subscribe(channel, self.subscription[channel]) all_pairs = list(dict.fromkeys(all_pairs)) await _subscribe('heartbeat', all_pairs) - # Implementing heartbase as per Best Practices doc: https://docs.cloud.coinbase.com/advanced-trade-api/docs/ws-best-practices + # Implementing heartbeat as per Best Practices doc: https://docs.cloud.coinbase.com/advanced-trade-api/docs/ws-best-practices