Examples & Notebooks
This page lists the runnable examples and companion notebooks. Each example is designed to be short, reproducible, and easy to adapt to your workflow.
How to run
# from the repository root
python -m pip install -e .[robust]
python examples/quickstart_etf_allocation.py
Quickstarts
examples/quickstart_etf_allocation.py- end-to-end ETF allocation (moments -> frontiers -> ensemble -> discrete trades). Outputs plots and CSVs underoutput/.
Frontiers & risk models
examples/mean_variance_frontier.py- classical mean-variance frontier.examples/cvar_allocation.py- CVaR frontier (\(\alpha = 5\%\)).examples/robust_frontier.py- robust (Meucci) \(\lambda\)-frontier.examples/relaxed_risk_parity_frontier.py- relaxed risk parity diagnostic sweep.examples/budget_risk_parity.py- custom risk budgets (50/20/20/10) vs. ERC.examples/group_constraints.py- sector allocation limits with typedConstraints.examples/repricing_derivatives.py- stocks + bonds + options via the Prayer repricing chain.
Utilities
examples/discrete_allocation.py- convert continuous weights into lot-sized share counts.examples/portfolio_ensembles.py- blend multiple model selections via stacking/averaging to a single allocation.examples/stress_and_pnl.py- probability tilts, linear shocks, and performance summaries.