quantlab.runs.backtest_attribution#
Backtest attribution: where a strategy’s excess over its benchmark comes from.
A model backtest picks a few names from a universe and pays to trade them, so its excess over the benchmark has three parts:
universe: the universe held equally weighted against the benchmark, which the strategy earns or loses whatever it picks;
selection: the strategy before costs against that equal-weighted universe, what the scores and the portfolio rule add;
costs: the strategy after costs against before them.
The parts are differences of log growth, so they add up to the strategy’s
log growth over the benchmark exactly. rebalanced_group_values gives the
universe curve, and the curves of the universe cut into groups by score,
which show where in the ranking the scores carry information.
attribution_metrics assembles a run’s attribution block from an
account record (quantlab.runs.run_metrics.AccountRecord), so both
backtests report it the same way.
Functions
Return a value curve's log growth from its first to its last value, per year. |
|
Return an account's |
|
Split the strategy's annualised log growth over the benchmark into its three parts. |
|
Return the value curves of the score groups, each held equally weighted between rebalances. |