From 8d2933817448a181fa7d5618f664b67d1bc6deb9 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 26 Aug 2020 21:45:34 -0400 Subject: [PATCH] Cleanup latency tracker --- piker/fsp.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/piker/fsp.py b/piker/fsp.py index fff90a48..40f14f3a 100644 --- a/piker/fsp.py +++ b/piker/fsp.py @@ -102,19 +102,16 @@ async def latency( # deliver zeros for all prior history yield np.zeros(len(ohlcv)) - _last = None async for quote in source: - fill_time = quote.get('rtTime_s') - if fill_time and fill_time != _last: - value = quote['brokerd_ts'] - fill_time - print(f"latency: {value}") + ts = quote.get('broker_ts') + if ts: + print( + f"broker time: {quote['broker_ts']}" + f"brokerd time: {quote['brokerd_ts']}" + ) + value = quote['brokerd_ts'] - quote['broker_ts'] yield value - _last = fill_time - # ticks = quote.get('ticks', ()) - # for tick in ticks: - # if tick.get('type') == 'trade': - async def last( source: 'TickStream[Dict[str, float]]', @@ -122,8 +119,6 @@ async def last( ) -> AsyncIterator[np.ndarray]: """Compute High-Low midpoint value. """ - # first_frame = (await source.__anext__()) - # deliver historical processed data first yield ohlcv['close']