Skip to content

nulledgehq/trading-bot-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NullEdge — a falsification engine for trading edges

A paper-first, research-driven framework that hunts for real trading edges and kills the fake ones. Its default verdict for every strategy is REJECT. It tested 8 edge families across 3 live data feeds and 3 timeframes on real Binance data — and rejected all of them. That negative result, honestly arrived at, is the whole point.

Write-up with the full numbers: https://nulledge.pages.dev/research/eight-edges-zero-alpha More research: https://nulledge.pages.dev

It does not trade real money. It is engineering + honest research, not investment advice.


Why this exists

Most "trading bot" content sells you a strategy and one flattering backtest. This is the opposite: a machine whose only job is to disprove edges before any money is at risk. An idea survives only after it clears every gate below — and almost nothing does. The discipline to kill your own best idea when the data says so is the entire job; this codebase encodes it.

The gauntlet (default verdict: REJECT)

An edge is promoted to candidate only if it survives all of these, net of costs:

  1. Economic rationale — who is structurally on the other side, and why does it persist?
  2. Sufficient sample — enough trades/events to mean anything (and ≥90 days across regimes for short-history feeds, or it's marked data-limited).
  3. Beats a random/null baseline — same trade frequency, random entries; the edge must clear it.
  4. Walk-forward out-of-sample — optimize on train, test on the unseen window that follows, roll forward. This is the gate that kills in-sample overfits.
  5. Parameter plateau — performance must not collapse (or flip sign) when a knob moves slightly.
  6. 2× fee/slippage stress — still positive when costs double.
  7. Capital scaling — does the edge survive realistic size, or only toy capital?

What it found (real data, 10 liquid Binance coins)

Result
8 edge families × 3 live feeds × 3 timeframes all REJECTED
Time-series momentum pooled alpha +0.44%/yr, t-stat 0.75 (≈zero), beta −0.23; sign flips across lookbacks → a knob, not an edge
Lower timeframes "fix fees"? losses shrink (VWAP −25.5%@1h → −5.8%@1d) but none beats random at any timeframe — the signal was the problem, not turnover
Funding carry (the lone survivor) +2.0–3.5%/yr, 5/6 walk-forward folds, but thin + regime-dependent; live forward-paper ≈ breakeven in the current low-funding regime

Live feeds wired in: perpetual funding (3y), open interest (~30d), long/short ratio (~30d). The agent runs continuously, refreshes its data, and when nothing passes it says so — literally: "No valid edge found yet. Continuing research." It never reports a profit it can't defend.

Quick start

python -m venv .venv && . .venv/Scripts/activate     # Windows; source .venv/bin/activate on *nix
pip install -r requirements.txt
pytest -q                                            # 168 tests

# fetch real market data (ccxt / Binance public)
python -m src.data.refresh                            # funding + 1h/4h/1d candles + OI + long/short

# run the falsification engine, one cycle
python -m src.research.continuous_research_agent --once

Other entry points (all real)

python -m src.research.edge_scanner            # score + report the registered edges through the gauntlet
python -m src.research.tsmom_run               # time-series momentum, walk-forward, net of fees
python -m src.research.timeframe_scan          # does lower turnover rescue any candle edge? (no)
python -m src.research.walk_forward_carry      # out-of-sample validation of the funding-carry edge
python -m src.paper.carry_live --once          # forward paper-trade the carry edge (maker), append a track record

How it's built

src/
  data/        # ccxt market data: candles, funding, open interest, long/short ratio, refresh; SQLite storage
  backtest/    # event-driven, NO-lookahead engine (decide on prior bar, fill next bar's open) + metrics
  risk/        # hard stops + kill-switch + daily-loss circuit breaker
  portfolio/   # capital allocation + compounding
  paper/       # realistic paper engine + forward carry paper runner (no real orders, no keys)
  strategies/  # Strategy interface + illustrative examples (NOT presented as profitable)
  monitoring/  # logging + optional alerts
  research/    # the heart: falsification gauntlet, continuous research agent, edge validator,
               # rejection engine, capital projection, ranker, hypothesis generator, market scanner,
               # walk-forward, random baselines, parameter-sensitivity, fee/slippage stress, scoring
tests/         # 168 tests: fees, slippage, sizing, stops, no-lookahead, walk-forward, gauntlet, agent
docs/SPEC.md   # full spec + falsification design + live-readiness gate

The research layer is deliberately fail-closed: missing data, missing rationale, or a failed gate all default to REJECT. Short-history feeds (OI, long/short) are gated behind a ≥90-day rule, so a pretty 30-day backtest can't sneak through as an edge.

Honest limits

  • No real-money trading. Paper-first; a live-readiness gate (30–60d positive paper, ≥100 trades/events, net positive after fees+slippage, drawdown limit, kill-switch + risk manager) must pass before anything goes live — and nothing has.
  • No high leverage. Built for spot / delta-neutral, not leveraged punts.
  • The example strategies are illustrative, not profitable. The point of this repo is the method, not a money printer.
  • Categories needing data with no free history (liquidations, L2 order book, news) are flagged as untested rather than faked.

Security

  • Exchange/API keys live ONLY in .env or config/config.yaml (both gitignored). Never hardcoded.
  • config/config.example.yaml ships without secrets; required secrets are validated at startup (fail fast).

Built by NullEdge — honest, falsification-first trading research. Questions / a strategy you think survives an honest walk-forward? https://x.com/nulledge

About

Falsification-first research engine for trading edges. Paper-only; default verdict REJECT.

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages