Skip to content

Add shared cash sweep whole-share helper#41

Merged
Pigbibi merged 1 commit into
mainfrom
codex/cash-sweep-helper-shared
May 16, 2026
Merged

Add shared cash sweep whole-share helper#41
Pigbibi merged 1 commit into
mainfrom
codex/cash-sweep-helper-shared

Conversation

@Pigbibi
Copy link
Copy Markdown
Contributor

@Pigbibi Pigbibi commented May 16, 2026

Add a shared helper that decides cash-sweep sells only when selling the full safe-haven position can fund at least one whole-share buy.\n\nValidation:\n- pytest tests/test_cash_sweep.py -q\n- py_compile on touched files

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: a4e9f95225

ℹ️ 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 +67 to +69
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 when deciding whole-share sweep sale

should_sell_cash_sweep_to_fund_whole_share_buy ignores underweight_value, so it can return True even when no symbol has enough underweight for a whole share (for example, underweight < ask_price). In that case we may sell the full cash-sweep position even though no corresponding buy can be placed, which creates unnecessary churn and leaves cash idle. This differs from estimate_cash_sweep_sale_quantity_to_fund_buy, which explicitly skips entries where underweight_value cannot fund at least one share.

Useful? React with 👍 / 👎.

@Pigbibi Pigbibi merged commit 3e915e8 into main May 16, 2026
1 check passed
@Pigbibi Pigbibi deleted the codex/cash-sweep-helper-shared branch May 16, 2026 02:34
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