Skip to content

View translation

HyperliquidMajorsFundingExtremeContrarianReversionLS

Hypotheses

Hyperliquid Majors Funding-Extreme Contrarian Reversion, Long-Short (Multi-Instrument BTC/ETH/SOL Perps, Single-Venue, 1H Bars, Crowded-Positioning Fade with Price-Exhaustion Gate, Independent Per-Name Sizing, Low-Parameter)

Hypotheses

A LONG-SHORT, SINGLE-VENUE, MULTI-INSTRUMENT mean-reversion strategy on a small diversified basket of liquid Hyperliquid majors (BTCUSD, ETHUSD, SOLUSD) that fades EXTREME perpetual funding — used as a crowded-positioning proxy — only when 1H price action confirms exhaustion. Hyperliquid funds HOURLY, so funding moves to extremes faster and more cleanly than 8h venues. The core PnL source is the PRICE reversion of an over-leveraged/over-crowded perp move, NOT carry: funding is a SIGNAL ONLY (the funding/predicted-funding series, which HL provides), so this is immune to the funding-accrual/crediting and cross-venue fee-domination failure modes that killed every prior hedged funding-CARRY and cross-venue funding-SPREAD attempt — there is no second leg, no inter-venue basis, and no double round-trip. Each instrument is traded INDEPENDENTLY (its own entry/exit/sizing), deliberately NOT a single rotating position, to avoid the engine's single-position-multi-instrument rotation accounting bug flagged by the analyst. The basket (3 uncorrelated-shock majors) diversifies away the single-alt intraday news-gap fragility that wiped the XRP daily book. This is ORTHOGONAL to the factory's promoted trend/impulse/momentum siblings: it is contrarian, it triggers in any regime (crowding extremes occur in both bull and bear), and it produces frequent trades — which is exactly what makes it more statistically validatable than directional trend on Hyperliquid's short (~6mo) history, where trend strategies suffered recent-regime non-generalization.

Hypotheses

Iteration-5 fix for the Layer-3 wall-clock timeout ('per-bar work that scales with history'). Root cause: _compute_funding_z recomputed window.mean()/window.std() over up to funding_lookback funding observations on EVERY bar for EVERY leg (O(lookback) per bar per leg). The fix precomputes the ENTIRE rolling funding z-score series ONCE per leg in on_start using a vectorized cumsum pass (O(n) one-time), then the per-bar path is only an O(log n) searchsorted plus an O(1) array index -- exactly the 'precompute sorted arrays once, per-bar O(log n)' remedy the diagnostic requests. The rolling-z computation reproduces the original window semantics byte-for-byte (same array construction with no dedup so funding_lookback still counts entries; same population std; same min_funding_obs, lookback, and staleness guards), so the signal is unchanged and no earlier-passing layer regresses. Imports are untouched (Layer 1 clean); the entry/exit/sizing logic, the z memo, and the staticmethod-avoidance helper are all preserved (Layer 2 clean). funding_lookback is pinned to a bounded 168 in the config so even the one-time precompute stays cheap.

Hypotheses

Net-losing contrarian fade with no evidenced edge on the available data: Sharpe -1.995 (CI -4.02..+0.34), profit_factor 0.846, omega 0.674, negative expectancy (-$23.8/trade), total_return -8.82%, and probabilistic_sharpe 0.0345 (~0 chance true Sharpe is positive). It loses in nearly every month and 16.81% of gross is consumed by commissions from 1H fade churn. This is NOT a code bug (funding data loads, 87 entries fire correctly, sizing/exposure are sane at 48%), so iterate cannot help; and no threshold/RSI/stop tuning can flip a -2.0 Sharpe negative-expectancy fade with this fee drag into a promotable edge — optimization would only curve-fit the 181-day sample. Compounding this, Hyperliquid's ~6-month history is too short for walk-forward/holdout to validate anything, and this is the recurring HL short-history + contrarian-fade non-generalization failure family the hypothesis itself flagged. Optimizing would waste ~2 hours.

