monte_carlo_returns_ts
- property MonteCarlo.monte_carlo_returns_ts
Generate portfolio monthly rate of return time series with Monte Carlo simulation.
Monte Carlo simulation generates n random monthly time series with a given distribution. Forecast period should not exceed 1/2 of portfolio history period length.
First date of forecaseted returns is portfolio last_date.
- Returns:
- DataFrame
Table with n random rate of return monthly time series.
Examples
>>> pf = ok.Portfolio( ... ["SPY.US", "AGG.US", "GLD.US"], ... weights=[0.60, 0.35, 0.05], ... rebalancing_strategy=ok.Rebalance(period="month"), ... ) >>> pf.dcf.set_mc_parameters(period=8, mc_number=5000) >>> pf.dcf.mc.monte_carlo_returns_ts 0 1 2 ... 4997 4998 4999 2021-07 -0.008383 -0.013167 -0.031659 ... 0.046717 0.065675 0.017933 2021-08 0.038773 -0.023627 0.039208 ... -0.016075 0.034439 0.001856 2021-09 0.005026 -0.007195 -0.003300 ... -0.041591 0.021173 0.114225 2021-10 -0.007257 0.003013 -0.004958 ... 0.037057 -0.009689 -0.003242 2021-11 -0.005006 0.007090 0.020741 ... 0.026509 -0.023554 0.010271 ... ... ... ... ... ... ... 2029-02 -0.065898 -0.003673 0.001198 ... 0.039293 0.015963 -0.050704 2029-03 0.021215 0.008783 -0.017003 ... 0.035144 0.002169 0.015055 2029-04 0.002454 -0.016281 0.017004 ... 0.032535 0.027196 -0.029475 2029-05 0.011206 0.023396 -0.013757 ... -0.044717 -0.025613 -0.002066 2029-06 -0.016740 -0.007955 0.002862 ... -0.027956 -0.012339 0.048974 [96 rows x 5000 columns]