Skip to content
python.financial
All topics

Browse 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 concept

Survivorship bias

Survivorship bias happens when failed or delisted assets disappear from old data, leaving only the names that survived.

Read concept

Walk-forward optimization

Walk-forward optimization chooses settings on past data, freezes them for the next period, and repeats through time.

Read concept

Purged cross-validation

Purged cross-validation removes training examples whose time spans overlap the test, reducing one important source of information leaks.

Read concept

Combinatorial purged cross-validation (CPCV)

CPCV builds several train and test paths while removing overlapping labels that could leak information.

Read concept

Trading 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 concept

Parameter robustness

A robust strategy should not collapse when you make a small, reasonable change to one setting or trading assumption.

Read concept

Multiple-testing bias

When you test many ideas, one can look impressive by luck. Judge the winner against every test that helped produce it.

Read concept

Vectorized 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 concept

Event-driven backtesting

An event-driven backtest handles market data, timers, orders, fills, and account changes one event at a time.

Read concept

Sharpe 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 concept

Sortino ratio

The Sortino ratio compares return above a chosen target with the size of returns that fall below that target.

Read concept

Maximum 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 concept

Alpha 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 concept

In-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 concept

Order types in backtesting

Market, limit, stop, and stop-limit orders have different trigger and fill rules. No order type guarantees a fill.

Read concept

MAE and MFE

MAE shows the worst price move against an open trade. MFE shows the best move in its favor.

Read concept

Point-in-time data

Point-in-time data stores what was actually known on each date, before later corrections, index changes, or company events.

Read concept

Data 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 concept

The 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 concept

Numba

Numba turns numerical Python functions into fast machine code, which is especially useful for loops and simulations that depend on earlier steps.

Read concept

Kelly 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 concept

Volatility targeting

Volatility targeting invests less after risk rises and more after it falls. The target is a goal, not a guarantee.

Read concept

Overfitting in backtesting

Overfitting happens when a strategy learns accidental patterns in old data and then performs much worse on new data.

Read concept

Deflated Sharpe ratio

The deflated Sharpe ratio asks whether the best result from a large search is better than luck might produce.

Read concept

Probability 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

Choose which optional services may run. You can change these settings at any time.