Skip to content
All strategies

Strategies

FMZ digest: 多交易所现货价差套利策略逻辑分享

Outcome: Abandoned

BtcCrossVenueDislocationArbBinanceHl15m

FMZ digest: 多交易所现货价差套利策略逻辑分享

Hypothesis

Iteration 3. The iteration-2 output was a placeholder string, not code, which caused the Layer-1 syntax error. This restores the iteration-2 code. The underlying Layer-3 sandbox_timeout was not caused by per-bar strategy work: the per-bar logic is O(1). Measured locally, a strategy that does nothing on BTCUSDT.BINANCE 5m + HL 5m takes 166s of the 300s budget (data loading and the engine), and the real strategy took 191s. Changing ONLY the bar type (on both legs) to 15m cuts the no-op run to 100s. The real strategy then takes 95s and produces 38 fills over ~6 months. basis_window was rescaled 288->96 and max_hold_bars 12->4 so both cover the same clock time as before (1 day and 1 hour). Caveat: a bar-close proxy cannot capture the article's sub-second order-book arbitrage; it only captures the dislocations that persist to a 15m close.

verification_loop: sandbox_timeout: Verification failed (Layer 3 — sandbox backtest): smoke test exceeded the 300s wall-clock limit on a ~20000-bar window (208 days of BTCUSDT.BINANCE-15-MINUTE-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).

Implementation

Cross-venue BTC dislocation arb (FMZ digest 9470, @cqz): compares Binance USD-M and Hyperliquid BTC perp closes on 15m bars. Its trigger is the de-meaned basis (the basis minus its rolling 1-day mean). When that deviation exceeds the full 4-fill taker cost plus a margin, it sells the rich venue and buys the cheap one at equal USD notional (50% of equity per leg). It exits on convergence, after 4 bars, or on a 1% pair stop.

Verification Results

sandbox_timeout: Verification failed (Layer 3 — sandbox backtest): smoke test exceeded the 300s wall-clock limit on a ~20000-bar window (208 days of BTCUSDT.BINANCE-15-MINUTE-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).

Iteration History

sandbox_timeout: Verification failed (Layer 3 — sandbox backtest): smoke test exceeded the 300s wall-clock limit on a ~20000-bar window (69 days of BTCUSDT.BINANCE-5-MINUTE-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).

Verification failed (Layer 1 — static analysis): - Syntax error: invalid decimal literal (<unknown>, line 1) (line 1)

Analysis

多交易所现货价差套利策略逻辑分享

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