Format condition for filtering and add link to docs explaining need for filtering in the first case

small_kucoin_fixes
jaredgoldman 2023-04-11 12:59:53 -04:00
parent d1b0608c88
commit 6e55f6706f
1 changed files with 6 additions and 2 deletions

View File

@ -566,8 +566,12 @@ async def stream_messages(ws: NoBsWs, sym: str) -> AsyncGenerator[NoBsWs, dict]:
case 'trade.ticker':
trade_data = KucoinTrade(**msg.data)
# Filter for duplicate messages
if last_trade_data and trade_data.time == last_trade_data.time:
# XXX: Filter for duplicate messages as ws feed will send duplicate market state
# https://docs.kucoin.com/#level2-5-best-ask-bid-orders
if (
last_trade_data
and trade_data.time == last_trade_data.time
):
continue
last_trade_data = trade_data