Skip to content

View original

BtcCoinMOpenInterestConfirmedTsMomLS

Hypotheses

COIN-M BTC Open-Interest-Confirmed Time-Series Momentum, Long-Short (BTCUSD_PERP.BINANCE_CM Inverse Perp, Daily Bars, Trade the Sign of ~50-Day Trailing Return ONLY When Rising Open Interest Confirms New Positioning, ATR-Trailing Exit, Vol-Scaled Size, 3-Parameter)

Hypotheses

A LONG-SHORT, single-instrument, directional trend follower on the BTC-margined COIN-M inverse perpetual (BTCUSD_PERP.BINANCE_CM). This is NOT another Binance USD-M clone and NOT a beta-neutral/pairs reformulation (L95/L96) — it is the ONE mechanism family that survives this factory (outright directional momentum on a deep-liquidity major) deliberately routed to the lowest-fee crypto venue (COIN-M ~0.06% RT vs USD-M ~0.10%) to buy fee headroom, and given a structural confirmation signal (open interest) that recently advanced on USD-M (DogeOpenInterestConfirmedTrendContinuationLS, SolPriceOpenInterestQuadrantTrendLS). The primary signal is the SIGN of the ~50-day trailing return on daily bars. The trade is only TAKEN when open interest is RISING over the confirmation window — i.e. new money/positioning is entering as price trends, which distinguishes a genuine trend from a low-conviction drift or a short-covering pop. When OI is FLAT or FALLING while price trends, the trend is being driven by position unwind (exhaustion) rather than fresh conviction, and the strategy stands flat. Positions are volatility-scaled (target constant risk via ATR) and protected by a Chandelier/ATR-trailing stop. Exactly 3 tunable parameters (momentum lookback, OI-confirmation lookback, ATR-stop multiple) to resist the overfit graveyard (380 deaths). COIN-M inverse means PnL is BTC-denominated — a genuine BTC-specific edge for holders who want to compound a trend-following overlay in BTC terms, which is why BTC (over-mined on USD-M) is the RIGHT and defensible instrument on this specific, under-mined venue.

Hypotheses

Iteration 2 fixes the reported Layer-3 sandbox_timeout with the smallest possible change: the open-interest SOURCE, nothing else. The prior version quoted the raw primary-symbol supplementary feed that carries the COIN-M contract's OI mirror; quoting that key makes the engine load and JSON round-trip ~513k five-minute row-dicts (15 MB parquet), which by itself exhausted the 300s wall clock before bars were processed (src/backtesting/supp_collector.py documents exactly this failure). It now reads 'open_interest_by_instrument' - the engine's compact per-leg map, already downsampled to >=1 print/hour and, since 2026-09-10, populated for BINANCE_CM inverse contracts from the same mirror. Measured locally: 42,763 points covering 2021-07..2026-09, 10s to build, 1.4 MB JSON. The row-list 'open_interest' feed remains the fallback and is the shape the synthetic layer supplies, so Layer 2 still gets a real OI series. Per-bar cost is unchanged and O(1) amortised (forward-only pointer walk over the pre-sorted array, deques with maxlen, incremental ATR) - no rescanning, no sorting, no min() in on_bar. Signal logic, entry/exit rules, inverse contract sizing, imports and class structure are byte-for-byte unchanged from previous_code except the loader, so the passing Layer 1/1.5/2 checks are preserved. Leverage 2.0 is genuinely consumed in position_size (budget = equity * leverage), with the gross cap at 0.5 of budget = 1.0x equity notional.

Hypotheses

