pdf pdf |
|---|
How Long Must a Trading Track Record Be?
Code, frozen data, and outputs for the paper How Long Must a Trading Track Record Be? Bayesian Planners, Random-Timing Tests, Market Making, and the Detectability of Trading Skill.
The paper asks how long a trading record must be before skill can be told apart from luck, and whether Bayesian and Monte Carlo planners change the answer. A one-step Monte Carlo planner, an exhaustive four-step decision tree, and Bayes-adaptive Monte Carlo tree search (MCTS) share one Bayesian model and one utility. They are run on six cryptocurrencies and four ETFs, net of costs and with interest on cash. They are then tested against random timing, a paired bootstrap, deflated Sharpe ratios, White's reality check, Hansen's SPA test, the probability of backtest overfitting, random seeds, and synthetic markets with known properties. A stylized market-making simulation shows the fast side: how quickly a market maker's edge is verified and how sharply it depends on speed, fees, and informed order flow.
Contents
| Path | What it is |
|---|---|
sim/fetch_data.py |
downloads daily prices (Binance public API, Yahoo Finance chart API) |
sim/core.py |
model, strategies, accounting, statistical tests, all settings |
sim/positions.py |
daily positions of every strategy → out/pos_<asset>.npz |
sim/experiments.py |
tests, results.json, tables/*.tex, fig/*.pdf |
sim/robustness.py |
20 random seeds and prior sensitivity → seeds.json, tables/seeds.tex, tables/sensitivity.tex |
sim/synthetic.py |
size and power on synthetic markets → synthetic.json, fig/power.pdf |
sim/market_making.py |
stylized market maker (Avellaneda–Stoikov quotes, sniping, fees, latency) → mm.json, tables/mm.tex, fig/mm.pdf |
data/*.csv |
frozen daily closes: BTC, ETH, BNB, XRP, LTC, ADA (vs USDT, to 2026-11-15); SPY, QQQ, GLD, TLT (adjusted, to 2026-11-13); irx.csv: 13-week T-bill yield |
out/*.npz |
cached daily positions (lets you skip the slow positions.py) |
results.json, synthetic.json, seeds.json, mm.json |
all numbers reported in the paper |
tables/, fig/ |
the tables and figures the paper includes |
Reproduce
pip install numpy pandas scipy matplotlib
cd sim
python3 positions.py # ~25 min on 7 cores (optional: out/ is included)
python3 experiments.py # ~25 min
python3 robustness.py # ~3 h on 7 cores (MCTS dominates)
python3 synthetic.py # ~10 min
python3 market_making.py 2 # ~6 min on 2 cores
Do not rerun fetch_data.py if you want the paper's numbers: new prices change every result.
Random seeds are fixed in the code.
Licenses
- Code (
sim/): MIT. - Outputs (
results.json,synthetic.json,seeds.json,mm.json,tables/,fig/,out/): CC BY 4.0. - Price data (
data/) come from Binance and Yahoo Finance and remain subject to their terms of use; they are included only so that the results can be reproduced.
Not investment advice.
- Downloads last month
- 50