Use shared cash sweep whole-share helper#65
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5c8d9ad22b
ℹ️ 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".
| for underweight_value, ask_price in funding_needs: | ||
| _ = underweight_value | ||
| quote_price = float(ask_price or 0.0) |
There was a problem hiding this comment.
Honor underweight size in fallback cash-sweep decision
In the ImportError fallback path (older shared-wheel environments), the new helper ignores underweight_value (_ = underweight_value) and can return True solely because one share is affordable after selling BOXX. This regresses the previous behavior that skipped sweep sales when the target deficit was less than one share (max_buy_quantity <= 0), so the system can now sell BOXX even though the subsequent buy computes qty == 0 and no risk asset order is placed. That produces unnecessary safe-haven liquidation and portfolio drift whenever a candidate’s underweight notional is above minimum_order_notional but below its share price.
Useful? React with 👍 / 👎.
Switch IBKR cash-sweep decisions to the shared whole-share helper so BOXX is only sold when the full position can fund at least one whole-share buy.\n\nValidation:\n- py_compile on touched files\n- minimal runtime script with a fake pandas shim to verify the buy-short cash sweep path