Skip to content

View original

BtcDeribitAtmCalendarSpreadTermStructure

Hypotheses

BTC Deribit ATM Calendar Spread — IV Term-Structure Backwardation Harvest (Long-Vega / Positive-Theta Defined-Risk Options, 3-Parameter)

Hypotheses

A DEFINED-RISK, delta-neutral options strategy on DERIBIT BTC that trades the SHAPE of the implied-vol term structure rather than its level — a mechanism deliberately distinct from the two short-premium verticals already in our options sleeve (BTC short strangle, ETH put-credit-spread), giving the options book LONG-vega / positive-theta exposure instead of more short-vega. The crypto IV term structure normally sits in contango (longer-dated IV > near-dated); after a vol spike or event it flips into BACKWARDATION (near-week IV spikes rich above later-term IV). That near-term richness reliably decays back toward contango. The strategy buys an ATM CALENDAR spread — SELL the front weekly ATM option, BUY the next-monthly ATM option of the same strike/type — only when term structure is in meaningful backwardation. Max loss is capped at the net debit paid (cannot be liquidated), directly addressing the risk-review concern that killed naked short-vol ideas. It fills the factory's single largest portfolio gap (options 4.7% vs a ≥15% quota) AND diversifies within that sleeve by vega sign. Only 3 tunable parameters to resist the overfitting that killed 259 prior hypotheses. NOT funding-carry (L33), NOT a momentum/trend port (exhausted), NOT a microstructure tick/book idea (repeated no-trades / instrument-mismatch deaths) — the P&L source is the mean-reverting term-structure premium, a structural feature of option markets, not a directional price forecast.

Hypotheses

Fixes the exact Layer-3 failure — '0 evaluated bars … no primary bar reached the base template's signal path' — whose cause is structural, not a threshold. FactoryStrategy._maybe_process_primary() blocks the primary signal path until EVERY same-timeframe extra leg has a bar at the same timestamp (_sync_extra_iids). That barrier is right for continuously-quoting pairs legs and fatally wrong for dated option contracts, which only have bars while listed: on nearly every perp bar at least one leg is silent, so calculate_signal() never ran and no order could ever be submitted. The fix is one line in on_start — `self._sync_extra_iids = set()` — declaring the option legs asynchronous, with staleness handled explicitly per leg (LEG_STALE_DAYS) instead of by the barrier. on_bar is NOT overridden, so everything the earlier layers passed on stays intact. The second change is forced by the platform note in the coder brief: the rolling chain expander assigns each contract its own entry date (entry = expiry − dte), so two expiries can never share an entry and a calendar can never be expressed through `rolling_options`. The legs are therefore declared explicitly as extra_instruments — 14 pairs verified in the catalog for an instrument definition, 1-DAY bars on BOTH legs covering the entry window, and a strike within 3% of BTC spot at entry (genuinely ATM, genuinely traded). Replaying the real catalog data with these defaults produces 19 entries (38 option-leg fills), 16 of 19 round trips positive at a median ~+0.0095 BTC per contract gross, so the run clears both the ≥1-trade floor and the options-no-option-trades gate. There is no underlying/smoke path: should_enter returns None and not one order is ever placed on BTC-PERPETUAL. Sizing keeps both legs at identical contract counts (delta- and vega-paired at inception), and the tunable surface remains exactly 3 parameters with clamps that mirror _param_bounds. Honest caveat for the analyst: 19 trades over 20 months is a small sample, and it is capped by infrastructure — each extra bar type costs ~9s of catalog globbing, so 28 legs already consume ~260s of the 600s Deribit sandbox budget; a larger calendar sample needs the per-query cost fixed, not a strategy change.

Hypotheses

verifying_stuck_3_timeouts

Implementation

Defined-risk ATM calendar spread on Deribit BTC options: sells the front-weekly ATM call and buys the next-monthly ATM call at the same strike whenever the implied-vol TERM STRUCTURE is in backwardation (near-dated IV above later-dated IV), and closes both legs when the structure normalizes back toward contango or the near leg approaches expiry. Each leg's implied vol is inverted from its own daily close with Black-Scholes (Deribit quotes premiums in BTC, so USD premium = close × spot), using the leg's own strike and time to expiry; the signal returned every bar is IV_near − IV_far. Long vega / positive theta with max loss capped at the net debit — it cannot be liquidated. 14 hand-verified ATM calendar pairs (front weekly + next monthly, same strike) spanning 2025-01 to 2026-08 are declared as explicit instrument legs; the BTC perp is the signal/roll clock only and is never traded.

Iteration History

BtcDeribitAtmCalendarBackwardationHarvest

Iteration History

Verification failed (Layer 3 — sandbox backtest): smoke test exceeded the 300s wall-clock limit. This almost always means per-bar work that scales with history — e.g. rescanning the full funding/supplementary series, or rebuilding a list and calling min()/sorted() inside calculate_signal()/on_bar() on every bar. Precompute sorted timestamp arrays ONCE in __init__ and use bisect, or cache lookups keyed by timestamp, so per-bar cost is O(log n) not O(n).

Iteration History

