You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat!: tracking error is the standard deviation of return differences (#97)
BREAKING CHANGE: `tracking_error()` returns different values and no longer
accepts a `method` argument.
`okama` implemented two formulas behind `method`, and the default was the
uncentered root-mean-square of the monthly return differences. That quantity is
not the tracking error: leaving the differences uncentered folds the systematic
lag behind the benchmark — the tracking difference — into the dispersion
measure, so a fund that trails by a steady amount every month is reported as
badly tracking even when the gap never moves.
Tracking error is the sample standard deviation of the differences around their
mean (CFA Level II, 2019, V6, eq. 8; CFA Level I, 2025, V9 Portfolio Management,
footnote 3), which is what all three entry points now compute — and the only
thing they compute:
helpers.Index.tracking_error(ror)
AssetList.tracking_error(rolling_window=None)
Portfolio.tracking_error(benchmark, rolling_window=None)
The relation between the two is exact: TE_rms² = (N-1)/N · TE_std² + mean(d)²,
so the RMS variant is not a different estimator of the same thing but a mixture
of two measures the curriculum deliberately keeps apart. It is removed rather
than kept as an option — callers who passed `method="std"` keep their numbers by
dropping the argument.
Docstrings now state the formula, the relation to tracking difference and the
CFA reference. `pyproject.toml` is deliberately left at 2.3.1: the version bump
belongs to the release workflow.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VUmxQQKrKZRAi1qKUternL
0 commit comments