monte_carlo_irr

PortfolioDCF.monte_carlo_irr()

Distribution of money-weighted IRRs across Monte Carlo forecast paths.

For each simulated path the nominal internal rate of return (MWRR) is computed over the forecast horizon, honoring the configured cash flow strategy. It is the forward-looking counterpart of irr().

All paths share a single Monte Carlo return draw (see MonteCarlo.seed for reproducibility). The per-path investor cash-flow vector on a monthly grid t = 0 .. M (M = mc.period * 12) is:

  • t = 0 (Monte Carlo start): -initial_investment

  • t = 1 .. M: -monte_carlo_cash_flow (withdrawals become inflows)

  • t = M: additionally + the terminal wealth value (floored at 0)

With no intermediate cash flows each path’s IRR equals that path’s CAGR.

Returns:
Series

One annualized effective IRR per Monte Carlo path (length mc_number). NaN for paths whose cash flow has no sign change.

Examples

>>> pf = ok.Portfolio(["SPY.US", "AGG.US"], ccy="USD")
>>> pf.dcf.set_mc_parameters(distribution="norm", period=20, mc_number=100, seed=0)
>>> ind = ok.IndexationStrategy(pf)
>>> ind.initial_investment = 10_000
>>> ind.frequency = "year"
>>> ind.amount = -500
>>> pf.dcf.cashflow_parameters = ind
>>> pf.dcf.monte_carlo_irr().quantile([0.1, 0.5, 0.9])