Skip to content

View original

BtcCrossVenueFundingSpreadCarryBinanceHlNeutral

Hypotheses

Cross-Venue Funding-Rate Spread Capture — Binance-vs-Hyperliquid BTC Perp Delta-Neutral Carry (Long Cheap-Funding Leg / Short Rich-Funding Leg, Threshold-Gated)

Hypotheses

A market-neutral, cross-venue carry strategy that captures the PERSISTENT FUNDING-RATE DIFFERENTIAL between the two BTC perpetuals on Binance USD-M and Hyperliquid. The two contracts both track BTC spot to within a few bps, but their funding rates are set by independent order flows and diverge regularly (different participant mixes, different funding mechanics — Binance 8h, Hyperliquid hourly). When venue A's funding meaningfully exceeds venue B's, you SHORT the perp on the rich-funding venue and go LONG the perp on the cheap- (or negative-) funding venue in equal notional, collecting the NET funding differential every period while holding ~zero net BTC delta. The position is held for as long as the spread persists (typically days), so the one-time round-trip taker cost on the two legs is amortized over many funding receipts. Deliberately SIMPLE: one entry threshold, one exit threshold, equal-notional legs, no per-asset optimization fan — the few-parameter design is a direct response to overfitting failures in the trend/reversal clusters. Single confirmed-liquid underlying (BTC) on both venues to avoid the alt-basket data-unavailability failures that killed recent cross-sectional/cointegration hypotheses.

Hypotheses

Iteration 4 fix for the Layer-3 300s wall-clock timeout. The funding lookups were ALREADY O(log n) (np.searchsorted on arrays precomputed in __init__), so the timeout was not from rescanning the series — it was bar-count x per-holding-bar overhead: unlike prior no-trade iterations, this strategy enters and holds positions across TWO venues, and every holding bar revalued both legs (get_account_equity + per-leg PnL) plus NautilusTrader's internal two-venue position revaluation, landing ~56k 1-HOUR bars right at the 300s wall. Two minimal, edge-preserving changes: (1) coarsen both legs from 1-HOUR to 4-HOUR — the signal is funding-based, not price-pattern-based, so this is ~4x fewer bars with identical carry logic and is fully consistent with the multi-day hold thesis; (2) throttle the expensive combined-PnL kill switch to every kill_check_every (=6) bars so per-holding-bar cost stays flat (cheap convergence/max-hold exits still fire every bar). Entry logic, the funding-differential signal, two-leg sizing, and all imports are unchanged, so Layers 1-2 stay green. max_hold_bars adjusted to 180 to preserve the ~30-day backstop intent on the new 4-HOUR timeframe.

Hypotheses

Fee-dominated cross-venue funding carry with a structurally negative net-of-fees result — not worth optimizing. IMPORTANT: this is NOT an uncreditable-funding rejection (funding IS credited) and NOT a hedge bug — the book is genuinely delta-neutral (annualized_volatility 1.18%, beta -0.0007). It is rejected on its CREDITED result: a relentless bleed (Sharpe -11.15, total_return -13.7%, profit_factor 0.865, expectancy -$66/trade) with every month of the 14-month sample negative. Root cause is the cross-venue fee floor: the two-venue round-trip taker cost (~0.10% Binance + ~0.09% HL ≈ 0.19%/trade) requires the funding gap to persist ~7 days at a 10% APR differential just to break even, but the spread mean-reverts and the position exits in ~1 day (avg_holding 1d 2h, exit_apr 0.03), so each trade collects ~0.027% of carry while paying ~0.19% in fees — fees are ~7x the carry, commission is 14% of gross, and gross is already ~breakeven. The hypothesis premise ('held for days, amortized over many receipts') does not hold. Threshold tuning cannot fix this: even at a wider entry the Binance-HL BTC funding gap rarely persists long enough to clear two-venue costs, and the entire sample bleeds. No code bug and no promoted sibling stranded on a dead target — the mechanism is fee-dominated at this horizon. FAILURE PATTERN: a Binance-vs-Hyperliquid BTC delta-neutral funding-differential carry is correctly delta-neutral but structurally fee-dominated — the ~0.19% two-venue round-trip requires the funding gap to persist ~7 days per 10% APR of edge, while the gap mean-reverts within ~1 day, producing a steady PF<1 bleed (every month negative) that entry/exit-threshold tuning cannot reverse.

Implementation

Delta-neutral cross-venue BTC funding-differential carry between BTCUSDT.BINANCE (USD-M, 8h funding, primary/signal leg) and BTCUSD.HYPERLIQUID (hourly funding, hedge leg). Each bar it computes the annualized funding differential diff = bn_rate*1095 - hl_rate*8760; when |diff| >= entry_apr it SHORTs the rich-funding venue and LONGs the cheap-funding venue in equal USD notional, collecting the net funding spread while holding ~zero BTC delta. Exits on spread convergence (|diff| <= exit_apr after a min hold), a max-hold cap, or a throttled combined-PnL kill switch. Runs on 4-HOUR bars; leverage=2 is wired into position_size via self.leverage.

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

Genuinely delta-neutral: annualized_volatility 1.18%, beta -0.0007, correlation -0.03 — the two-leg hedge is correctly constructed (no directional-leakage bug), and funding is credited so the carry is measured honestly

Backtest Review

Simple, few-parameter design; single confirmed-liquid underlying (BTC); ample funding data (7865 events) and 177 trades in the tradable window

Backtest Review