Implementation

Long-short, single-venue, multi-instrument (BTCUSD/ETHUSD/SOLUSD Hyperliquid perps, 1H bars) contrarian mean-reversion that fades EXTREME perpetual funding used as a crowded-positioning proxy, gated by a 1H RSI exhaustion confirm. Funding is a SIGNAL ONLY (funding z-score vs the leg's own trailing window); PnL is the price reversion of the over-crowded move, so there is no second leg, no basis, no carry accrual. Each instrument trades independently with its own entry/exit/sizing (a normal multi-position book). Positive funding extreme -> crowded longs -> fade short when RSI still elevated; negative funding extreme -> crowded shorts -> fade long when RSI still depressed. Exits on stop (4%), take-profit (3%), funding-z normalization (|z|<=0.5), or 48h max hold. Sized capital-relative with 2x leverage consumed in the notional.

Verification Results

Verification failed (Layer 3 — sandbox backtest): smoke test exceeded the 300s wall-clock limit. 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).

Backtest Review

Mechanism is correctly implemented: hl_funding_rates loads (3327 funding events), 87 primary entries signalled = submitted, extra sleeves trade — no zero-trade data bug and no rotation/leg-stacking artifact this time.

Backtest Review

Sane risk footprint: exposure_pct 48%, avg_position_pct 24.7%, max_drawdown only 13% — the book is genuinely diversified and near market-neutral (beta 0.047).

Backtest Review

Frequent trades (348) give a real read on the edge rather than a thin-sample fluke.

Backtest Review

Negative edge across the whole sample: Sharpe -1.995, Sortino -2.21, profit_factor 0.846, omega 0.674, expectancy -$23.8/trade, total_return -8.82%, cagr -13.6%.

Backtest Review

probabilistic_sharpe 0.0345 — essentially no chance the true Sharpe is positive.

Backtest Review

Loses in nearly every month (only the first partial month green); avg_win $276 < avg_loss $294.

Backtest Review

commission_pct_of_gross 16.81% — 1H frequent-fade churn is heavily fee-dragged; even a correct-polarity version faces this cost.

Backtest Review

Only 181 days of Hyperliquid history — too short for walk-forward/holdout to validate, and this is the recurring HL short-history + contrarian-fade non-generalization failure family.

Backtest Review

negative

Backtest Review

<1, losing

Backtest Review

negative expectancy

Backtest Review

~0 chance true Sharpe>0

Backtest Review

heavy fee drag on 1H fades

Analysis

Do NOT optimize yet — the current backtest does not implement the hypothesis, and it is a losing config (Sharpe -2.26, PF 0.83, -15%). Fix these before re-backtesting: 1. IMPLEMENT THE EXHAUSTION GATE (critical). rsi_ob=rsi_os=50.0 turns the '1H price-exhaustion confirm' — the central premise — into a no-op coin flip. Set genuine overbought/oversold thresholds so the fade only fires on price exhaustion, e.g. rsi_ob=68, rsi_os=32 (make these the defaults, not 50/50). This is the single most important change; the strategy currently fades funding extremes with essentially no price confirmation, which is why it gets run over. 2. VERIFY POLARITY EMPIRICALLY. With a real gate in place, spot-check whether HL 1H funding extremes actually REVERT or CONTINUE over the next 24-48h. The consistent losses (PF 0.83, every 2026 month red) are a warning that fading may be inverted — i.e. funding extremes continue (momentum) rather than revert. If a properly-gated fade still loses, the contrarian premise is wrong-signed and the next verdict will be abandon/revise_hypothesis. 3. BALANCE THE BOOK. 290 long vs 58 short means one polarity dominates; the 'diversified LS basket' isn't actually two-sided. Confirm the negative-funding (fade-long) and positive-funding (fade-short) triggers are symmetric and that the entry_z threshold is applied identically on both sides. 4. TIGHTEN ENTRY SELECTIVITY. entry_z=1.5 with a disabled gate admits too many marginal signals (17% of gross eaten by commission on 6mo). Consider a higher entry_z (2.0-2.5) so only genuine crowding extremes trade. Re-run the backtest after these fixes. Only escalate to optimization if the gated/polarity-verified version shows a genuine positive edge (Sharpe > 0.5, PF > 1.1).

