- Published on
Backtest Statistics Categories
- Authors
- Name
- Tails Azimuth
Table of Contents
- Time-Weighted Rate of Return (TWRR)
- Performance Statistics
- Runs and Risk Metrics in Investment Strategies
- Returns Concentration
- HHI Concentration Functions
- Drawdown and Time Under Water
- DD and TuW Functions
- Runs Statistics for Performance Evaluation
- Code for Calculating Runs Statistics
- Implementation Failure Metrics
- Efficiency Metrics
- Sharpe Ratio (SR)
- Probabilistic Sharpe Ratio (PSR)
- Deflated Sharpe Ratio (DSR)
- Other Efficiency Metrics
- Classification Scores
- References
Backtest statistics are essential for evaluating the efficacy of investment strategies. These metrics fall into different categories:
- General Features: Includes metrics like Time range, Average AUM, Capacity, and Leverage.
- Performance Metrics: Such as PnL, annualized rate of return, hit ratio, etc.
Python | Julia |
---|---|
|
|
Time-Weighted Rate of Return (TWRR)
TWRR is a method for calculating returns that adjusts for external cash flows. The formula is complex but can be summarized with:
: TWRR for portfolio between time .
: Mark-to-market profit or loss for portfolio at time .
: Market value of assets managed by portfolio over sub-period .
Python | Julia |
---|---|
|
|
Performance Statistics
Performance statistics that are not risk-adjusted include:
PnL: Total dollars earned.
PnL from Long Positions: Earnings from only long holdings.
Annualized Rate of Return: Includes all forms of earnings and expenses.
Hit Ratio: Percentage of profitable bets.
Runs and Risk Metrics in Investment Strategies
Investment strategies often contain series of returns, known as "runs," that can be either positive or negative. Understanding the concentration of these runs and their impact on risk factors like drawdowns and time under water is essential for assessing a strategy's viability.
Returns Concentration
Consider a time series of bet returns, , with a length . We can split these returns into positive and negative subsets, and . Two weight series, and , can be defined as:
We define the Herfindahl-Hirschman Index (HHI)-based concentration of positive returns () and negative returns () as:
Desirable strategy characteristics include:
- High Sharpe ratio
- Many bets per year
- High hit ratio (low )
- Low
- Low
HHI Concentration Functions
Python | Julia |
---|---|
|
|
These functionalities are available in both Python and Julia in the RiskLabAI library.
Drawdown and Time Under Water
Drawdown (DD) is the most significant loss between two high watermarks (HWMs), while Time under Water (TuW) is the duration taken to surpass a previous HWM.
DD and TuW Functions
Python | Julia |
---|---|
|
|
These functionalities are available in both Python and Julia in the RiskLabAI library.
Runs Statistics for Performance Evaluation
Key Metrics:
- HHI index for both positive and negative returns.
- Time between bets measured by HHI index.
- 95th percentile of Drawdown (DD) and Time under Water (TuW).
These metrics are useful to understand the concentration of portfolio returns and the risk involved.
Code for Calculating Runs Statistics
Python | Julia |
---|---|
|
|
Implementation Failure Metrics
Key Metrics to prevent investment plans from failing:
- Broker fees per turnover
- Average slippage per turnover
- Dollar performance per turnover
- Return on execution costs
These metrics help you understand how your portfolio could be affected by hidden costs.
Efficiency Metrics
Sharpe Ratio (SR)
This ratio measures performance by dividing the average returns by the standard deviation of returns.
Probabilistic Sharpe Ratio (PSR)
This metric adjusts the Sharpe ratio to account for data distortions like skewness and kurtosis.
Deflated Sharpe Ratio (DSR)
This is an extension of PSR, which accounts for the number of trials performed to obtain the Sharpe ratio.
Other Efficiency Metrics
- Annualized Sharpe Ratio
- Information Ratio
- Probabilistic Sharpe Ratio (PSR)
- Deflated Sharpe Ratio (DSR)
Classification Scores
Metrics for evaluating the performance of machine learning algorithms in trading strategies include:
Accuracy:
Precision:
Recall:
F1 Score:
These metrics help you gauge how accurately your machine learning model is performing in real trading scenarios.
Python | Julia |
---|---|
|
References
- De Prado, M. L. (2018). Advances in financial machine learning. John Wiley & Sons.
- De Prado, M. M. L. (2020). Machine learning for asset managers. Cambridge University Press.