A Claude Code skill · local · no live money

Turn a trading idea into
numbers you can trust.

The AI Trading Floor takes a plain-English strategy idea and backtests it on real historical data — with a built-in honesty discipline that fights look-ahead bias and overfitting. Everything runs on your machine. Nothing touches a live account.

10 built-in strategies 5-agent quant team One dashboard, all results Yahoo data, no API key
The path

Six steps, start to insight

You don't need to know Python. You describe an idea; the floor maps it to a strategy, tests it honestly, and hands you a dashboard you actually read.

01
Install
Make a lab folder, a virtualenv, and install six Python packages.
02
Run
One command fetches data, backtests a strategy, and refreshes the dashboard.
03
Review
Open dashboard.html — trades, win rate, return, Sharpe, drawdown.
04
Extend
Add a new idea as one auto-registered file — even from a YouTube video.
05
Validate
Walk-forward, out-of-sample, and robustness checks to catch overfitting.
06
Go deep
Spin up the AI quant team to design, audit, and combine into portfolios.
Zero to dashboard

Quickstart

Three commands from an empty folder to a real backtest you can open in your browser. Run them inside the ai-trading-floor repo (or wherever scripts/ lives).

1
Build your toolbox — folder, virtualenv, dependencies
python3 -m venv .venv # create a virtualenv source .venv/bin/activate pip install -r requirements.txt
2
Run your first test — fetch + backtest + dashboard, one command
python scripts/run_pipeline.py --ticker AAPL --strategy sma_crossover
3
Read the result — open it in your browser
# open this file in your browser: reports/dashboard.html
Point & shoot

Command builder

Pick a ticker, a strategy, a time window, and tune the knobs. The exact command updates live — copy it and run. It stays honest: strategies the one-command pipeline can't fully tune drop to the two-step engine path so every command actually works.

e.g. 3y, 6mo, 60d
Your command
1-command
The playbook

Strategy catalog

Ten strategies ship built in — trend, mean-reversion, breakout, momentum, and short-side mirrors. Click any card to load it into the builder above.

Make it yours

Write your own strategy

A strategy is one file. Drop it in scripts/strategies/ and it auto-registers by filename — no engine edits, no central list to touch. The filename becomes its --strategy name.

The contract
  • 1Your function takes the price table (df) and returns one number per bar: +1 long, -1 short, 0 flat. A plain True/False series means long-only.
  • 2Don't shift the signal yourself. The engine applies the no-look-ahead shift(1) for you — today's decision only uses data through today.
  • 3Declare a SPEC with your defaults and any tunable Params. Those params become live knobs in the command builder above.
  • 4Optionally return a stop-price series too — the engine checks your stop sits on the losing side (a real stop, not a look-ahead).
💡 From a video or article? Describe the rules to the Strategy Analyst agent (below) — it turns a YouTube clip, screenshot, or trade log into an exact spec, and the Data Engineer writes this file for you.
The whole file
# scripts/strategies/my_breakout.py import pandas as pd import indicators as ind from ._spec import Param, StrategySpec def my_breakout(df, lookback=20): prior_high = ind.prior_period_high(df, int(lookback)) # long while today's close tops the prior N-bar high return (df["Close"] > prior_high).fillna(False) SPEC = StrategySpec( fn=my_breakout, defaults={"lookback": 20}, params=[Param("--lookback", "lookback", int, "prior-high lookback")], )
Then run it like any built-in:
python scripts/run_pipeline.py --ticker SPY --strategy my_breakout --lookback 30
Don't fool yourself

Validate & combine

A good backtest is easy to fake. These tools pressure-test a strategy on data it never saw, check that its edge is a stable plateau (not a lucky spike), and blend winners that don't all bet the same way. Run them from the scripts/ folder.

