Skip to content

Use shared cash sweep whole-share helper#65

Merged
Pigbibi merged 2 commits into
mainfrom
codex/cash-sweep-helper-ibkr
May 16, 2026
Merged

Use shared cash sweep whole-share helper#65
Pigbibi merged 2 commits into
mainfrom
codex/cash-sweep-helper-ibkr

Conversation

@Pigbibi
Copy link
Copy Markdown
Collaborator

@Pigbibi Pigbibi commented May 16, 2026

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

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +33 to +35
for underweight_value, ask_price in funding_needs:
_ = underweight_value
quote_price = float(ask_price or 0.0)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@Pigbibi Pigbibi merged commit f0ea5ff into main May 16, 2026
1 check passed
@Pigbibi Pigbibi deleted the codex/cash-sweep-helper-ibkr branch May 16, 2026 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant