Strategies
Faithful port of QuantConnect BasePairsTradingAlphaModel: BTC/ETH price-ratio band reversion vs a 500-bar EMA of the ratio, ±1% bands, 1-day insight hold, alternating direction (OKX USDT swaps, DAILY)
Outcome: Abandoned
BtcEthOkxLeanPairsRatioBand
Outcome Summary
This strategy ported LEAN's pairs-trading alpha model onto the BTC/ETH ratio on OKX perpetual swaps: a 500-bar EMA with ±1% bands, one-day holds and alternating direction. The hypothesis's own pre-study found only 19 toggles in about 5.3 years and a mean per-trade spread return of about +0.11%, roughly the round-trip cost and statistically insignificant (t ≈ 0.3). After 2 iterations the run was abandoned at the coding stage because coding timed out three times ('coding_stuck_3_timeouts'), so it never reached verification or backtesting and has no measured performance.
Hypothesis
coding_stuck_3_timeouts
Implementation
Faithful port of QuantConnect LEAN's BasePairsTradingAlphaModel on BTCUSDT.OKX / ETHUSDT.OKX daily bars. The ratio is BTC/ETH. Its mean is a LEAN-style EMA(500), seeded with an SMA and ready after 500 bars, with bands at ±1% of the mean. The state machine alternates: it starts flat, never repeats the direction it is already in, and changes only when price crosses the opposite band. Ratio above the upper band means short BTC / long ETH; below the lower band means long BTC / short ETH. Each change opens a dollar-neutral pair (50% of equity per leg, leverage 1) that is held for one daily bar, matching the insight expiry under EqualWeighting. The book then stays flat until the next change.
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 BTCUSDT.OKX-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).
Outcome Summary
The pre-study already put the edge at about round-trip cost on only 19 trades (t ≈ 0.3), so this hypothesis was a weak candidate even before the coding timeouts; screening out edges this thin before coding would save pipeline capacity.
The run was abandoned at the coding stage with reason 'coding_stuck_3_timeouts' after 2 iterations. Verification, backtesting, analyst review and risk review were never reached.
A faithful port of QuantConnect LEAN's BasePairsTradingAlphaModel on the BTC/ETH OKX USDT-swap price ratio: when the daily ratio crosses a ±1% band around its 500-bar EMA, it enters a dollar-neutral pair trade (50% of equity per leg) betting on reversion, holds it for one daily bar, and only toggles direction when the opposite band is crossed.
No backtest or optimization results exist (the backtest report is empty). The only figures are from the hypothesis's own pre-study: 19 toggles in about 5.3 years, a mean next-day spread return of about +0.11% per trade (standard deviation about 1.5%, t ≈ 0.3), which is roughly equal to the round-trip cost.
Analysis
BasePairsTradingAlphaModel
Backtest and paper results are hypothetical. Trading involves risk of loss.