Skip to content

Retain existing leveraged ETF shares for small accounts - #167

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

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

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

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 unbuyable_weight_target or zero_target_sell' -q (fails in local collection: ModuleNotFoundError: No module named 'pandas')

@Pigbibi
Pigbibi merged commit a982cc7 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: 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".

Comment on lines +1167 to +1169
target_mv[symbol] = price
if investable > 0.0:
target_weights[symbol] = price / investable

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

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