okama 2.1.0
Feature release that switches get_cagr and get_cumulative_return to an expanding-window definition, makes the okama API endpoint configurable via environment variables, and ships a batch of correctness fixes across the helpers, frontier, DCF, macro, and plotting layers.
Changed
AssetList.get_cumulative_return()andPortfolio.get_cumulative_return()now return an expanding cumulative return series instead of a single end-of-period scalar. Notebook 03 investment portfolios.ipynb updated accordingly.AssetList.get_cagr()andPortfolio.get_cagr()now compute CAGR on an expanding window, consistent withget_cumulative_return().
Added
- Configurable API base URL and request timeout via environment variables (
OKAMA_API_URL,OKAMA_API_TIMEOUT) inokama.settingsandokama.api.api_methods.
Fixed
Frame.get_semideviation()(inokama.common.helpers) now uses the sample mean of returns instead of the population mean, restoring the standard semideviation definition; propagated throughAssetListandPortfolioconsumers.AssetList.recovery_periodsis robust to alast_datethat is not on a month start.EfficientFrontier/EfficientFrontierReb(single- and multi-period variants) now raiseRuntimeErroron failed SLSQP optimisation instead of silently returning invalid weights.AssetList.plot_assets()/Portfolio.plot_assets()autoscale no longer passes the invalidaxis="year"argument.Inflation.cumulative_inflation(inokama.macro) uses.iloc[-1]instead of positional[-1], fixing a pandas FutureWarning / lookup bug.PortfolioDCFdiscount-rate attribute renamed from the misspelledmonlthly_discount_ratetomonthly_discount_rate(okama.portfolios.dcf,okama.portfolios.dcf_calculations).- Helpers producing NaN rows now use
np.nanindict.fromkeys(...)so resulting DataFrames keep float dtype (okama.common.helpers, consumed byAssetListandPortfolio).
Removed
- Dead
Portfolio._clear_cf_cachemethod.
Tooling
- Enabled ruff
UP(pyupgrade) rules and applied auto-fixes acrossokama.common.helpers,okama.common.helpers.rebalancing,okama.portfolios.dcf, and notebook 11 rebalancing portfolio.ipynb. - Aligned declared supported Python versions with the
pyproject.tomlminimum;AGENTS.mdnow mandates a TDD workflow for production code changes. .gitignoreexcludes.env.
Full Changelog: v2.0.1...v2.1.0