Skip to content

Retain existing leveraged ETF shares for small accounts#89

Merged
Pigbibi merged 1 commit into
mainfrom
codex/small-account-retention-floor
Jun 18, 2026
Merged

Retain existing leveraged ETF shares for small accounts#89
Pigbibi merged 1 commit into
mainfrom
codex/small-account-retention-floor

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • keep an existing whole share for TQQQ/SOXL when the positive target is below one share price
  • preserve existing cash-substitution behavior for other unbuyable sleeves
  • add regression coverage for the sell-all-then-cannot-buy-back case

Tests

  • python -m py_compile application/execution_service.py tests/test_execution_service.py
  • git diff --check
  • timeout 120 python -m pytest tests/test_execution_service.py -k 'existing_whole_share or uses_sellable_quantity or insufficient_cash_for_whole_share or leaves_small_safe_haven' -q

@Pigbibi Pigbibi merged commit b190aed into main Jun 18, 2026
1 check passed
@Pigbibi Pigbibi deleted the codex/small-account-retention-floor branch June 18, 2026 06:18

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

Copy link
Copy Markdown

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

ℹ️ 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 +264 to +265
if price > 0.0 and 0.0 < target_value < price and quantities.get(symbol, 0.0) >= 1.0:
compatibility_targets[symbol] = price

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Account for the trade threshold when retaining one share

When the default $100 min-trade floor is used and TQQQ is below $100, an account holding exactly two TQQQ shares with a positive sub-share target gets its target raised to one quote here; the later threshold check then sees only a one-share delta (<$100) and skips the sell, leaving two leveraged shares instead of the intended single retained share. The added regression sets current_min_trade to 10, so it misses this production-default path.

Useful? React with 👍 / 👎.

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