Here is an example project to use Python, Pandas, Numpy and Matplotlib to perform a Monte Carlo Simulation for an investment portfolio of investing in 2 stocks namely IVV.US and QQQ.US, by running a simulation of 1000 scenarios:
1 | import pandas as pd |
Calculate daily returns and mean returns and Compute pairwise covariance
1 | # get the daily returns and mean returns |
Perform Monte Carlo Simulation for 1000 days investment time frame with 1000 scenarios
1 | #generate random weights for the portfolio allocations to each stocks: |