Sync 1s (or less) sampler steps using rounded now-epoch
parent
7649df1a24
commit
cdc22e0807
|
@ -137,6 +137,14 @@ async def increment_ohlc_buffer(
|
||||||
'close',
|
'close',
|
||||||
]]
|
]]
|
||||||
|
|
||||||
|
next_t = t + this_delay_s
|
||||||
|
i_epoch = round(time.time())
|
||||||
|
|
||||||
|
if this_delay_s <= 1:
|
||||||
|
next_t = i_epoch
|
||||||
|
|
||||||
|
# print(f'epoch {shm.token["shm_name"]}: {next_t}')
|
||||||
|
|
||||||
# this copies non-std fields (eg. vwap) from the last datum
|
# this copies non-std fields (eg. vwap) from the last datum
|
||||||
last[[
|
last[[
|
||||||
'time',
|
'time',
|
||||||
|
@ -149,7 +157,7 @@ async def increment_ohlc_buffer(
|
||||||
'volume',
|
'volume',
|
||||||
]][0] = (
|
]][0] = (
|
||||||
# epoch timestamp
|
# epoch timestamp
|
||||||
t + this_delay_s,
|
next_t,
|
||||||
|
|
||||||
# OHLC
|
# OHLC
|
||||||
close,
|
close,
|
||||||
|
|
Loading…
Reference in New Issue