BnbDailyFundingPercentileLong200Sma
Hypotheses
BNB Daily Funding-Rate Percentile Long with 200-SMA Regime Filter
Hypotheses
A long-only single-instrument carry-and-direction strategy on BNBUSDT perpetual futures using daily bars + funding-rate data. This proposal directly responds to the analyst recommendation after the BNB Daily Multi-Week Trend abandonment: 'Stop attempting BNB daily long-only trend strategies until/unless a fundamentally different signal mechanism is proposed (e.g., funding-rate or open-interest based, not price-only).' This is a NEW mechanism class using REAL funding-rate data — not a price-only construction. The thesis: when BNB perp funding is in the bottom 30% of its trailing 90-day distribution (RELATIVE percentile, NOT an absolute threshold) AND BNB is above its 200-day SMA, market positioning is bearish-skewed (low funding = shorts not paying longs much, leveraged longs absent) WHILE the long-term trend is intact. This combination historically resolves with bullish catch-up rallies as the negative-positioning unwinds. Importantly, this proposal explicitly addresses the recently-documented failures: (a) NOT a price-only mechanism — uses funding rates as primary trigger, exactly what the analyst recommended after BNB Multi-Week Trend failure, (b) NOT an architecture-clone — uses RELATIVE percentile (rolling distribution) rather than the absolute negative-funding threshold that doomed BTC Negative Funding Carry (its trigger condition disappeared as crypto markets matured; relative percentile self-adapts to current funding-rate regime), (c) NOT a multi-condition AND-gate — single dominant signal (funding percentile) + single regime filter (200-SMA), (d) NO bait-and-switch — strictly BNBUSDT.BINANCE perp throughout, (e) sensitivity_passed=true with cliff_count=0 REQUIRED before optimization. BNB-SPECIFIC empirical justification: BNB has Binance-ecosystem catalysts (Launchpad, burns, BNB Chain news) that produce the most dynamic funding-rate flows of any crypto major — funding spikes around Launchpad events, burn quarters, and BNB Chain DeFi launches. The relative percentile filter captures these regime extremes. Existing BNB strategy in pipeline (BnbFourHourVolumeBreakoutLong) uses 4H + price/volume. This uses daily + funding. Genuinely orthogonal data source and timeframe.
Hypotheses
Implements the hypothesis's funding-percentile + 200-SMA mechanism unchanged. Iteration 4 addresses ONLY the reported Layer-3 failure (300s wall-clock timeout) — Layers 1 and 2 already passed, so imports, class structure, signal semantics, thresholds, entry/exit conditions and sizing are all preserved verbatim. Root cause of the timeout was two O(n)-per-bar scans: (1) `_funding_window` iterated the entire funding series on every bar (~2.1k bars x ~6.3k 8h funding prints ≈ 13M iterations), and (2) `calculate_signal` materialized `[b.close.as_double() for b in self._bars]` over the full bar buffer to read only the last 200 values. Fix: the funding series is parsed ONCE into two parallel sorted arrays (`_f_ts`, `_f_rates`) and located per-bar with `bisect_right`/`bisect_left` (stdlib), reducing the lookup to O(log n) plus an O(window) percentile count over a slice bounded at ~270 entries regardless of history length; the SMA now sums a bounded 200-element slice. `bisect` is stdlib and not on the banned-import list, so Layer 1 stays green. The signal remains continuous and varying every bar (percentile rank, not a gated constant), so Layer 2 stays green. Venue remains BINANCE USD-M futures because the edge is funding-rate-based and the position must hold the perp contract to be exposed to that mechanism; leverage is 1.0 and is genuinely consumed in `position_size` via `self.config.leverage`.
Hypotheses
Not worth 2 hours of optimization: the strategy is a negative-alpha closet long whose flaw is economic, not parametric. With benchmark_meaningful=true it carries alpha -0.0667 and information_ratio -0.9011 versus its own BNB buy-hold, a 52.55% max drawdown lasting 1658 days for a 9.95% total return (recovery_factor 0.75), and profit_factor 1.157 — below the post-fee edge bar. No parameter sweep converts a negative information ratio into a positive one. Worse, the hypothesis's central differentiator is falsified by its own result: the RELATIVE 90-day funding percentile was proposed specifically because the absolute negative-funding threshold that doomed BTC Negative Funding Carry 'decayed as markets matured', yet this relative-percentile version shows the SAME decay — annual returns +21.9% (2020) and +22.7% (2021) collapsing to -1.3% (2022), -1.1% (2024) and -14.2% (2025), with the most recent rolling Sharpe at -5.90 and a large open loss at backtest end (end_unrealized_pct -22.9). The whole track record is a 2020-2021 bull artifact carried by tail days (Feb 2021 alone +52.4%; kurtosis 42.5, skew 4.22, tail_ratio 0.32). This is NOT a code bug and NOT a mechanism mismatch — 83 long-only entries fire correctly off real funding data (1421 funding events) with zero drops, and the iteration-3/4 fixes are sound; the signal does what the hypothesis says, and what it says is not profitable relative to holding BNB. FAILURE PATTERN: reframing a decayed absolute-funding-threshold carry as a rolling-percentile funding trigger does NOT rescue it — the self-calibrating percentile keeps firing after the underlying funding-positioning edge is gone, so the mechanism degrades into a bull-market closet long (negative alpha, negative IR, 52% drawdown, PF 1.16, post-2021 returns net negative). Sending this to a 225-trial best-of-N sweep on 83 bull-concentrated daily trades would produce the standard high-IS / empty-or-negative-OOS overfit, fail deflated Sharpe, and consume two hours to reach the same conclusion.
Implementation
Long-only BNBUSDT.BINANCE perpetual daily strategy. Computes the percentile rank of the current funding rate within its trailing 90-day distribution (continuous [0,1] signal, recomputed every bar). Enters long when funding sits in the bottom 30% of that rolling distribution AND price is above the 200-day SMA. Exits on funding percentile reverting above 60%, loss of the SMA regime, an 8% stop-loss, an 18% take-profit, or a 30-day max hold. Sizes at 50% of account equity, notional-scaled by config 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
The mechanism is genuinely implemented as hypothesized: 83 long-only entries, zero shorts, funding percentile computed from real supplementary data (funding_events_available=1421), avg hold 4d 3h with a 30-day cap. entry_diag shows 83 signals -> 83 submitted, no sizing/min-notional drops. This is NOT a mechanism mismatch and NOT a broken/frozen signal.
Backtest Review
Trade count (83 over ~6.4 years) is adequate for a daily regime-gated strategy — the sample is not the reason to stop.
Backtest Review
The iteration-3/4 fixes worked: string funding keys are now parsed and the bisect-based window is O(log n), so the strategy runs in 11.7s and produces trades.
Backtest Review
Fees are not the binding problem (commission_pct_of_gross 2.43%).
Backtest Review
NEGATIVE alpha (-0.0667) and NEGATIVE information_ratio (-0.9011) with benchmark_meaningful=true — a long-only BNB perp strategy that delivers worse risk-adjusted return than simply holding BNB. Optimization tunes parameters; it cannot manufacture alpha where the mechanism adds negative value over its own benchmark.
Backtest Review
max_drawdown 52.55% with max_drawdown_duration_days 1658 (4.5 years underwater) for a total_return of only 9.95%. recovery_factor 0.75 and calmar_ratio 0.75 — the worst drawdown is 5x the entire gain.
Backtest Review
profit_factor 1.157 (below the 1.2 post-fee edge bar) and win_rate 43.4% with max_consecutive_losses 9.
Backtest Review
The edge is entirely a 2020-2021 bull-run artifact and has decayed to negative: annual returns 2020 +21.9%, 2021 +22.7%, then 2022 -1.3%, 2023 +6.1%, 2024 -1.1%, 2025 -14.2%. Rolling Sharpe is deeply negative in the most recent window (-5.90 at 2025-11-12). The hypothesis's core claim — that a RELATIVE percentile 'self-adapts to the current funding regime' and therefore avoids the decay that killed the absolute-threshold BTC Negative Funding Carry — is directly falsified by this backtest: the relative percentile decayed anyway.
Backtest Review
Outlier-carried: return_kurtosis 42.5, return_skew 4.22, tail_ratio 0.32 (fat left tail), cvar_95 5.35%. February 2021 alone (+52.4% month: +9.7/+16.1/+27.8% days) carries a large share of the whole track record.
Backtest Review
Position sizing is aggressive relative to the edge: avg_position_pct 46.0% with only 0.5 Sharpe and a 52.6% drawdown; impact_cost_pct is already 6.0% of gross PnL and capacity is only $27.8M.
Backtest Review
end_unrealized_pct -22.9 — the strategy is sitting on a large open LOSS at backtest end, so even the modest +9.95% headline understates how the position book is currently placed.
Backtest Review
Optimizing this would run a 225-trial best-of-N sweep over an edge concentrated in two bull years on 83 daily trades; the near-certain outcome is a high-IS / empty-or-negative-OOS overfit result that fails deflated Sharpe — the exact signature that has abandoned every recent single-asset daily long-only strategy in this factory.
Outcome Summary
This hypothesis was written in direct response to two prior abandonments: the analyst had asked for a non-price-only BNB signal, and the relative percentile was chosen expressly to avoid the threshold decay that killed BTC Negative Funding Carry. The engineering worked — iteration-3 fixed string-keyed funding data that had silently zeroed every signal, iteration-4 replaced two O(n)-per-bar hot paths with bisect lookups, and the final run fired 83 clean long entries off 1,421 real funding events with zero drops. But the strategy's own results falsified its central differentiator: the relative percentile decayed anyway, and the entire track record turned out to be a 2020-2021 bull artifact carried by tail days (February 2021 alone returned +52.4%; kurtosis 42.5, skew 4.22, tail_ratio 0.32), leaving a large open loss at backtest end (end_unrealized_pct -22.9). The reviewer noted this was neither a code bug nor a mechanism mismatch — the signal did exactly what the hypothesis said, and what it said was not profitable relative to simply holding BNB.
Outcome Summary
Reframing a decayed absolute-funding-threshold carry as a rolling-percentile trigger does not rescue it — a self-calibrating percentile keeps firing after the underlying positioning edge is gone, degrading the mechanism into a bull-market closet long.
Outcome Summary
The backtest-review gate abandoned it before optimization ran, judging the flaw economic rather than parametric: no parameter sweep converts a negative information ratio into a positive one, and sending 83 bull-concentrated daily trades into a 225-trial best-of-N sweep would produce the standard high-IS / negative-OOS overfit and fail deflated Sharpe after two wasted hours.
Outcome Summary
Go long BNBUSDT.BINANCE perpetual on daily bars whenever the current funding rate sat in the bottom 30% of its trailing 90-day distribution (a relative percentile, chosen specifically to self-adapt where an absolute negative-funding threshold had decayed) and BNB traded above its 200-day SMA, on the thesis that bearish-skewed positioning inside an intact uptrend resolves into catch-up rallies.
Outcome Summary
Across 83 long-only trades over ~6.4 years it returned 9.95% total with Sharpe 0.603, profit_factor 1.157, win_rate 43.4%, and a 52.55% max drawdown lasting 1,658 days — a worst drawdown roughly five times the entire gain. Alpha was -0.0667 and information_ratio -0.9011 against a meaningful BNB buy-hold benchmark, with annual returns of +21.9% (2020) and +22.7% (2021) collapsing to -1.3% (2022), -1.1% (2024) and -14.2% (2025).
Iteration History
Verification failed (Layer 2 — synthetic scenarios):
Parameters used: ['sma_period', 'min_notional', 'stop_loss_pct', 'exit_percentile', 'take_profit_pct', 'entry_percentile', 'max_holding_days', 'position_fraction', 'funding_window_days', 'min_funding_samples']
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: 1735701540000)
- steady_downtrend: TypeError: FactoryStrategy._bar_ts() takes 1 positional argument but 2 were given (bar timestamp: 1735701540000)
- flat_ranging: TypeError: FactoryStrategy._bar_ts() takes 1 positional argument but 2 were given (bar timestamp: 1735701540000)
- volatility_spike: TypeError: FactoryStrategy._bar_ts() takes 1 positional argument but 2 were given (bar timestamp: 1735701540000)
- zero_volume: TypeError: FactoryStrategy._bar_ts() takes 1 positional argument but 2 were given (bar timestamp: 1735701540000)
- price_gap: TypeError: FactoryStrategy._bar_ts() takes 1 positional argument but 2 were given (bar timestamp: 1735701540000)
Iteration History
Verification failed (Layer 3 — sandbox backtest): No trades produced
Bar type used: BNBUSDT.BINANCE-1-DAY-LAST-EXTERNAL, Bars processed: 2328
Diagnostics: should_enter() returned a side 0 times over 2129 evaluated bars -> your ENTRY CONDITION never triggered. Loosen the entry logic / thresholds.
Ensure your strategy produces trades with the given data and parameters.
Backtest and paper results are hypothetical. Trading involves risk of loss.