Retain existing leveraged ETF shares for small accounts - #167
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 46c6e09771
ℹ️ 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".
| target_mv[symbol] = price | ||
| if investable > 0.0: | ||
| target_weights[symbol] = price / investable |
There was a problem hiding this comment.
Preserve total target notional when retaining a share
When a fully allocated small account already holds one TQQQ/SOXL share and the desired sleeve is below one share, this raises only that sleeve's target notional but leaves the other targets unchanged. For example, with $100 equity, one $80 TQQQ share, 60% TQQQ / 40% QQQM targets, and margin buying power, the effective targets become $80 + $40, so the buy loop can submit QQQM buys that take the account to 120% gross exposure instead of treating the retained extra $20 as already consuming allocation. Please offset the retained-share notional from cash/other sleeves or keep this adjustment limited to the sell floor rather than increasing total targets.
Useful? React with 👍 / 👎.
Summary
Tests