From 1dca7766d20763f3eeae7c735cf8f9843af875c9 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 16 May 2022 14:31:23 -0400 Subject: [PATCH] Add notes about how to do mkts "trimming" Which is basically just "deleting" rows from a column series. You can only use the trim command from the `.cmd` cli and only with a so called `LocalClient` currently; it's also sketchy af and caused a machine to hang due to mem usage.. Ideally we can patch in this functionality for use by the rpc api and have it not hang like this XD Pertains to https://github.com/alpacahq/marketstore/issues/264 --- piker/data/marketstore.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/piker/data/marketstore.py b/piker/data/marketstore.py index e1fb38d5..43b15671 100644 --- a/piker/data/marketstore.py +++ b/piker/data/marketstore.py @@ -230,8 +230,8 @@ _ohlcv_dt = [ # ohlcv sampling ('Open', 'f4'), ('High', 'f4'), - ('Low', 'i8'), - ('Close', 'i8'), + ('Low', 'f4'), + ('Close', 'f4'), ('Volume', 'f4'), ] @@ -547,6 +547,17 @@ class Storage: if err: raise MarketStoreError(err) + # XXX: currently the only way to do this is through the CLI: + + # sudo ./marketstore connect --dir ~/.config/piker/data + # >> \show mnq.globex.20220617.ib/1Sec/OHLCV 2022-05-15 + # and this seems to block and use up mem.. + # >> \trim mnq.globex.20220617.ib/1Sec/OHLCV 2022-05-15 + + # relevant source code for this is here: + # https://github.com/alpacahq/marketstore/blob/master/cmd/connect/session/trim.go#L14 + # def delete_range(self, start_dt, end_dt) -> None: + # ... @acm async def open_storage_client(