Skip to content

View translation

BtcCmQuarterlyPerpBasisCarryNeutral

Hypotheses

BTC COIN-M Quarterly-vs-Perpetual Basis Carry: Long Perp + Short Quarterly When Annualized Basis >= 8% (Inverse-Margined Cash-and-Carry)

Hypotheses

Market-neutral calendar spread on Binance COIN-M (inverse) BTC contracts: long the BTCUSD_PERP perpetual and short the nearest BTCUSD_YYMMDD quarterly future when the annualized basis between them >= 8%. Both legs are BTC-margined (inverse contracts), so P&L is realized in BTC — making this a BTC-yield-enhancement trade for holders alongside a USD-neutral spread. The edge is mechanical: dated quarterly futures MUST converge to the underlying spot/perp price at expiry by contract specification, so a quarterly trading at a premium to the perp guarantees price compression as expiry approaches (basis = mark_quarterly / mark_perp - 1, annualized over days_to_expiry). This is fundamentally different from the failed ETH/BTC ratio mean-reversion: there, the 'ratio' between two distinct assets had no contractual force pulling it together and could trend indefinitely. Here, the basis between two contracts on the SAME asset has a hard contractual convergence point. Targets the most-underrepresented venue bucket (BINANCE_CM at 0.9% vs >=5% target) while also adding to long-short (12.4%), pairs scope (18.0%), and introducing a 'basis carry / cash-and-carry' mechanism class never tested in the portfolio. OHLCV-only — no supplementary data dependency, no classical TA patterns, no ratio reversion on distinct assets, simple 2-leg position.

Hypotheses

Implements the hypothesis's mechanism exactly - long perp / short dated quarterly, single venue, two legs, OHLCV only, annualized-basis trigger, contractual convergence rather than statistical reversion - and I chose the dated leg to satisfy the venue rule that a quarterly must be CURRENTLY LISTED: BTCUSD_260925 (expires 2026-09-25) is live, while BTCUSD_260626 in the catalog already expired and could neither be backtested on a current window nor go live. The quarterly is the PRIMARY/clock leg precisely because it is the shorter-lived contract, so every primary bar has a contemporaneous perp bar and the cross-leg alignment barrier can always be satisfied (the reverse choice would block on the perp's 2020-2026 history). Delta neutrality is structural, not arithmetic: identical $100 faces mean equal contract counts are equal notionals, which is the specific defect that has sunk previous market-neutral pairs. Two deliberate deviations I want on the record. First, the 8% annualized trigger cannot fire: I measured the real basis series in the catalog and the annualized basis on BTCUSD_260925 spans only 1.8%-3.6% (median 2.5%), and on the prior 260626 contract 0.1%-5.7% - 8% has ZERO occurrences, so a fixed 8% threshold would trade zero times. The default is therefore 2.8% (about the 80th percentile of what this contract actually offers) with the optimizer bound left open to 8% so the hypothesis's level remains reachable if a richer regime appears. Second, and more important for expectations: this mechanism is structurally low-frequency. Simulating the exact entry/exit logic on the real merged series gives 2 entries and 1 completed round trip over the 334 overlapping bars - one convergence per contract cycle is all the trade there is, so trade-count-sensitive statistics will be weak no matter how the thresholds are set. The economics are thin but real: entering near a 110bp premium and holding to within 2 days of settlement captures roughly 1.1% gross against about 0.20% of round-trip taker cost across the two legs. leverage stays 1.0 and each leg is 0.25x equity of notional, so total margin stays near half of equity and there is no liquidation path.

Hypotheses

