Concepts
Understand the ideas behind reliable backtesting, trading costs, validation, performance measurement, portfolio risk, and quantitative research.
Learn the ideas in a useful order
First make sure your data does not use the future. Then learn how to test ideas, model trades, read results, and speed up the parts that are actually slow.
Do not use future information
Learn about look-ahead bias, point-in-time data, survivorship bias, and when each fact was actually available.
Explore 2. Testing ideasNotice when you tried too many things
Learn how overfitting, data snooping, repeated tests, and fragile settings can make a weak idea look good.
Explore 3. Testing through timeTrain on the past and test on the future
Use walk-forward tests and learn when purging, embargoes, or several test paths are helpful.
Explore 4. SimulationModel trades and their costs
Compare array-based and event-driven tests, then model order timing, fills, fees, slippage, and available liquidity.
Explore 5. Measurement and riskUnderstand what the numbers mean
Learn how to read Sharpe, Sortino, drawdown, alpha, beta, MAE, Kelly sizing, volatility targets, DSR, and PBO.
Explore 6. SpeedMake slow code faster
Understand NumPy, Numba, the Python GIL, processes, native code, memory use, and compilation time.
ExploreBrowse concepts
Browse the full collection or use the path above if you are not sure where to begin.
Look-ahead bias
Look-ahead bias happens when a backtest uses information or a fill price that was not available when the trade decision was made.
Read conceptSurvivorship bias
Survivorship bias happens when failed or delisted assets disappear from old data, leaving only the names that survived.
Read conceptWalk-forward optimization
Walk-forward optimization chooses settings on past data, freezes them for the next period, and repeats through time.
Read conceptPurged cross-validation
Purged cross-validation removes training examples whose time spans overlap the test, reducing one important source of information leaks.
Read conceptCombinatorial purged cross-validation (CPCV)
CPCV builds several train and test paths while removing overlapping labels that could leak information.
Read conceptTrading costs and slippage
Real trading pays fees and often gets a worse price than expected. A useful backtest includes those costs and tests how sensitive the result is to them.
Read conceptParameter robustness
A robust strategy should not collapse when you make a small, reasonable change to one setting or trading assumption.
Read conceptMultiple-testing bias
When you test many ideas, one can look impressive by luck. Judge the winner against every test that helped produce it.
Read conceptVectorized backtesting
Vectorized backtesting uses arrays to test many assets or settings at once. It can be very fast, but it still needs clear timing and trading rules.
Read conceptEvent-driven backtesting
An event-driven backtest handles market data, timers, orders, fills, and account changes one event at a time.
Read conceptSharpe ratio
The Sharpe ratio compares average return above a benchmark with how much that return varies. It is useful, but easy to compare incorrectly.
Read conceptSortino ratio
The Sortino ratio compares return above a chosen target with the size of returns that fall below that target.
Read conceptMaximum drawdown
Maximum drawdown is the largest fall from an earlier account peak. It shows how deep the loss became, not how bad a future loss could be.
Read conceptAlpha and beta
Beta shows how much a strategy tends to move with a benchmark. Alpha is the return the model does not explain, but it is not proof of skill.
Read conceptIn-sample vs out-of-sample testing
In-sample data helps you build the strategy. Out-of-sample data stays hidden until the strategy and testing rules are fixed.
Read conceptOrder types in backtesting
Market, limit, stop, and stop-limit orders have different trigger and fill rules. No order type guarantees a fill.
Read conceptMAE and MFE
MAE shows the worst price move against an open trade. MFE shows the best move in its favor.
Read conceptPoint-in-time data
Point-in-time data stores what was actually known on each date, before later corrections, index changes, or company events.
Read conceptData snooping bias
Data snooping happens when the same history helps choose a strategy and is then presented as if it were a fresh test.
Read conceptThe Python GIL
The GIL limits pure Python code to one active thread, but NumPy, Numba, Rust, separate processes, and waiting for data behave differently.
Read conceptNumba
Numba turns numerical Python functions into fast machine code, which is especially useful for loops and simulations that depend on earlier steps.
Read conceptKelly criterion
The Kelly criterion suggests how much to risk for long-term growth, but small errors in the inputs can make its answer dangerously large.
Read conceptVolatility targeting
Volatility targeting invests less after risk rises and more after it falls. The target is a goal, not a guarantee.
Read conceptOverfitting in backtesting
Overfitting happens when a strategy learns accidental patterns in old data and then performs much worse on new data.
Read conceptDeflated Sharpe ratio
The deflated Sharpe ratio asks whether the best result from a large search is better than luck might produce.
Read conceptProbability of backtest overfitting
PBO estimates how often the best strategy in one part of the data becomes worse than average in another part.
Read concept