Examples#
This gallery walks through every public feature of financialkit.portfolio:
Markowitz’s frontier, Tobin’s tangency portfolio, Merton’s analytic
frontier and the 1/N benchmark; Kelly betting, Merton’s portfolio problem
and CPPI; single-index and Ledoit-Wolf covariance estimates; the Sharpe
and Sortino ratios and Grinold’s fundamental law; Black-Litterman and
Michaud resampling; and CVaR optimization, maximum diversification, risk
parity and hierarchical risk parity.
Each script in this gallery is self-contained and can be run directly with
python examples/portfolio/<section>/<script>.py.
Sections#
mean_variance – the Markowitz frontier, Tobin separation, Merton’s closed form and DeMiguel-Garlappi-Uppal’s 1/N.
growth – the Kelly criterion, Merton’s portfolio problem and CPPI.
covariance – Sharpe’s single-index model and Ledoit-Wolf shrinkage.
performance – the Sharpe ratio, Grinold’s fundamental law and the Sortino ratio.
bayesian – Black-Litterman and Michaud’s resampled frontier.
risk_based – CVaR optimization, the most-diversified portfolio, risk parity and hierarchical risk parity.
Estimation-aware optimization#
Taming the error in expected returns with a market prior or by resampling.
Covariance estimation#
Structured and shrunk estimates of the covariance matrix, the input that mean-variance optimizers are most sensitive to after the means.
Growth and dynamic strategies#
Maximizing the long-run growth of wealth, the continuous-time consumption and investment problem, and portfolio insurance.
Black and Jones’s constant proportion portfolio insurance
Mean-variance#
Portfolios with the least variance for their mean, with and without short sales and a riskless asset, and the naive benchmark they struggle to beat out of sample.
Performance measurement#
Return per unit of risk, its sampling error, and where skill comes from.
Risk-based allocation#
Portfolios built from risk alone: tail risk, diversification and equal risk contributions.