Relentless fee-dominated bleed: Sharpe -11.15, total_return -13.7%, profit_factor 0.865, expectancy -$66/trade, and EVERY month of the 14-month sample (2025-03 to 2026-05) negative

Backtest Review

Fee floor: two-venue round-trip cost ~0.19% vs ~0.027%/day of carry at a 10% APR entry — with avg holding only 1d 2h, fees are ~7x the carry captured; commission is 14% of gross and gross is ~breakeven (avg_win 908 ~ avg_loss 927)

Backtest Review

The hypothesis premise ('held for days, amortized over many receipts') fails: exit_apr 0.03 closes positions as the spread mean-reverts in ~1 day, so costs are never amortized

Backtest Review

This is the recurring cross-venue funding-carry fee-domination pattern; threshold tuning cannot manufacture a gap that persists long enough to clear two-venue costs

Analysis

The strategy correctly builds balanced delta-neutral legs but CHURNS: avg hold is 11h 38m while the hypothesis requires holding for days to amortize the ~0.10%/leg round-trip taker cost. Fees+impact are ~21% of gross and every daily return is negative — pure cost bleed, no carry captured. Fixes for the developer: (1) SMOOTH the funding differential before thresholding — you are comparing an instantaneous Binance 8h rate (x3x365) against an instantaneous HL hourly rate (x24x365); the x8760 annualization amplifies hourly noise so the diff whipsaws across the entry/exit bands. Use a rolling average of each venue's realized funding (e.g. last 8-24h) so the signal reflects a PERSISTENT differential, not a single noisy print. (2) Raise min_hold_bars substantially (e.g. 8-24 bars) and add hysteresis / widen the entry-exit gap so a position that opens on a genuine spread stays on long enough for accumulated funding receipts to exceed the entry cost. (3) Add an instrumentation check that funding is actually being collected on BOTH legs when correctly positioned — decompose PnL into funding-received vs price/fee so you can confirm the carry is positive before trusting the net. (4) Consider only entering when the differential's SIGN has been stable for N periods, not just its magnitude. Re-backtest and confirm avg_holding_period is measured in days and daily returns are no longer uniformly negative before requesting optimization.

Outcome Summary

This strategy sought the persistent funding differential between Binance and Hyperliquid BTC perpetuals, holding a delta-neutral two-leg carry to collect the net funding while amortizing entry costs over many receipts. The backtest confirmed the hedge was built correctly — near-zero volatility, beta, and correlation, with funding honestly credited — but the result was a relentless fee-dominated bleed: Sharpe -11.15, total return -13.7%, and every month negative. The core premise broke because the spread mean-reverted within ~1 day rather than persisting for days, so each trade earned ~0.027% of carry while paying ~0.19% in two-venue fees. The analyst abandoned it at the backtest-review gate after 4 iterations as a structurally fee-floored mechanism that threshold tuning could not fix, and it never reached optimization.

Outcome Summary

A correctly delta-neutral cross-venue funding carry still fails if the spread mean-reverts faster than the two-venue round-trip cost can be amortized; the carry's persistence horizon, not the hedge construction, is the binding constraint, and threshold tuning cannot extend it.

Outcome Summary

The backtest review returned an 'abandon' verdict at the pre-optimization gate, judging it structurally fee-dominated rather than buggy — the ~0.19% two-venue round-trip cost needs the funding gap to persist ~7 days per 10% APR of edge, but it mean-reverts and exits in ~1 day, so fees ran ~7x the carry captured.

Outcome Summary

A market-neutral cross-venue carry that shorted the rich-funding BTC perp and longed the cheap-funding one in equal notional across Binance USD-M and Hyperliquid, entering when the annualized funding differential exceeded ~10% APR and holding while it persisted to collect the net funding while running near-zero BTC delta.

Outcome Summary

The hedge was genuinely delta-neutral (annualized volatility 1.18%, beta -0.0007, correlation -0.03) and funding was credited, but it bled steadily: total return -13.7%, Sharpe -11.15, profit factor 0.865, expectancy -$66/trade across 177 trades, every month of the 14-month sample negative, with commission at 14% of gross.

Iteration History

Verification failed (Layer 2 — synthetic scenarios): Parameters used: ['exit_apr', 'entry_apr', 'per_leg_pct', 'min_notional', 'max_hold_bars', 'min_hold_bars', 'qty_precision', 'kill_switch_pct'] Check that __init__ sets all attributes from self.parameters.get(). - steady_uptrend: TypeError: BtcCrossVenueFundingSpreadCarryBinanceHlNeutral._rate_at() takes 3 positional arguments but 4 were given (bar timestamp: 1735689840000) - steady_downtrend: TypeError: BtcCrossVenueFundingSpreadCarryBinanceHlNeutral._rate_at() takes 3 positional arguments but 4 were given (bar timestamp: 1735689840000) - flat_ranging: TypeError: BtcCrossVenueFundingSpreadCarryBinanceHlNeutral._rate_at() takes 3 positional arguments but 4 were given (bar timestamp: 1735689840000) - volatility_spike: TypeError: BtcCrossVenueFundingSpreadCarryBinanceHlNeutral._rate_at() takes 3 positional arguments but 4 were given (bar timestamp: 1735689840000) - zero_volume: TypeError: BtcCrossVenueFundingSpreadCarryBinanceHlNeutral._rate_at() takes 3 positional arguments but 4 were given (bar timestamp: 1735689840000) - price_gap: TypeError: BtcCrossVenueFundingSpreadCarryBinanceHlNeutral._rate_at() takes 3 positional arguments but 4 were given (bar timestamp: 1735689840000)
Strategy report

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