Prove it out of sample
Test many tickers, in-sample + out-of-sample + a param grid
Backtests each strategy across a whole universe, splitting history into in-sample and out-of-sample, and sweeps a small parameter grid. Writes results/, results/oos/, results/grid/, and results/_batch_summary.json.
python scripts/run_universe.py --tickers SPY,QQQ,GLD --strategies donchian_trend,breakout
Walk it forward
Re-tests over rolling, ever-expanding windows so you see how it would have held up as time actually passed. Writes results/walkforward_summary.json.
python scripts/walkforward.py --tickers SPY --strategies donchian_trend
Is the winner a plateau or a spike?
Reads the parameter grid you just built and scores each strategy: a high plateau score means nearby settings work almost as well (robust); a low score means you got lucky on one cell (overfit). Writes results/robustness_summary.json.
python scripts/robustness.py
Are your strategies just the same bet?
Maps how correlated your strategies' daily returns are, so you don't stack five flavors of the same trade. Writes results/strategy_correlation_oos.json.
python scripts/strategy_correlation.py --window oos
Blend into a portfolio
Combine a few results into one book
Weights the legs (default: inverse-volatility) into a single portfolio. Writes results/portfolio_growth_blend.json, which the dashboard pins on top.
python scripts/portfolio.py combine results/SPY_donchian_trend.json results/QQQ_breakout.json --scheme inverse_vol --name growth_blend
Auto-search the best low-overlap blend
Greedily picks a set that diversifies, capping how correlated any two legs can be. Writes results/portfolio_best.json.
python scripts/portfolio.py search results/*.json --max-size 5 --corr-cap 0.5 --name best
Own the strongest few each month
A cross-sectional momentum rotation over a preset pool — holds the top-K names and rotates monthly. Writes results/PORT_rotation_dualmom.json.
python scripts/run_rotation.py --pool allasset --top-k 3
Optional · advanced

The AI quant team

Beyond the toolkit, you can spin up a team of specialist agents that design, build, audit, chart, and speed up your research — coordinating through files, not vibes. Turn it on with one environment flag, then describe what you want to explore.

🛠️
Data Engineer
The doer. Fetches data, writes the strategy file, runs the backtests, and reports the stats. Uses the bundled scripts — never reinvents the engine.
🧭
Strategy Analyst
The designer. Turns a fuzzy idea — or a shared video, article, or trade log — into an exact, testable spec. Never writes code; reads results back in plain English.
🛡️
Auditor
The adversary. Hunts look-ahead bias, unrealistic fills, inverted stops, and overfitting. Returns PASS / FAIL / WARNING with severity before anything is trusted.
📈
Chart Builder
The visualizer. Renders candlestick charts and interactive reports to a strict, leakage-free standard so what you see matches what was tested.
Optimizer
The speed team. Vectorizes slow code without changing a single result — outputs must match to within 0.001 before a speedup ships.
🎯
Orchestrator (playbook)
Not a spawned teammate — the team lead itself combines audited strategies into portfolios and runs walk-forward and robustness checks.
How to run the floor
1
Turn it on — once, in your workspace settings
# .claude/settings.json → env (the tutorial's Step 0 sets this up for you) CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS="1" # restart the session if a team won't spawn
2
Kick it off — describe your idea in plain English
/ai-trading-floor test a 20/50 SMA cross on SOXL, then audit it for overfitting
3
The floor coordinates itself — through files, not chat
Strategy Analyst writes the exact spec → Data Engineer codes & runs it → Auditor hunts look-ahead and overfitting → Analyst reads the numbers back to you in plain English.
4
Read the result — same dashboard as always
reports/dashboard.html
What good looks like

What you get — and why to trust it

Every run lands in plain files in your folder. The headline is one dashboard. The reason to believe the numbers is the discipline baked into the engine.

reports/dashboard.html

The headline output

One offline page aggregating every result. How to read it:

  • The tree — asset class → ticker → strategy; portfolios pinned on top.
  • IS ⇄ OOS toggle — flip to out-of-sample: did the edge survive on data it never saw?
  • Correlation heatmap — how much your strategies overlap (green = independent bets).
  • Stat cards — trades, win rate, return, CAGR, daily Sharpe, max drawdown. ★ saves a favorite locally.
Files it reads from
  • data/<TICKER>.parquet — cached price bars
  • results/<ticker>_<strategy>.json — trades, equity curve, stats
  • reports/*.png — candlestick charts
The honesty rules
  • No look-ahead. Signals only use data available at that bar — indicators are shifted so tomorrow never leaks into today.
  • Realistic fills. Stops sit on the losing side; entries and exits price the way a real order would.
  • Daily Sharpe. Risk stats aggregate to daily returns — no per-trade inflation.
  • Anti-overfit. Walk-forward, out-of-sample splits, parameter-plateau robustness, and deflated Sharpe fight curve-fitting.
  • Known limits, stated. All-in positions, no native sizing, no cross-sectional ranking — the engine tells you what it can't do.