January 2020
Beginner to intermediate
432 pages
11h 24m
English
Execute the following steps to estimate the value-at-risk using Monte Carlo.
import numpy as npimport pandas as pdimport yfinance as yfimport seaborn as sns
RISKY_ASSETS = ['GOOG', 'FB']SHARES = [5, 5]START_DATE = '2018-01-01'END_DATE = '2018-12-31'T = 1N_SIMS = 10 ** 5
df = yf.download(RISKY_ASSETS, start=START_DATE, end=END_DATE, adjusted=True)
adj_close = df['Adj Close']returns = adj_close.pct_change().dropna()plot_title = f'{" vs. ".join(RISKY_ASSETS)} returns: {START_DATE} - {END_DATE}'returns.plot(title=plot_title)
We also plot the calculated returns and calculate ...
Read now
Unlock full access