[codex] fix LongBridge strategy account equity#152
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ffba964fc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| account_state["total_strategy_equity"] = float(account_state["available_cash"]) + sum( | ||
| float(value) for value in dict(account_state["market_values"]).values() | ||
| ) |
There was a problem hiding this comment.
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 👍 / 👎.
Summary
total_strategy_equityto use strategy-symbol market value plus available cash.Root Cause
The shared converter may come from an older pinned QuantPlatformKit release, so platform-side account-state conversion needs the same filtered total-equity guard.
Validation
python3 -m py_compile application/runtime_broker_adapters.py