Skip to content

feat(risk): freeze TQQQ ETF-only research mandate - #302

Merged
Pigbibi merged 1 commit into
mainfrom
codex/qsl-p3-tqqq-static1-qpk-mandate-019fe21a
Aug 8, 2026
Merged

feat(risk): freeze TQQQ ETF-only research mandate#302
Pigbibi merged 1 commit into
mainfrom
codex/qsl-p3-tqqq-static1-qpk-mandate-019fe21a

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Scope

  • freeze tqqq_etf_only_research_v1 as an exact RESEARCH_ONLY ETF-only mandate
  • bind candidate/state/stop/breaker/drawdown evidence into risk-gate assessment v2
  • enforce TQQQ/BOXX caps, one-nonzero rule, no margin stacking, cash-only over-cap normalization, and zero execution authority
  • extend pure sizing for exact TQQQ/BOXX product identities

Safety boundaries

  • no provider or real backtest calls
  • no platform/runtime/config changes
  • no paper/shadow/live/order/capital authority
  • target containment remains a separate fail-closed prerequisite

Evidence

  • tests-first RED captured on exact base 190b7577e3d4cd826f053e4b899c13e127191097
  • focused: 9 passed, 43 subtests passed (later expanded coverage)
  • full: 932 passed, 1 skipped, 26 warnings, 131 subtests passed
  • ruff check ., compile, package, diff, scope, and secret gates passed

Bound freeze SHA-256: 4e8896cdd16eefff7631ce8c491cdba283e3dca19770735fd7a7f0b53fd498ce
Containment SHA-256: 4aeacd014221cfc8be6541f4d083463c4e6b4f12df48d50d07157d30f2db84dc

Co-Authored-By: Codex <noreply@openai.com>
@Pigbibi
Pigbibi merged commit 4fee4d9 into main Aug 8, 2026
1 check passed
@Pigbibi
Pigbibi deleted the codex/qsl-p3-tqqq-static1-qpk-mandate-019fe21a branch August 8, 2026 17:00

@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: d687678322

ℹ️ 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 +775 to +776
and weight
> loss_budget * drawdown_scalar / stop_distance + 1e-9

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 Enforce the budget against completed-session equity

For this mandate, loss_budget_equity_reference is fixed to completed_session_equity, but this comparison uses a weight derived from portfolio_snapshot.total_equity (including when a target_value is normalized) and the gate never receives the completed-session equity value. When current equity differs from the completed-session reference, the one-percent budget is therefore applied to the wrong base; for example, with completed-session equity of $100k and current equity of $120k, a $24k BOXX target becomes weight 0.20 and passes this check while its modeled 5% loss is $1,200, or 1.2% of the mandated reference. Bind the completed-session equity into the evidence and compare the modeled dollar loss against that value.

Useful? React with 👍 / 👎.

Comment on lines +624 to +626
tqqq_active = any(symbol == "TQQQ" for symbol, _ in active_positions)
if tqqq_active and risk_control_state.get("stop_intent_ready") is not True:
errors.add("stop_intent_not_ready")

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 Check stop readiness against current TQQQ holdings

This derives tqqq_active only from the proposed decision, not from the portfolio snapshot. If the account currently holds TQQQ but the new decision targets cash (or otherwise omits TQQQ), the gate accepts stop_intent_ready=False and missing fill identities even though the position remains exposed until the exit fills; a snapshot with current TQQQ exposure and an empty decision can consequently receive APPROVE. Determine active TQQQ exposure from the current portfolio state, or require the stop evidence until the holding is confirmed flat.

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