Repository navigation
[RULE-REVIEW] POS-KILL: a leg of a defined-risk structure is never killed on its own (v1.0.1252) - #1583
Merged
Conversation
…lled on its own (v1.0.1252) Human (2026-11-02): "fix the condor close … make sure it works so we don't have this issue again and the logic works." Second half of that repair (the first, v1.0.1251, makes options_manager pursue a group close until the legs are gone). The Tier-1 per-position kill in syncMonitoredPositions judged every option leg by its own premium P&L. On 10-28/29 it read the two LONG WINGS of the GOOGL Nov-27 iron condor as "down −99.8%" and retried their liquidation every minute pre-market (122 audit lines), bought the short 310P back on a "−309%" reading at $27.60 while its 300P wing was itself submitted for a sell on a zero mark — while options_manager's own group rules fired on the same legs in the same minutes. A defined-risk structure's worst case is bounded by its wings; a per-leg percent kill cannot see that and closed the legs at different times, past max loss. Scope change, no threshold change: a leg whose recorded strategy (voltrade_options_state.json, read once per sync, 60 s cache) is in OPTIONS_DEFINED_RISK_STRATEGIES (shared/positionLevels.ts) leaves the kill branch with one POS-KILL-STRUCTURE-HOLD line per ticker per UTC day and no order; options_manager closes the group as a unit. Single legs and undefined-risk groups (short straddles) keep the backstop byte-for-byte: the branch opener, mark guard, two-tick confirmation, duplicate guard and POST are untouched (the hold is one more `continue` before the mark guard). Prior value, evidence and the rollback trigger (a defined-risk structure's realized loss beyond its max loss by > 10% while the manager could not act) are logged in research/experiments.md; KNOWN BROKEN #45 (b) closes. Tests: server/posKillStructureHold.test.ts (7) — the defined-risk set, the pure filter, wiring pins, and the real loop body run tick by tick against stubs (wing held, short leg held, standalone short put and a straddle leg still killed). All 117 kill-branch harness tests pass. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BrrwY7BFkP8VNdwKPfaVn5
github-actions Bot
pushed a commit
that referenced
this pull request
Nov 2, 2026
… under candidate profit-taking rules (#1584) Human (2026-11-02): "for the other options, figure out what's best for taking profit". Data: /api/diag/lots (400 option lots since 05-07) and /api/diag/option_bars (96 contracts' daily bars), the probes #1581 added. Result: no bought-option profit rule has a population — of 91 bought lots, 7 lived past a day, all legs of structures, none ever closed a day above +50% of its premium; the RULE-REVIEW candidate is withdrawn. Sold lots: the live 50% target holds (a 25% target cuts the best lot $1,300 → $520 and the total by ~$1,200; 75% ~ 50%). Where the money goes: 288 of 400 lots never saw a second session (<1h −$4,812, <1d −$5,011, 1–7d −$3,784, 8–30d +$845) — the exit churn the condor repair (#1582) and the POS-KILL structure hold (#1583) address in part; the same-day churn on single sold legs needs intraday marks the archive does not keep yet. Compiled: scripts/options_exit_study.py (re-runnable with DIAG_TOKEN); research/options_exit_study_2026-11-02.md (method, limits, the GOOGL condor case study, tables); research/experiments.md entry. No code path of the bot touched; no threshold changed. Claude-Session: https://claude.ai/code/session_01BrrwY7BFkP8VNdwKPfaVn5 Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Second half of "fix the condor close … make sure it works so we don't have this issue again" (2026-11-02). The first half, #1582 (v1.0.1251), makes
options_managerclose a multi-leg strategy as a unit and pursue the close until the legs are gone. This PR stops the Node side from undoing that.The Tier-1 per-position kill in
syncMonitoredPositionsjudged every option leg by its own premium P&L (−75 % long / −150 % short). On 10-28/29 it read the two long wings of the GOOGL Nov-27 iron condor as "down −99.8 %" and retried their liquidation every minute pre-market (122 audit lines), bought the short 310P back on a "−309 %" reading at $27.60 while its 300P wing was itself submitted for a sell on a zero mark — in the same minutes the options manager's own rules fired on the same legs (held_for_ordersrejections). A defined-risk structure's worst case is bounded by its wings; a per-leg percent kill cannot see that and, by closing the legs at different times, pushed the loss past the structure's max loss.What changes ([RULE-REVIEW]: scope, not threshold)
shared/positionLevels.ts:OPTIONS_DEFINED_RISK_STRATEGIES= iron_condor, qqq_iron_condor, bull_put_credit_spread, bull_call_spread, bear_put_spread, buy_straddle (a subset of the multi-leg set; short straddles are undefined-risk and stay out).server/bot.ts:posKillOptionsStructures()readsvoltrade_options_state.jsononce per sync (60 s cache) through the pureposKillDefinedRiskLegs(); inside the kill branch, a leg whose recorded strategy is defined-risk leaves the branch with onePOS-KILL-STRUCTURE-HOLDaudit line per ticker per UTC day and no order — the options manager closes the group. The branch opener, the mark guard, the two-tick confirmation, the duplicate guard, the POST and the informationalPOS-KILL-OPTION-HOLDline are untouched (the hold is one morecontinuebefore the mark guard; the sibling harness tests slice on the unchanged opener and still pass).Downstream chain (REASONING STANDARD §1)
Fewer per-leg liquidations on structures → no duplicate orders against the manager's group close → the group closes as a unit at one moment, inside its wings' bound. During a Python-side halt a defined-risk structure is now unmanaged by Node, which is acceptable precisely because its loss is bounded by construction; undefined-risk legs keep the backstop. Single legs (the CSP sleeve) are unchanged.
Tests
server/posKillStructureHold.test.ts(new, 7): the set is a subset of the multi-leg set without short_straddle;posKillDefinedRiskLegsadmits only defined-risk legs (unknown / single / short-straddle / garbage rejected); wiring pins (read once per sync, unchanged opener, hold before the mark guard withcontinue, option-skip line untouched); the real loop body run tick by tick against stubs — a condor wing at −99 % held with one line per day, the condor's short leg at −309 % held, a standalone sold put at −160 % and a straddle leg still killed on the second valid-mark tick, the informational OPTION-HOLD line unchanged.Closes
research/open_questions.mdKNOWN BROKEN #45 (b).Generated by Claude Code