Strategies - Statistical Arbitrage¶
This module demonstrates a basic Statistical Arbitrage strategy, specifically pairs trading.
Concepts¶
- Cointegration: A statistical property of a collection of time series variables. If two or more series are themselves non-stationary, but a linear combination of them is stationary, then the series are said to be cointegrated.
- Pairs Trading: Identifying two cointegrated assets and trading the spread between them. When the spread widens beyond a historical norm (measured by z-score), you short the outperforming asset and long the underperforming one, betting the spread will revert to the mean.
Example¶
Run python stat_arb.py to see a demonstration of testing cointegration and generating entry/exit signals based on the z-score of the spread.
Running it¶
More in Strategies¶
- Order Execution Simulator: This tool lets you simulate buy and sell orders, track a virtual portfolio, and analyze trade performance.
- Strategies - Backtesting Engine: A backtest answers one question: if I had traded this rule, what would have happened? This module is a compact, honest backtester for single-asset strategies — it converts a price series and a position series into an...
- Strategies - Market Making: Implementation of the Avellaneda-Stoikov (2008) continuous-time market making model.
- Strategies - Mean Reversion: Mean reversion is the statistical tendency for an asset's price to return to its historical average after deviating from it.
- Strategies - Momentum Trading: Momentum trading is a strategy that capitalizes on the continuance of existing trends in the market.
- Strategies - Optimal Execution: A signal tells you what to own. It does not tell you how to get there.