Guard zero-equity weight target translation - #123
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c27da7ed87
ℹ️ 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".
| positions.append( | ||
| PositionTarget( | ||
| symbol=position.symbol, | ||
| target_value=0.0, |
There was a problem hiding this comment.
Preserve holdings for blocked zero-equity plans
When a margin or loan-backed account reports total_equity <= 0 while still holding strategy symbols, this branch converts the blocked weight decision into zero-dollar targets. The generated plan does not carry a consumable no_execute guard for execution; the rebalance loop reads allocation["targets"] and sells whenever target_values[symbol] - market_values[symbol] is below the threshold (application/execution_service.py:606, application/execution_service.py:693). Previously this input failed before any executable plan was produced, but now it can submit liquidation sells for those symbols. For a no-execute fallback, keep current market values as targets or add an execution block that downstream code actually honors.
Useful? React with 👍 / 👎.
Summary
Validation