Overfit single-name OHLCV/OI-gated directional trend follower. Walk-forward IS 1.95 -> OOS -0.797 (is_overfitted=TRUE), two of three OOS windows negative — the edge reverses on unseen data. Confirmed quantitatively by failed deflated Sharpe: DSR=0.0003, expected-max=1.97 over 225 trials — the selected Sharpe is indistinguishable from best-of-N noise (is_significant=false, does not survive programme FDR, keeps 4 of 277). All three tunable parameters are cliff parameters, so there is NO robust region to iterate toward — the sweep is uniformly noisy, not merely mistuned. This is not a fee problem (per-trade 0.84% clears the COIN-M floor and PF is 1.67) — the apparent full-period edge is an artifact of selecting the best of 225 correlated trials, carried entirely by the single normal-vol regime and one +17.6% day. The OI-confirmation gate and the COIN-M venue reroute added no robustness the 3-phase deflation could not strip. This matches the persistent single-perp OI/supplementary-gated directional family and, at similarity 0.836, the near-identical prior COIN-M BTC OI-confirmed directional strategy already abandoned (plus OI-confirmed positioning-shift swing -> code_defect, Donchian CM -> fee_edge, ETH CM TSMOM -> overfit). Overfit -> abandon rather than iterate: reframing the same momentum-plus-OI mechanism onto another instrument tends to re-overfit rather than reveal a real edge, and the sweep leaves nothing to tune toward.

Implementation

Long-short daily time-series momentum on the BTC-margined COIN-M inverse perpetual (BTCUSD_PERP.BINANCE_CM). Direction is the sign of the ~50-day trailing return; a trade is only taken when open interest is RISING over the confirmation window (new positioning entering behind the move) and the strategy stands flat when OI is flat/falling (unwind-driven move) or when no OI reading is available. Exits on a momentum sign flip or an ATR chandelier trailing stop, with a stopped direction blocked until momentum flips. Size is volatility-scaled (constant risk per trade via ATR) with a hard gross-notional cap, expressed in WHOLE inverse contracts via contracts_for_notional(). Three searched parameters only.

Verification Results

Confirm the base template actually consults min_bars_required(); if not, rely on the internal readiness guards (which are already correct) and drop the override, or rename it to avoid the shadow warning.

Verification Results

