From b7ef0596b90a811d32742308a40b12ab9775cdc8 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 26 Oct 2022 00:53:45 -0400 Subject: [PATCH] Drop remaining timeframe scanning from `.read_ohlcv()` --- piker/data/marketstore.py | 37 +++++-------------------------------- 1 file changed, 5 insertions(+), 32 deletions(-) diff --git a/piker/data/marketstore.py b/piker/data/marketstore.py index 0d0c30d6..c84b5a78 100644 --- a/piker/data/marketstore.py +++ b/piker/data/marketstore.py @@ -450,35 +450,11 @@ class Storage: limit=limit, ) - if timeframe is None: - log.info(f'starting {fqsn} tsdb granularity scan..') - # loop through and try to find highest granularity - for tfstr in tf_in_1s.values(): - try: - log.info(f'querying for {tfstr}@{fqsn}') - params.set('timeframe', tfstr) - result = await client.query(params) - timeframe = tf_in_1s.inverse[tfstr] - break - - except purerpc.grpclib.exceptions.UnknownError: - # XXX: this is already logged by the container and - # thus shows up through `marketstored` logs relay. - # log.warning(f'{tfstr}@{fqsn} not found') - continue - else: - return {} - - else: - params.set('timeframe', tfstr) - try: - result = await client.query(params) - except purerpc.grpclib.exceptions.UnknownError: - # indicate there is no history for this timeframe - return {} - - # # Fill out a `numpy` array-results map keyed by timeframe - # arrays = {} + try: + result = await client.query(params) + except purerpc.grpclib.exceptions.UnknownError: + # indicate there is no history for this timeframe + return {} # TODO: it turns out column access on recarrays is actually slower: # https://jakevdp.github.io/PythonDataScienceHandbook/02.09-structured-data-numpy.html#RecordArrays:-Structured-Arrays-with-a-Twist @@ -496,10 +472,7 @@ class Storage: ts = tf_in_1s.inverse[data_set.timeframe] if time_step > ts: log.warning(f'MKTS BUG: wrong timeframe loaded: {time_step}') - print("WTF MKTS") return {} - else: - ts = timeframe return array