From fc24f5efd1826100275a3c4d5208e4250674a0b2 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 31 May 2022 18:07:51 -0400 Subject: [PATCH] Iterate 1s and 1m from tsdb series --- piker/data/marketstore.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/piker/data/marketstore.py b/piker/data/marketstore.py index 43b15671..4d1c91ad 100644 --- a/piker/data/marketstore.py +++ b/piker/data/marketstore.py @@ -639,12 +639,13 @@ async def tsdb_history_update( tsdb_arrays = await storage.read_ohlcv(fqsn) # hist diffing if tsdb_arrays: - onesec = tsdb_arrays[1] - - # these aren't currently used but can be referenced from - # within the embedded ipython shell below. - to_append = ohlcv[ohlcv['time'] > onesec['Epoch'][-1]] - to_prepend = ohlcv[ohlcv['time'] < onesec['Epoch'][0]] + for secs in (1, 60): + ts = tsdb_arrays.get(secs) + if ts is not None and len(ts): + # these aren't currently used but can be referenced from + # within the embedded ipython shell below. + to_append = ohlcv[ohlcv['time'] > ts['Epoch'][-1]] + to_prepend = ohlcv[ohlcv['time'] < ts['Epoch'][0]] profiler('Finished db arrays diffs')