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 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()