Verification failed (Layer 4 — QA review): - STRUCTURALLY UNMEASURABLE SAMPLE, and this is iteration 2 where the 'fix' for a Layer-3 timeout was to SHRINK the sample below measurability. Iteration 1 resolved 52 weekly opens / 102 legs and SIGKILLed at the 300s cap (~930s of catalog loading). The iteration-2 fix cut lookback_days 365 -> 75, which the author's own rationale states leaves '~11 weekly opens / ~22 legs' and concedes 'this strategy can only be offered ~11 weekly calendars per run and its trade sample will be small by construction - that is a harness constraint.' The sandbox confirms the consequence directly: total_trades=4, data_days=2, metrics_reliable=false (sharpe_note: 'Unreliable: only 2 daily returns'), sharpe/sortino/PSR/CI all null. A weekly calendar capped at ~11 opens and gated on backwardation will fire on a single-digit number of cycles; per accumulated learning L26 any options strategy whose expiry cadence + IV gating implies < ~30 trades over the span must be rejected at Layer 4 before it burns backtest/optimization/timeout iterations. The trade-off here is inescapable and admitted: the ONLY way to widen the sample re-triggers the Layer-3 SIGKILL. A calendar-spread term-structure edge is exactly the kind that needs many cycles across contango/backwardation regimes to measure; 4 trades over 2 days cannot distinguish edge from noise. - THE HYPOTHESIS'S CENTRAL SAFETY CLAIM ('Max loss is capped at the net debit paid, cannot be liquidated', ~2% of equity per trade) IS NOT WHAT THE CODE ENFORCES. _sized_contracts takes min(debit-based size, notional cap) where max_notional_frac=1.0, so a full-equity-notional options position is permitted; the sandbox shows avg_position_pct=100.99% and largest_loss=-$3123.98 on an avg_loss of -$1720 -- far more than the stated ~2%-of-equity defined risk. The 'max loss = debit' property only holds if held to FRONT expiry, but the code closes 24h BEFORE front expiry and has NO stop-loss (should_exit returns False; the docstring says 'No stop-loss is needed - the debit already caps the loss'). A calendar is long-vega: an interim IV collapse marks the back leg down faster than the front, producing mark-to-market losses that exceed the debit while the position is still open -- which is what the -$3123 loss and the -60% total_return / 32% max_drawdown on just 4 trades reflect. So the code neither caps per-trade loss at ~risk_frac nor guarantees the 'cannot be liquidated' property in the realized backtest. - The default min_backwardation was lowered from 0.01 to 0.0 in iteration 2, which dilutes the hypothesis's stated gate of 'meaningful backwardation'. At 0.0 the entry condition is merely front_iv >= back_iv (any inversion, however slight), not the 'near-week IV spikes RICH above later-term IV' the edge is described around. The rationale justifies this as needed to keep entry probability high enough for the shortened 75-day window to produce trades -- i.e. the measurability ceiling is forcing a weaker gate, compounding issue #1. The parameter remains optimizer-tunable, so this is a warning, but note the delivered default does not implement 'meaningful' backwardation.

Iteration History

BtcDeribitAtmCalendarTermStructureBackwardation

Iteration History

Verification failed (Layer 3 — sandbox backtest): No trades produced Bar type used: BTC-PERPETUAL.DERIBIT-1-DAY-LAST-EXTERNAL, Bars processed: 2400 Diagnostics: calculate_signal() was never evaluated (0 evaluated bars) -> no primary bar reached the base template's signal path -> if you override on_bar(), call super().on_bar(bar); check bar_type matches the instrument's data. Do NOT loosen entry thresholds — the entry logic never ran. Ensure your strategy produces trades with the given data and parameters.

Iteration History

BtcDeribitWeeklyDeltaNeutralShortStrangleVrp

Iteration History

Verification failed (Layer 4 — QA review) [class=hypothesis_mismatch]: - [edge_concern] Secondary/advisory (the block is the mismatch): even as the short strangle it actually is, the sandbox shows the L72 defined-risk premium-selling signature — Sharpe 2.64 / win_rate 0.96 / PF 2.57 headline but avg_trade_return_pct -78.6% (measured against strike notional, not premium), with the single loss (-$1,111) ~9x the average win ($114, skew -2.83). Per-notional-negative and fee/vega-nonviable, and ~12 cycles can't sample the short-vol tail. Moot until the code is replaced with the specified calendar spread. - WHOLE-STRATEGY MISMATCH. Hypothesis = BTC Deribit ATM CALENDAR SPREAD (long-vega/positive-theta: SELL front-weekly ATM, BUY next-monthly ATM same strike, entered only in IV term-structure backwardation). Code = SHORT STRANGLE (class BtcDeribitWeeklyDeltaNeutralShortStrangleVrp; config legs C +0.06 SELL / P -0.06 SELL on ONE weekly expiry, no back-month leg) — short-vega VRP-level harvest, exactly the short-premium vertical the hypothesis says it must be distinct from. Different structure, opposite vega sign, mis-linked file. Replace entirely with a two-expiry ATM calendar spread. - Core edge absent. The traded gate is a VRP LEVEL gate (DVOL IV >= RV*ratio), a single-tenor comparison. The hypothesis's edge is term-structure SHAPE (near-week IV vs later-term IV backwardation) — there is no back-month IV series and no near-vs-far comparison anywhere. The specific mechanic the hypothesis names is not implemented.
Strategy report

Backtest and paper results are hypothetical. Trading involves risk of loss.