min_bars_required(self) overrides/shadows a framework method the base template relies on for warm-up. If the base does not dispatch to this override, the intended max(mom_lookback, oi_lookback, atr_period)+2 warm-up is ignored (harmless — the strategy's own deque/counter guards independently prevent premature signals — but the override may be dead code).

Verification Results

This is a single-name directional daily-TSMOM variant, a family that has repeatedly died overfit/negative-expectancy at the analyst stage (LtcCoinMDailyTsMom, SolIntermediateSkipWindowTsmom, several DOGE/DOT/SOL trend clones). The sandbox smoke test is only mildly positive (Sharpe 0.35, CI [-0.38, 1.15] straddling zero, total_return +20% but the calm-vol tercile is -5.1% / Sharpe -0.28). The OI-confirmation gate and the COIN-M fee headroom are the genuine differentiators vs the abandoned USD-M siblings, so it deserves the full backtest, but the analyst should weigh the per-trade edge (~0.35% sandbox) against the well-populated graveyard of BTC/single-name TSMOM before optimizing. Advisory only.

Backtest Review

Mechanism functions and matches the hypothesis: 70 trades over 6.1y (31 long / 39 short), all signaled entries submitted (entry_diag 70->70, zero drops), a sensible cadence for a ~50-day daily TSMOM gated by a rising-OI veto.

Backtest Review

Numerically viable on a reliable sample: avg_trade_return_pct 0.19% (pct_notional) is above the COIN-M ~0.10% fee floor, PF 1.19, positive Sharpe 0.35, max DD 16.6% (< pre-registered cap), 70 trades, 6.1y span, metrics_reliable=true. Edge clears costs, so it is optimizable.

Backtest Review

Genuine differentiators vs the abandoned USD-M siblings: routed to the lower-fee COIN-M inverse venue for headroom, and an open-interest confirmation gate (a structural signal recently advancing on USD-M OI-confirmed trend variants). Only 3 tunable parameters, limiting the multiple-testing surface.

Backtest Review

Marginal significance: Sharpe CI [-0.45, 1.16] straddles zero, calm-vol tercile is negative (-5.1%, Sharpe -0.28), and this is the well-populated single-name daily-TSMOM family that has repeatedly died overfit/negative-expectancy in the 3-phase deflation (LtcCoinMDailyTsMom, SolIntermediateSkipWindowTsMom, several DOGE/DOT/SOL clones).

Backtest Review

end_unrealized_pct 15.2 of 20.3 total return means ~75% of the headline is open-position MTM, not realized — a promotion-stage caution to carry into ANALYZING (judge on realized/risk-adjusted metrics there).

Backtest Review

Per-trade edge is only marginally above the fee floor; the optimizer must find a genuinely robust region rather than curve-fit the OI/momentum lookbacks.

Analysis

Mechanism functions and matches the hypothesis: 78 optimized trades (38 long / 40 short) over 6.1y, all signaled entries submitted, sensible cadence for a rising-OI-gated ~50-day daily TSMOM.

Analysis

Per-trade edge clears costs: optimized avg_trade_return_pct 0.839% >> COIN-M 0.10% fee floor; profit_factor 1.67 > 1.3; commission only 5.3% of gross. Fees are NOT the killer here.

Analysis

Holdout window is nominally positive (Sharpe 1.35 on 10 trades).

Analysis

HARD gate failure: walk-forward is_overfitted=TRUE with IS 1.95 -> OOS -0.797, and two of three OOS windows are negative (-0.56, -2.96, +1.14). The edge REVERSES out-of-sample, it does not merely decay.

Analysis

HARD gate failure: avg out-of-sample Sharpe -0.797 <= 0 (validity floor 0.5).

Analysis

Failed deflated Sharpe: DSR=0.0003, expected-max=1.97 over 225 trials (126 effective) — the selected Sharpe is indistinguishable from best-of-N noise. PSR robust-block 0.906 < 0.95, is_significant=false, does not survive programme-level FDR (Benjamini-Hochberg q=0.10 keeps 4 of 277; candidate_p 0.9997).

Analysis

Sensitivity: ALL THREE tunable parameters (mom_lookback, oi_lookback, atr_stop_mult) are cliff parameters — the sharpe_grid swings from -0.67 to +0.83 across small neighboring lookbacks. There is no robust parameter region to iterate toward.

Analysis

Regime attribution: loses money in BOTH the calm (Sharpe -0.07) and stressed (Sharpe -0.22) thirds — all of the return comes from the single 'normal'-vol third (and one +17.6% day on 2024-12-20), i.e. the result is carried by one lucky window, not a persistent edge.

Analysis

Optimized max_drawdown 26.1% breaches the pre-registered 22% cap; Calmar 0.36 < 0.5.

Analysis

Pre-registered self-prediction missed 3 of 5 (min_trades 78<120, OOS -0.80<0.9, DD 26.1>22).

Analysis

Benjamini-Hochberg at q=0.10 over 277 programme candidates keeps 4. A candidate that does not survive here is not distinguishable from the programme's own noise, however good its individual statistics look.

Outcome Summary

BtcCoinMOpenInterestConfirmedTsMomLS-7a399ec08e

Outcome Summary

…full story as written to the file.

Outcome Summary

Re-routing a well-mined single-name momentum mechanism to a cheaper venue with an OI-confirmation gate buys fee headroom but adds no robustness — the edge still reverses out-of-sample.

Outcome Summary

Abandoned at post-optimization ANALYZING on hard-gate failures: walk-forward overfit (negative avg OOS Sharpe), deflated Sharpe indistinguishable from noise (fails programme FDR), and all three parameters on cliffs — no robust region to iterate toward.

Outcome Summary

A long-short daily time-series momentum trend follower on the BTC COIN-M inverse perpetual, trading the sign of the ~50-day trailing return only when rising open interest confirmed fresh positioning, with an ATR chandelier trailing stop and vol-scaled sizing, routed to the lower-fee COIN-M venue.

Outcome Summary

Initial backtest: 70 trades over 6.1y, avg per-trade 0.19% (above the ~0.10% fee floor), PF 1.19, Sharpe 0.35, 16.6% max DD. After optimization PF rose to 1.67 and per-trade to 0.84%, but walk-forward reversed from IS Sharpe 1.95 to OOS -0.797, DSR 0.0003 over 225 trials, and DD breached the 22% cap at 26.1%.

Iteration History

sandbox_timeout: Verification failed (Layer 3 — sandbox backtest): smoke test exceeded the 300s wall-clock limit on a ~20000-bar window (2400 days of BTCUSD_PERP.BINANCE_CM-1-DAY-LAST-EXTERNAL). 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).
Strategy report

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