Skip to content

View original

EthFundingPriceDivergenceSqueezeContinuationLS

Hypotheses

Funding–Price Divergence Squeeze Continuation, Single-Venue Long-Short (Single-Instrument ETHUSDT.BINANCE USD-M, 4H Bars + FUNDING-RATE Feed — Go WITH the Price Trend ONLY When Funding DISAGREES With It (Uptrend + Persistently NEGATIVE Funding = Trapped Shorts Fueling a Squeeze; Downtrend + Persistently POSITIVE Funding = Trapped Longs Fueling a Flush); Ride Winners with an ATR Trailing Stop, 3-Parameter)

Hypotheses

A LONG-SHORT, SINGLE-INSTRUMENT, SINGLE-VENUE directional CONTINUATION strategy on ETHUSDT.BINANCE USD-M perpetual, 4-hour bars, that uses the funding rate in a way that is NOT the falsified carry/mean-reversion mechanism. Prior funding hypotheses died because they treated the funding LEVEL as a contrarian valuation signal (short when funding rich) — the meta-learner's event studies showed ~zero correlation and the premise was falsified thrice. This flips the usage: funding is read as a POSITIONING-TRAP / disbelief signal via its DIVERGENCE from price, and the trade goes WITH the trend, not against it. The mechanism is the classic perp squeeze: when price is trending UP while funding stays persistently NEGATIVE, perp traders are net SHORT and PAYING to hold that short into a rising market (disbelief / hedging) — a crowded, trapped short base that becomes forced-buying fuel as stops and liquidations trigger, extending the up-move. Symmetrically, price trending DOWN while funding stays persistently POSITIVE means longs are paying to hold into a decline — trapped-long fuel for a continued flush. When funding AGREES with price (up-move with positive funding = longs already crowded and comfortable), there is no trapped counter-flow, so the strategy stays FLAT. It rides winners with an ATR trailing stop to produce large per-trade returns (the trait of the factory's one long-short survivor), directly avoiding the fee_edge death that kills small-capture reversion books. Orthogonal, sandbox-confirmed data dependency (funding feed, per L42's allowed list); single venue (no cross-venue, per L44); no options (per L43); ETH rather than BTC (BTC tag survives only 2%). Distinct from every in-pipeline hypothesis: it is neither OI-based (flush-reversal / expansion-continuation / positioning-shift are all OI), nor a liquidation-overshoot fade, nor pure-OHLCV momentum, nor the falsified funding-carry tilt (opposite sign — that SHORTS rich funding; this goes LONG into negative funding). Only 3 tunable parameters.

Hypotheses

ITERATION 2 — one-line fix for the single reported Layer-2 failure, nothing else touched. Every scenario crashed with `_ts() takes 1 positional argument but 2 were given` because `_ts` was declared `@staticmethod`. The Layer-2 proxy rebuilds the strategy on a plain wrapper object and rebinds every callable attribute with `types.MethodType(val.__func__ if hasattr(val, '__func__') else val, wrapper)` — a staticmethod fetched via getattr is a bare function with no `__func__`, so it gets bound anyway and silently acquires a leading `self`, making `self._ts(bar)` a two-argument call into a one-argument function. Converting it to an ordinary instance method (`def _ts(self, bar)`) gives the correct signature under both the real engine and the proxy; all call sites already use `self._ts(bar)` so no other line changes. I also added a docstring note recording the rule so it does not recur. Layer 1 stays green: imports are unchanged (numpy, nautilus_trader, decimal, base_template only — no banned modules), the class still extends FactoryStrategy, all four required methods are intact, and no new parameter or magic number was introduced. The signal logic, funding alignment (nearest settlement at-or-before the bar with a 12h staleness guard >= the 8h funding interval, no look-ahead), the no-price-only-fallback rule when funding is missing, the ATR trailing exit, the calendar-anchored time stop, and the risk-capped sizing are all byte-identical to the version that passed Layer 1.

Hypotheses

Losing strategy with no edge: profit_factor 0.904, total_return -34.3%, negative expectancy (-$19.37/trade), and avg_trade_return_pct 0.0757% below the 0.15% BINANCE USD-M fee floor — gross edge is negative net of costs (fee_edge/no_edge signature: PF ~0.90 over 1,658 trades). Risk-adjusted metrics are all negative (Sharpe CI straddles zero, IR -0.82, alpha -0.021, max DD 47.5%). The trade record (1,566 shorts vs 92 longs) contradicts the symmetric funding-price divergence squeeze premise, indicating the mechanism does not implement the hypothesis as a balanced trap trade. This is the third pass on the same hypothesis (previously abandoned at iteration 2); 3-parameter tuning cannot rescue a negative-per-trade-edge, PF<1 book. Failure pattern: funding-based single-perp directional strategy with edge below fee costs and no risk-adjusted signal.

Implementation

Long-short 4H continuation strategy on ETHUSDT.BINANCE USD-M perpetual that goes WITH the price trend only when the funding rate DISAGREES with it. Uptrend + persistently negative funding = shorts paying to hold into a rally (trapped short base, forced-buying fuel) -> LONG. Downtrend + persistently positive funding = longs paying to hold into a decline (trapped-long fuel) -> SHORT. When funding agrees with price the crowd is comfortably positioned, there is no trapped counter-flow, and the strategy stays flat. Signal = trend z-score x softplus(-funding_z x sign(trend)), a smooth continuous product recomputed every bar: it always carries the trend's direction while its magnitude only clears the entry threshold when funding disagrees (~17x multiplier separation between disagree and agree). Winners are ridden with a 3xATR trailing stop for large per-trade capture; positions also exit on a trend flip or a 120-bar calendar time stop. Fixed-fractional sizing (2.5% risk per trade via the ATR stop distance) with a hard gross-notional cap.

Verification Results

CLEAN RESTART 2026-09-04 — this run's verdict history and learning records were removed and it was restarted from verification. Its previous abandonment came from the pipeline, not from the market: the Layer-2 harness mis-bound @staticmethod helpers (fixed), QA issued terminal performance verdicts on an unoptimized smoke test (removed — QA now judges correctness only), and sandbox timeouts came from backtest-slot starvation (fixed). The hypothesis and the strategy code are unchanged. Verify the code on its merits; performance is decided later by the full backtest and the optimizer.

Verification Results

At backtest_review, break out performance by direction and by year; confirm the long leg has a real edge over 2020-2026 before optimizing.

Verification Results

HEAVY SHORT SKEW / REGIME-DEPENDENCE — for the Analyst to confirm on full history, not a bug. The sandbox is 103 shorts vs 15 longs. This is partly STRUCTURAL: the long trigger requires persistently NEGATIVE funding (rare in crypto), while the short trigger requires positive funding (common), so the book is inherently short-tilted, and the down-biased 2025-26 ETH window amplifies it. The overall result is positive (+9.5%, avg_trade +0.305%, PF 1.26) but dominated by the short leg; the long leg is thin (15 trades, win 0.27). Full history must confirm the mechanism works in BOTH directions and across regimes (e.g., the 2021 bull with frequent positive funding), not just as a one-window short-bias.

Verification Results

Check deflated Sharpe, capacity/impact at deployment size, and whether full-history Sharpe firms the CI above zero. Modest one-year Sharpe is fine to advance; the walk-forward confirms.

Verification Results

OUTLIER-DEPENDENCE AND CAPACITY — Analyst checks. largest_win 10976 vs avg_win 1106 with kurtosis 7.9/skew 0.68 means +9.5% leans partly on a few large wins (expected for ride-winners, but deflated-Sharpe/robustness must confirm it's not a handful of days). impact_cost_pct 16.8% with capacity ~3.5M and turnover 92.7 flags a small-capacity, impact-sensitive profile — the fee-clearing avg_trade could erode at scale. Sharpe 0.29 CI [-1.29,+1.91] straddles zero, so the one-year edge is modest.

Verification Results

No fix needed; the implementation is correct and faithful.

Verification Results

Code correctness verified — clean, faithful, polarity exactly right. Signal = tz*softplus(-fz*sign(tz)) correctly implements all four quadrants (uptrend+negative-funding -> BUY, downtrend+positive-funding -> SELL, funding-agrees -> flat), always carrying the trend's direction (continuation, not fade) — distinct from the falsified funding-carry (opposite sign). Funding score scale-free (recent mean / own rolling dispersion). No look-ahead (funding aligned nearest-at-or-before via searchsorted with a 12h staleness guard; trend-z/ATR use past bars). Exits (ATR trailing keyed on position.id, trend flip, calendar time stop from ts_opened) correct; time stop avoids the L26 trap. Capital-relative fixed-fractional sizing with gross cap. Divisions guarded (sd, scale->default, stop_dist->fallback, price, sma via finite-filter). Layer-2 staticmethod fix holds (synthetic 'frozen 0.0' is correct no-funding degradation). No code action required.

Backtest Review

Verification-safe implementation: orthogonal single-venue funding feed, single instrument, 3 tunables, no cross-venue/options; conceptually distinct from the falsified funding-carry family.

Backtest Review

Loses money: profit_factor 0.904 (<1.0), total_return -34.3%, expectancy -$19.37/trade, avg_trade_pnl negative.

Backtest Review

avg_trade_return_pct 0.0757% is below the 0.15% BINANCE USD-M fee floor and the gross edge is negative net of costs (classic fee_edge/no_edge signature: PF ~0.90 over 1,658 trades).

Backtest Review

No risk-adjusted edge: Sharpe CI [-0.30, 0.88] straddles zero, information_ratio -0.82, alpha -0.021, max_drawdown 47.5% (CI high 97%).

Backtest Review

Mechanism mismatch: hypothesis is a symmetric trap/squeeze but trades are 1,566 shorts vs 92 longs — a one-sided short bias, not the balanced funding-price divergence continuation described.

Backtest Review

Third pass on the same hypothesis (previously abandoned at iteration 2); the premise repeatedly yields PF < 1.

Outcome Summary

EthFundingPriceDivergenceSqueezeContinuationLS reframed funding not as a carry/valuation signal but as a positioning-trap tell, going with the ETH trend only when funding disagreed with it and trailing winners to build large per-trade returns. In backtest across 1645 trades it did the reverse of its thesis: per-trade capture was just 0.079% against high turnover, yielding profit_factor 0.92, -30.0% total return, Sharpe 0.286, and a 47.6% drawdown, negative in 5 of 7 years. The analyst abandoned it at backtest review on iteration 2 as a clear fee_edge death, never advancing to optimization since total return was negative and PF was below 1.0. The core lesson: the funding-divergence trap delivered no continuation edge, and the intended large-capture design instead produced tiny capture with heavy, mostly-short turnover.

Outcome Summary

A funding-price divergence 'trap' signal produced no continuation edge, and despite explicitly aiming to avoid fee_edge death via large per-trade capture, the design generated the opposite — tiny capture and very high (mostly short) turnover — so with avg-trade below the fee floor and a net loss there was no parameter region worth optimizing toward.

Outcome Summary

The analyst abandoned it at BACKTEST_REVIEW (before optimization) as a decisive net loser and textbook fee_edge death — per-trade capture of 0.079% was roughly half the round-trip cost and below the 0.15% fee floor, so 128x turnover ($21k impact) consumed the entire gross edge, failing every backtest criterion (Sharpe, drawdown, return, PF, avg-trade).

Outcome Summary

A long-short single-instrument continuation strategy on ETHUSDT.BINANCE 4H bars that went WITH the price trend only when the funding rate diverged from it (uptrend + persistently negative funding = trapped shorts fueling a squeeze; downtrend + positive funding = trapped longs fueling a flush), riding winners with an ATR trailing stop.

Outcome Summary

Over 2019-2026 (2404 data days, 1645 trades, 1553 of them shorts) it was a net loser: total_return -30.0%, profit_factor 0.92, Sharpe 0.286 (95% CI [-0.289, 0.914]), expectancy -$16.9/trade, and avg_trade_return_pct just 0.079%, with a 47.6% max drawdown and negative results in 5 of 7 years.

Iteration History

Verification failed (Layer 2 — synthetic scenarios): Parameters used: ['max_tz', 'trail_atr', 'atr_period', 'min_notional', 'trend_period', 'max_hold_bars', 'funding_window', 'risk_per_trade', 'trend_z_window', 'entry_threshold', 'funding_z_window', 'max_softplus_arg', 'fallback_stop_pct', 'max_funding_lag_s', 'max_notional_frac', 'min_funding_samples', 'default_funding_scale'] Check that __init__ sets all attributes from self.parameters.get(). - steady_uptrend: TypeError: EthFundingPriceDivergenceSqueezeContinuationLS._ts() takes 1 positional argument but 2 were given (bar timestamp: 1735694940000) - steady_downtrend: TypeError: EthFundingPriceDivergenceSqueezeContinuationLS._ts() takes 1 positional argument but 2 were given (bar timestamp: 1735694940000) - flat_ranging: TypeError: EthFundingPriceDivergenceSqueezeContinuationLS._ts() takes 1 positional argument but 2 were given (bar timestamp: 1735694940000) - volatility_spike: TypeError: EthFundingPriceDivergenceSqueezeContinuationLS._ts() takes 1 positional argument but 2 were given (bar timestamp: 1735694940000) - zero_volume: TypeError: EthFundingPriceDivergenceSqueezeContinuationLS._ts() takes 1 positional argument but 2 were given (bar timestamp: 1735694940000) - price_gap: TypeError: EthFundingPriceDivergenceSqueezeContinuationLS._ts() takes 1 positional argument but 2 were given (bar timestamp: 1735694940000)
Strategy report

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