Repository navigation
okama 4.0.1 — Faster portfolio analytics
This patch release focuses on CPU calculation speed, reusable numerical preparation and bounded caches. The accelerated paths preserve financial formulas, return shapes and supported fallbacks; equivalence checks use explicit numerical tolerances.
Performance highlights
Representative complete-call medians from the linked optimization reports:
| Public calculation | Measured workload | Before → after | Gain |
|---|---|---|---|
EfficientFrontier.get_monte_carlo() |
252 months, 3 assets, 8,192 portfolios, yearly rebalancing | 19.795 s → 65.835 ms | 300.7× |
EfficientFrontier.get_grid_portfolios() |
Same history, 5,151 portfolios | 12.578 s → 30.520 ms | 412.1× |
EfficientFrontierSingle.get_monte_carlo() |
252 months, 3 assets, 8,192 portfolios, mean return | 3.347 s → 18.535 ms | 180.6× |
AssetList.get_rolling_cagr() |
600 months, 16 assets, 60-month window | 253.667 ms → 1.129 ms | 224.6× |
PortfolioDCF.wealth_index() |
600-month history, monthly indexation | 101.557 ms → 4.290 ms | 23.7× |
PortfolioDCF.monte_carlo_wealth() + monte_carlo_cash_flow() |
360 months, 8,192 simulations, complete cold pair | 692.072 ms → 99.792 ms | 6.9× |
PortfolioDCF.monte_carlo_irr() |
Same simulations, no intermediate payments, cold call | 698.126 ms → 85.190 ms | 8.2× |
EfficientFrontier.plot_pair_ef() |
4 assets / 6 pairs, 120 months, 12 points | 3.689 s → 0.874 s first / 11.2 ms repeat | 4.2× first / 328× repeat |
The reports measure separate optimization stages on a Ryzen 7 8845H CPU; their baselines and dependency versions differ by experiment. Ratios are workload-specific and must not be multiplied. Pairwise repeat figures require unchanged inputs and a populated pair-table cache. Offline calculations exclude network acquisition and browser rendering. Pairwise plot timings cover the call returning Matplotlib axes; canvas rendering and image export are excluded.
- Frontier CPU batching and calendar batching.
- Statistics and rolling calculations.
- PortfolioDCF / MonteCarlo results, fallbacks and memory costs.
- Pairwise frontier preparation and cache measurements.
- Full measurement summary, including dividend preparation, conditional rebalancing, API reuse and smaller workloads.
Fixes and compatibility
search()handles literal punctuation in namespace-scoped queries.Rebalance.wealth_ts()preserves string event labels and period indexes without the reproduced pandas warnings.EfficientFrontier.ef_pointsuses feasible CAGR endpoints under restrictive weight bounds.PortfolioDCF.discount_ratechanges invalidate cash-flow caches.AssetemitsMissingDistributionsWarningforTPAY.MOEX,FLOW.MOEXandAKIE.MOEXwhen API payout history is empty. The upstream distributions themselves remain tracked separately.- Patched dependency floors are explicit at runtime and in the relevant development groups; the library does not ship a lockfile.
- Python 3.11–3.14 support is retained. Notebook setup preserves local editable installations while retaining Google Colab installation.