This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Multidimensional Case | |
| from scipy.stats import random_correlation | |
| seed = 2222 | |
| dim = 10 | |
| T = 1 | |
| N = int(2.**9) | |
| S0 = np.random.normal(100, 1, dim) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Two-dimensional Case | |
| seed = 22 | |
| dim = 2; T = 1; N = int(2.**9) | |
| S0 = np.array([100, 100]) | |
| # Parameter Estimation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Visualize the closing price history | |
| import matplotlib.pyplot as plt | |
| plt.figure(figsize = (16,8)) | |
| plt.title('Close Price History', fontsize = 18) | |
| plt.plot(intc['Adj Close']) | |
| plt.plot(amd['Adj Close']) | |
| plt.legend(['INTC', 'AMD'], loc = 'upper left', fontsize = 18) | |
| plt.xlabel('Date', fontsize = 18) | |
| plt.ylabel('Close Price USD ($)', fontsize = 18) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas_datareader as pdr | |
| from datetime import datetime | |
| intc = pdr.get_data_yahoo(symbols='INTC', start=datetime(2018, 1, 1), end=datetime(2020, 1, 1)) | |
| amd = pdr.get_data_yahoo(symbols='AMD', start=datetime(2018, 1, 1), end=datetime(2020, 1, 1)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Asset Path | |
| import numpy as np | |
| def GBMsimulator(seed, So, mu, sigma, Cov, T, N): | |
| """ | |
| Parameters | |
| seed: seed of simulation | |
| So: initial stocks' price | |
| mu: expected return |