From a971de2b6777cc325361d9ab096b00ee5ceb57ac Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 29 Mar 2022 13:33:43 -0400 Subject: [PATCH] Drop `ms-shell`, add `piker storesh` cmd --- piker/data/cli.py | 42 +++++++++------------------------------ piker/data/marketstore.py | 3 +++ 2 files changed, 12 insertions(+), 33 deletions(-) diff --git a/piker/data/cli.py b/piker/data/cli.py index 29ccf2cf..554048a4 100644 --- a/piker/data/cli.py +++ b/piker/data/cli.py @@ -126,7 +126,7 @@ def ms_stream( ) @click.argument('symbols', nargs=-1) @click.pass_obj -def ms_shell( +def storesh( config, tl, host, @@ -137,43 +137,18 @@ def ms_shell( Start an IPython shell ready to query the local marketstore db. ''' - from piker.data.marketstore import backfill_history_diff + from piker.data.marketstore import tsdb_history_update from piker._daemon import open_piker_runtime async def main(): nonlocal symbols async with open_piker_runtime( - 'ms_shell', + 'storesh', enable_modules=['piker.data._ahab'], ): - try: - await backfill_history_diff() - except OSError: - # TODO: write magics to query marketstore - - sym = symbols[0] - symbol, _, broker = sym.rpartition('.') - # (maybe) allocate shm array for this broker/symbol which will - # be used for fast near-term history capture and processing. - shm, opened = maybe_open_shm_array( - key=sym, - dtype=base_iohlc_dtype, - ) - # load anything found in shm - from numpy.lib.recfunctions import structured_to_unstructured - mxmn = structured_to_unstructured( - shm.array[['low', 'high']], - # dtype=[('mxmn', '