From 5c91bc2e5b7c9ffc1647ee5baaf5fb7cbf304a95 Mon Sep 17 00:00:00 2001 From: Pigbibi <20649888+Pigbibi@users.noreply.github.com> Date: Thu, 11 Jun 2026 04:14:05 +0800 Subject: [PATCH 1/2] Fix strategy account equity --- application/runtime_strategy_adapters.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/application/runtime_strategy_adapters.py b/application/runtime_strategy_adapters.py index fefed2d..0832f9d 100644 --- a/application/runtime_strategy_adapters.py +++ b/application/runtime_strategy_adapters.py @@ -127,10 +127,15 @@ def build_semiconductor_indicators(self, market_data_source, *, trend_window: in ) def build_account_state_from_snapshot(self, snapshot) -> dict[str, object]: - return build_account_state_from_portfolio_snapshot( + account_state = build_account_state_from_portfolio_snapshot( snapshot, strategy_symbols=self.managed_symbols, ) + if self.managed_symbols: + account_state["total_strategy_equity"] = float(account_state["available_cash"]) + sum( + float(value) for value in dict(account_state["market_values"]).values() + ) + return account_state def resolve_rebalance_plan(self, *, qqq_history, snapshot): account_state = None From 5ed9f33249e0bf79de3493e327f6162405c97bc8 Mon Sep 17 00:00:00 2001 From: Pigbibi <20649888+Pigbibi@users.noreply.github.com> Date: Thu, 11 Jun 2026 04:17:23 +0800 Subject: [PATCH 2/2] Update Schwab strategy equity test --- tests/test_request_handling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_request_handling.py b/tests/test_request_handling.py index 27d39b8..41b0550 100644 --- a/tests/test_request_handling.py +++ b/tests/test_request_handling.py @@ -655,7 +655,7 @@ def test_build_account_state_from_snapshot_uses_strategy_symbols(self): self.assertEqual(account_state["market_values"]["TQQQ"], 1000.0) self.assertEqual(account_state["market_values"]["BOXX"], 5000.0) self.assertNotIn("QQQ", account_state["market_values"]) - self.assertEqual(account_state["total_strategy_equity"], 50000.0) + self.assertEqual(account_state["total_strategy_equity"], 14000.0) def test_build_semiconductor_indicators_uses_soxl_and_soxx_histories(self): module = load_module()