Drop remaining timeframe scanning from `.read_ohlcv()`
parent
143e86a80c
commit
b7ef0596b9
|
@ -450,35 +450,11 @@ class Storage:
|
||||||
limit=limit,
|
limit=limit,
|
||||||
)
|
)
|
||||||
|
|
||||||
if timeframe is None:
|
try:
|
||||||
log.info(f'starting {fqsn} tsdb granularity scan..')
|
result = await client.query(params)
|
||||||
# loop through and try to find highest granularity
|
except purerpc.grpclib.exceptions.UnknownError:
|
||||||
for tfstr in tf_in_1s.values():
|
# indicate there is no history for this timeframe
|
||||||
try:
|
return {}
|
||||||
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 = {}
|
|
||||||
|
|
||||||
# TODO: it turns out column access on recarrays is actually slower:
|
# 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
|
# 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]
|
ts = tf_in_1s.inverse[data_set.timeframe]
|
||||||
if time_step > ts:
|
if time_step > ts:
|
||||||
log.warning(f'MKTS BUG: wrong timeframe loaded: {time_step}')
|
log.warning(f'MKTS BUG: wrong timeframe loaded: {time_step}')
|
||||||
print("WTF MKTS")
|
|
||||||
return {}
|
return {}
|
||||||
else:
|
|
||||||
ts = timeframe
|
|
||||||
|
|
||||||
return array
|
return array
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue