Skip to content
All strategies

Strategies

Hyperliquid LTC–BCH Kalman Spread Reversion with Explicit Trade Polarity

Outcome: Abandoned

HyperliquidLtcBchKalmanSpreadReversion

Outcome Summary

The hypothesis tested whether short-lived deviations in the LTC/BCH log-price spread on Hyperliquid revert profitably over 1–5 days, using a Kalman/AR(1) state model, explicitly defined trade direction and a cost-aware forecast filter for entries. The code never cleared Layer 3 verification because the sandbox backtest kept going over the 300s limit. In iterations 2 and 3 the developer left the trading rules unchanged and noted that timed replays showed the time going to catalog directory scans under heavy host I/O pressure, with a no-logic baseline strategy no faster. After 3 iterations the run was abandoned as a verification loop, before any backtest metrics, optimization or analyst review existed.

Hypothesis

Test whether temporary deviations of the LTC/BCH log-price ratio from a latent mean-reverting state predict economically meaningful convergence over 1–5 days. Use synchronized 4-HOUR bars and equal-dollar opposing perpetual positions. Adapt the source's state-space mechanism while explicitly defining spread polarity: a high LTC-minus-BCH spread means short LTC and long BCH. A prediction error alone is insufficient; entry also requires forecast convergence large enough to pay execution costs. No source performance claim is accepted as evidence.

Preserves the user's Kalman-filter pairs mechanism while addressing its central sign ambiguity. Hyperliquid is underrepresented at 7.6% versus a 20% target, and opposing two-leg execution addresses the 83.2% long-only concentration. LTC and BCH avoid BTC and the failed AAVE–UNI framing. Unlike same-asset cross-exchange arbitrage, this tests multi-day cross-asset relative mispricing rather than tiny venue discrepancies. Corpus concentration was empty, so instrument-level novelty cannot be confirmed. Cross-venue scope is not forced because additional venues do not strengthen this mechanism.

verification_loop: sandbox_timeout: Verification failed (Layer 3 — sandbox backtest): smoke test exceeded the 300s wall-clock limit on a ~20000-bar window (2400 days of LTCUSD.HYPERLIQUID-4-HOUR-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

Kalman-filtered AR(1) latent state on the LTC/BCH log-price ratio (4H, Hyperliquid perps). When the standardized innovation exceeds entry_z and the 30-bar forecast converges toward the fitted mean by more than min_projected_gross_pct and round-trip fees: high spread means short LTC / long BCH, low spread means long LTC / short BCH, at equal dollars. Exits on a cross of the entry mean, max_holding_bars, a 2% net stop on gross, or model invalidation (half-life outside 6-30 bars). Refit every 6 bars on an epoch-anchored grid using previous closes only.

Iteration 3, Layer-3 sandbox_timeout. The trading rules are unchanged; only the docstring is updated with the timing evidence. Timed replays on the real sandbox window show the timeout is not strategy work: this strategy ran in 254s wall (118s CPU), and a trivial do-nothing FactoryStrategy on the same two legs and window took 430s wall (129s CPU). Most wall time is catalog I/O on a loaded host. On lesson L155's choices, (a) config/legs match the hypothesis, (b) data exists for both legs, and (c) per-bar cost is O(1) plus a bounded refit every 6 bars, independent of the span. No code change can bring the engine baseline under 300s, so this needs engineering review of sandbox I/O and capacity, or a retry on a quieter host. The local replay finished with 52 trades: Sharpe -0.18, PF 0.92, avg_trade_return_pct 0.32. That trade count is below the pre-registered 120, which the analyst should weigh once a backtest completes.

Verification Results

sandbox_timeout: Verification failed (Layer 3 — sandbox backtest): smoke test exceeded the 300s wall-clock limit on a ~20000-bar window (2400 days of LTCUSD.HYPERLIQUID-4-HOUR-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 developer's own timed replays found that a trivial strategy with no logic took about as long (430s wall) as this one (254s wall), which points to catalog I/O on a loaded host rather than strategy code; repeated sandbox timeouts like this should be escalated as an infrastructure problem instead of consuming code iterations.

After 3 iterations the strategy was abandoned in a verification loop. Each time, the Layer 3 sandbox smoke test went over its 300s wall-clock limit on the ~20,000-bar (2400-day) LTCUSD.HYPERLIQUID 4-hour window. Backtest review, analyst and risk stages were never reached.

Equal-dollar LTC/BCH perpetual pair trade on Hyperliquid 4-hour bars that models the LTC-minus-BCH log-price spread as a latent mean-reverting (AR(1)/Kalman) state, shorting LTC and buying BCH when the spread is rich (and the reverse when it is cheap), and entering only when the forecast convergence over 1–5 days is large enough to cover execution costs.

No performance figures exist: the backtest report is empty and optimization never ran, so there is no return, Sharpe or trade count to report.

Analysis

Why long a position when the acutal price is higher than the predicted price? (Kalman filter for pairs trading)

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