From 62553424ab92b826a7893d842f8268012401a4f9 Mon Sep 17 00:00:00 2001 From: Codex Date: Mon, 8 Jun 2026 15:18:53 +0200 Subject: [PATCH] =?UTF-8?q?PINK:=20fix=20vel=5Fdiv=20always-None=20in=20Ha?= =?UTF-8?q?zelcastDataFeed=20=E2=80=94=20normalize=5Fng7=5Fscan=20hoists?= =?UTF-8?q?=20vel=5Fdiv=20to=20top-level=20data=20dict=20but=20feed=20was?= =?UTF-8?q?=20reading=20scan=20(inner=20result=20sub-dict)=20which=20has?= =?UTF-8?q?=20no=20vel=5Fdiv.=20Now=20checks=20data.get('vel=5Fdiv')=20fir?= =?UTF-8?q?st=20(top-level),=20then=20scan,=20then=20recomputes=20from=20m?= =?UTF-8?q?ulti=5Fwindow=5Fresults.=20PINK=20was=20receiving=20velocity=5F?= =?UTF-8?q?divergence=3DNone=20on=20every=20snapshot=20and=20never=20enter?= =?UTF-8?q?ing=20trades=20even=20when=20BLUE=20(same=20threshold)=20did.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- prod/clean_arch/adapters/hazelcast_feed.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/prod/clean_arch/adapters/hazelcast_feed.py b/prod/clean_arch/adapters/hazelcast_feed.py index 2803ab0..05e8db0 100644 --- a/prod/clean_arch/adapters/hazelcast_feed.py +++ b/prod/clean_arch/adapters/hazelcast_feed.py @@ -126,7 +126,13 @@ class HazelcastDataFeed(DataFeedPort): # Prefer an explicit vel_div if present; otherwise compute it from # 50 vs 750 velocity tracking on the single-result schema. - vel_div = scan.get('vel_div') + # NOTE: normalize_ng7_scan() hoists vel_div to the top-level data + # dict, but scan == result (inner sub-dict) which does NOT have it. + # Check the top-level data first, then the scan sub-dict, then + # recompute from multi_window_results as a last resort. + vel_div = data.get('vel_div') if isinstance(data, dict) else None + if vel_div is None: + vel_div = scan.get('vel_div') if vel_div is None: multi = scan.get('multi_window_results') or {} if isinstance(multi, dict):