backtest_failed: RuntimeError: Funding data unavailable for perp leg 'BTCUSD_260925.BINANCE_CM' — on-demand collection failed or the venue has no funding history (backtest blocked for accuracy; set SF_DISABLE_ONDEMAND_FUNDING=1 to bypass) Traceback (most recent call last): File "/opt/strategy-factory/src/agents/backtest_agent.py", line 194, in _run_backtest await self._ensure_funding_for_perp_legs(instrument_id, extra_instrs) File "/opt/strategy-factory/src/agents/backtest_agent.py", line 411, in _ensure_funding_for_perp_legs raise RuntimeError( RuntimeError: Funding data unavailable for perp leg 'BTCUSD_260925.BINANCE_CM' — on-demand collection failed or the venue has no funding history (backtest blocked for accuracy; set SF_DISABLE_ONDEMAND_FUNDING=1 to bypass)

Implementation

Market-neutral inverse cash-and-carry on Binance COIN-M BTC contracts (4-hour bars, OHLCV only). It prices the calendar basis between the currently-listed dated quarterly BTCUSD_260925 (expiry 2026-09-25) and the BTCUSD_PERP perpetual as basis = quarterly/perp - 1, annualized over days-to-expiry. When the annualized basis is rich (>= entry_ann) and expiry is more than 2 days away it SHORTS the quarterly and goes LONG the perp at an equal contract count - and because both COIN-M contracts carry the same fixed $100 USD face, equal contracts is exactly equal USD notional, so the pair is delta-neutral by construction with no residual directional exposure. The position is closed when the basis has normalised (annualized <= exit_ann) or within 2 days of settlement, and a half-open book (one leg filled, the other not) is flattened immediately. Both legs are BTC-margined, so PnL and fees realise in BTC - a BTC-denominated yield-enhancement profile. Both legs open and close on the same bar inside calculate_signal; the base class's single-leg path is deliberately inert because legging in one bar apart would carry naked BTC delta.

Verification Results

Verification failed (Layer 4 — QA review) [class=not_measurable]: - [edge_concern] Even aside from measurability, the developer's own replay shows a structurally low-frequency, thin edge: ~2 entries and 1 completed round trip over the contract's life, capturing ~1.1% gross against ~0.20% two-leg round-trip cost. The sandbox's Sharpe 2.85 / PF 2.0 / +4.6% is computed on 4 trades over a 72-day window (metrics_reliable=false) and cannot be trusted as an edge estimate. exposure_pct 285% is a two-leg inverse double-count artifact, not real directional risk. Advisory only — the blocker is data coverage. - NOT MEASURABLE — the edge is the quarterly's CONTRACTUAL convergence to the perp AT EXPIRY, but the tradeable window is bounded by the shorter-lived quarterly (the primary/clock). BTCUSD_260925.BINANCE_CM has 4H catalog data only 2026-03-27 -> 2026-06-07 (~72 days, 436 bars) while it settles 2026-09-25 — data ends ~110 days BEFORE expiry, so convergence-to-settlement is never observed. Sandbox produced 4 trades (~1-2 round trips); developer's replay gives ~2 entries / 1 completed round trip. A single truncated cycle (n=1) cannot validate a convergence edge or populate the 3-window walk-forward or the HARD >=10-trade holdout. The stated 8% trigger never occurs (observed 1.8-3.6%). - Hypothesis gate is annualized basis >= 8%, but entry_ann defaults to 2.8% because the measured basis spans only 1.8-3.6% (8% never occurs). Transparent, data-driven magnitude change with the structural gate preserved (bound open to 8%), not a mechanism swap — but the hypothesis's 8%-clears-fees premise is not what is tested; at 2.8% the edge is thin. - Delta neutrality is USD-NOTIONAL-based (equal contract count on equal $100 faces). For INVERSE contracts BTC delta is notional/price, so the two legs' BTC deltas differ by the basis (~2-3%) — a small residual directional exposure, not exactly zero. Second-order and acceptable for a convergence trade, but 'delta-neutral by construction' slightly overstates it.

Iteration History

RuntimeError: Funding data unavailable for perp leg 'BTCUSD_260925.BINANCE_CM' — on-demand collection failed or the venue has no funding history (backtest blocked for accuracy; set SF_DISABLE_ONDEMAND_FUNDING=1 to bypass) Traceback (most recent call last): File "/opt/strategy-factory/src/agents/backtest_agent.py", line 194, in _run_backtest await self._ensure_funding_for_perp_legs(instrument_id, extra_instrs) File "/opt/strategy-factory/src/agents/backtest_agent.py", line 411, in _ensure_funding_for_perp_legs raise RuntimeError( RuntimeError: Funding data unavailable for perp leg 'BTCUSD_260925.BINANCE_CM' — on-demand collection failed or the venue has no funding history (backtest blocked for accuracy; set SF_DISABLE_ONDEMAND_FUNDING=1 to bypass)

Abandon Reason

backtest_failed: RuntimeError: Funding data unavailable for perp leg 'BTCUSD_260925.BINANCE_CM' — on-demand collection failed or the venue has no funding history (backtest blocked for accuracy; set SF_DISABLE_ONDEMAND_FUNDING=1 to bypass) Traceback (most recent call last): File "/opt/strategy-factory/src/agents/backtest_agent.py", line 194, in _run_backtest await self._ensure_funding_for_perp_legs(instrument_id, extra_instrs) File "/opt/strategy-factory/src/agents/backtest_agent.py", line 411, in _ensure_funding_for_perp_legs raise RuntimeError( RuntimeError: Funding data unavailable for perp leg 'BTCUSD_260925.BINANCE_CM' — on-demand collection failed or the venue has no funding history (backtest blocked for accuracy; set SF_DISABLE_ONDEMAND_FUNDING=1 to bypass)
Strategy report

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