Outcome Summary

This strategy was engineered to sidestep every prior funding-strategy failure — no second leg, no cross-venue basis, funding used as signal only, independent per-name sizing to dodge the rotation accounting bug — and it succeeded on all of those: the backtest ran with clean plumbing, 348 trades, sane risk, and near-zero beta. But stripped of implementation artifacts, the underlying contrarian fade simply had no edge: Sharpe -1.995, profit factor 0.846, negative expectancy, losing nearly every month, with 16.8% of gross eaten by 1H churn fees and a probabilistic Sharpe of 0.03. The analyst abandoned it at the backtest-review gate after 5 iterations, noting this was a real negative edge rather than a fixable bug and that Hyperliquid's ~181-day history was too short to validate anyway. It never reached optimization or a final analyst decision.

Outcome Summary

A cleanly implemented, well-diversified, near-market-neutral strategy can still have a genuinely negative edge — funding-extreme contrarian fades on Hyperliquid majors lost money net of heavy 1H churn fees, and a ~6-month history is too short to validate anything, so the recurring short-history contrarian-fade family should be avoided.

Outcome Summary

The backtest review returned 'abandon': this was not a code bug (unlike prior siblings) but a genuinely net-losing contrarian fade with ~0 chance of a positive true Sharpe, losing in nearly every month, and no threshold/RSI/stop tuning could flip a -2.0 Sharpe fee-dragged fade — compounded by Hyperliquid's ~181-day history being too short for walk-forward validation.

Outcome Summary

A long-short, single-venue multi-instrument mean-reversion on Hyperliquid majors (BTC/ETH/SOL 1H perps) that faded extreme perpetual funding as a crowded-positioning proxy — using funding as a signal only, not carry — gated by a price-exhaustion confirm, trading each name independently to capture the reversion of over-crowded moves.

Outcome Summary

This iteration finally ran cleanly — funding data loaded (3,327 events), 87 primary entries fired, sizing and exposure were sane (48% exposure, max drawdown 13%, near-zero beta 0.047) with a real 348-trade sample — but the edge was clearly negative: Sharpe -1.995, profit factor 0.846, expectancy -$23.8/trade, total return -8.82%, probabilistic Sharpe 0.0345, and commissions consumed 16.81% of gross from 1H fade churn.

Iteration History

Verification failed (Layer 2 — synthetic scenarios): Parameters used: ['exit_z', 'rsi_ob', 'rsi_os', 'entry_z', 'rsi_period', 'min_notional', 'stop_loss_pct', 'target_weight', 'max_hold_hours', 'min_funding_obs', 'take_profit_pct', 'funding_lookback', 'max_funding_lag_s'] Check that __init__ sets all attributes from self.parameters.get(). - steady_uptrend: TypeError: FactoryStrategy._bar_ts() takes 1 positional argument but 2 were given (bar timestamp: 1735690740000) - steady_downtrend: TypeError: FactoryStrategy._bar_ts() takes 1 positional argument but 2 were given (bar timestamp: 1735690740000) - flat_ranging: TypeError: FactoryStrategy._bar_ts() takes 1 positional argument but 2 were given (bar timestamp: 1735690740000) - volatility_spike: TypeError: FactoryStrategy._bar_ts() takes 1 positional argument but 2 were given (bar timestamp: 1735690740000) - zero_volume: TypeError: FactoryStrategy._bar_ts() takes 1 positional argument but 2 were given (bar timestamp: 1735690740000) - price_gap: TypeError: FactoryStrategy._bar_ts() takes 1 positional argument but 2 were given (bar timestamp: 1735690740000)
Strategy report

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