Skip to content
Merged
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_broker_adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,15 @@ def build_portfolio_snapshot_from_account_state(self, account_state):
)

def build_account_state_from_snapshot(self, snapshot):
return build_account_state_from_portfolio_snapshot(
account_state = build_account_state_from_portfolio_snapshot(
snapshot,
strategy_symbols=self.strategy_symbols,
)
if self.strategy_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 +190 to +192

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 Normalize snapshot symbols before recomputing equity

When resolve_rebalance_plan is given a PortfolioSnapshot whose positions use LongBridge/full market symbols such as SOXL.US, build_account_state_from_portfolio_snapshot filters those positions against self.strategy_symbols like SOXL, so the converted market_values are all zero. This new override then replaces the previous snapshot.total_equity with cash-only equity, causing strategies that request account_state from a broker-symbol snapshot to understate total strategy equity. Strip/normalize the configured suffix before relying on the filtered market_values, or compute the sum from symbols matched to the strategy roots.

Useful? React with 👍 / 👎.

return account_state

def build_managed_portfolio_snapshot(self, quote_context, trade_context):
return self.build_portfolio_snapshot_from_account_state(
Expand Down