Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion application/runtime_strategy_adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
Comment on lines +135 to +137

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update the scoped-equity regression test

With managed symbols configured, this override now returns available_cash + sum(filtered market_values); the existing RequestHandlingTests.test_build_account_state_from_snapshot_uses_strategy_symbols fixture has $8,000 cash and $6,000 in managed holdings, but still asserts total_strategy_equity == 50000.0, so CI will fail once the pinned dependencies are installed. Please update that regression test to the new scoped-equity expectation (or add an equivalent test here) with this behavior change.

Useful? React with 👍 / 👎.

return account_state

def resolve_rebalance_plan(self, *, qqq_history, snapshot):
account_state = None
Expand Down
2 changes: 1 addition & 1 deletion tests/test_request_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down