Examples¶
Two things live under "Examples" here:
- This section — a handful of curated deep dives, each walking through one published result (often a textbook table) with real output and explanation. Start here to understand why a module exists, especially the ones flagged in Library alternatives as doing something no other Python library does.
- The API Reference — every function with a translated example shows
it directly on its reference page, live-synced from the same
.pyfiles so it can't drift. That's the exhaustive set: essentially all ~150 scripts from the original MATLABExamples/folder (see the example translation tracker for file-by-file status), filed under whichever module they exercise.
In short: come here for the guided tour, go to the API Reference for the exhaustive catalog.
Available deep dives¶
Ordered simplest-first, roughly following how the pieces build on each other: price a single instrument, build a portfolio, budget its risk, then the more specialized tools underneath.
- Bond pricing and sector-level risk — the simplest starting point: pricing a single instrument.
- Mean-variance, minimum-variance, tracking error — building a portfolio from those instruments.
- Risk budgeting (ERC / VaR / ES) — reproduces
Roncalli (2013), Tables 2.2–2.4.
portfolio.risk_budgetingis the single largest "no real alternative" case in the whole port. - Black-Litterman — reproduces Roncalli (2013), page 24; blending market views into the portfolio.
- Building blocks: bisection, linear algebra, numerical
differentiation — the lower-level tools the
above examples build on.
linalg.special_matricesis a third "fills a real gap" case (vec/vech/duplication/elimination matrices have no clean public equivalent elsewhere). - Ridge, OLS, and robust regression
- Whittle (frequency-domain) estimation —
econometrics.whittleis the other clean "nothing else does this" case: nostatsmodels/archequivalent exists. - SVM classification
The full set of original MATLAB scripts these examples translate from
is organized by module: rpb/, optim/, stats/, svm/, ects/,
matrix/, dates/, tools/, backtest/, maths/ — see the
example translation tracker
for exactly which files are done, and the
hfs-archive repo for the
original source material.