Cleanup latency tracker

bar_select
Tyler Goodlet 2020-08-26 21:45:34 -04:00
parent 58b2e7e395
commit 8d29338174
1 changed files with 7 additions and 12 deletions

View File

@ -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']