Cleanup latency tracker
parent
0d08e39597
commit
6ce8d1147e
19
piker/fsp.py
19
piker/fsp.py
|
@ -102,19 +102,16 @@ async def latency(
|
||||||
# deliver zeros for all prior history
|
# deliver zeros for all prior history
|
||||||
yield np.zeros(len(ohlcv))
|
yield np.zeros(len(ohlcv))
|
||||||
|
|
||||||
_last = None
|
|
||||||
async for quote in source:
|
async for quote in source:
|
||||||
fill_time = quote.get('rtTime_s')
|
ts = quote.get('broker_ts')
|
||||||
if fill_time and fill_time != _last:
|
if ts:
|
||||||
value = quote['brokerd_ts'] - fill_time
|
print(
|
||||||
print(f"latency: {value}")
|
f"broker time: {quote['broker_ts']}"
|
||||||
|
f"brokerd time: {quote['brokerd_ts']}"
|
||||||
|
)
|
||||||
|
value = quote['brokerd_ts'] - quote['broker_ts']
|
||||||
yield value
|
yield value
|
||||||
|
|
||||||
_last = fill_time
|
|
||||||
# ticks = quote.get('ticks', ())
|
|
||||||
# for tick in ticks:
|
|
||||||
# if tick.get('type') == 'trade':
|
|
||||||
|
|
||||||
|
|
||||||
async def last(
|
async def last(
|
||||||
source: 'TickStream[Dict[str, float]]',
|
source: 'TickStream[Dict[str, float]]',
|
||||||
|
@ -122,8 +119,6 @@ async def last(
|
||||||
) -> AsyncIterator[np.ndarray]:
|
) -> AsyncIterator[np.ndarray]:
|
||||||
"""Compute High-Low midpoint value.
|
"""Compute High-Low midpoint value.
|
||||||
"""
|
"""
|
||||||
# first_frame = (await source.__anext__())
|
|
||||||
|
|
||||||
# deliver historical processed data first
|
# deliver historical processed data first
|
||||||
yield ohlcv['close']
|
yield ohlcv['close']
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue