diff --git a/piker/brokers/questrade.py b/piker/brokers/questrade.py index 3f7cee8b..caaa9c65 100644 --- a/piker/brokers/questrade.py +++ b/piker/brokers/questrade.py @@ -301,7 +301,7 @@ async def poll_tickers( client: Client, tickers: [str], q: trio.Queue, rate: int = 5, # 200ms delay between quotes - time_cached: bool = True, # only deliver "new" quotes to the queue + diff_cached: bool = True, # only deliver "new" quotes to the queue ) -> None: """Stream quotes for a sequence of tickers at the given ``rate`` per second. @@ -323,14 +323,14 @@ async def poll_tickers( if quote['delay'] > 0: log.warning(f"Delayed quote:\n{quote}") - if time_cached: # if cache is enabled then only deliver "new" changes + if diff_cached: + # if cache is enabled then only deliver "new" changes symbol = quote['symbol'] last = _cache.setdefault(symbol, {}) - timekey = 'lastTradeTime' - if quote[timekey] != last.get(timekey): - new = set(quote.items()) - set(last.items()) + new = set(quote.items()) - set(last.items()) + if new: log.info( - f"New quote {quote['symbol']} @ {quote[timekey]}:\n{new}") + f"New quote {quote['symbol']}:\n{new}") _cache[symbol] = quote payload.append(quote) else: