From 423af373891f46253f85fe128b1adcbb5855d473 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 27 Apr 2022 17:17:40 -0400 Subject: [PATCH] Truncate trade rate wma window sizes --- piker/fsp/_momo.py | 1 + piker/fsp/_volume.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/piker/fsp/_momo.py b/piker/fsp/_momo.py index 01e41c04..488ae22c 100644 --- a/piker/fsp/_momo.py +++ b/piker/fsp/_momo.py @@ -167,6 +167,7 @@ def _wma( assert length == len(weights) + # lol, for long sequences this is nutso slow and expensive.. return np.convolve(signal, weights, 'valid') diff --git a/piker/fsp/_volume.py b/piker/fsp/_volume.py index 47211234..b5456fac 100644 --- a/piker/fsp/_volume.py +++ b/piker/fsp/_volume.py @@ -309,7 +309,7 @@ async def flow_rates( if period > 1: trade_rate_wma = _wma( - dvlm_shm.array['trade_count'], + dvlm_shm.array['trade_count'][-period:], period, weights=weights, ) @@ -332,7 +332,7 @@ async def flow_rates( if period > 1: dark_trade_rate_wma = _wma( - dvlm_shm.array['dark_trade_count'], + dvlm_shm.array['dark_trade_count'][-period:], period, weights=weights, )