How to do it...

Execute the following steps to estimate the ARCH(1) model.

  1. Import the libraries:
import pandas as pdimport yfinance as yffrom arch import arch_model
  1. Specify the risky asset and the time horizon:
RISKY_ASSET = 'GOOG'START_DATE = '2015-01-01'END_DATE = '2018-12-31'
  1. Download data from Yahoo Finance:
df = yf.download(RISKY_ASSET,                 start=START_DATE,                 end=END_DATE,                 adjusted=True) 
  1. Calculate daily returns:
returns = 100 * df['Adj Close'].pct_change().dropna()returns.name = 'asset_returns'returns.plot(title=f'{RISKY_ASSET} returns: {START_DATE} - {END_DATE}')

Running the code generates the following plot:

In the plot, we can ...

Get Python for Finance Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.