From 4a7b2d835b92699381a5d9ab9889afa08d9be94d Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 8 Feb 2022 07:46:36 -0500 Subject: [PATCH] Yield 0 initial values from `flow_rates` fsp --- piker/fsp/_volume.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/piker/fsp/_volume.py b/piker/fsp/_volume.py index eaeca7cf..bef5ea5f 100644 --- a/piker/fsp/_volume.py +++ b/piker/fsp/_volume.py @@ -272,6 +272,11 @@ async def flow_rates( vr = quote.get('volumeRate') yield '1m_vlm_rate', vr or 0 + yield 'trade_rate', 0 + yield 'dark_trade_rate', 0 + yield 'dvlm_rate', 0 + yield 'dark_dvlm_rate', 0 + # NOTE: in theory we could dynamically allocate a cascade based on # this call but not sure if that's too "dynamic" in terms of # validating cascade flows from message typing perspective. @@ -280,10 +285,6 @@ async def flow_rates( # on this same source flow. dvlm_shm = dolla_vlm.get_shm(ohlcv) - # breakpoint() - # import tractor - # await tractor.breakpoint() - # precompute arithmetic mean weights (all ones) seq = np.full((period,), 1) weights = seq / seq.sum() @@ -306,7 +307,9 @@ async def flow_rates( period, weights=weights, ) - yield 'trade_rate', trade_rate_wma[-1] + trade_rate = trade_rate_wma[-1] + # print(trade_rate) + yield 'trade_rate', trade_rate else: # instantaneous rate per sample step count = dvlm_shm.array['trade_count'][-1]