Herron Topic 5 - Practice Blank

FINA 6333 for Spring 2025

Author

Richard Herron

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pandas_datareader as pdr
from scipy.stats import norm # new addition for Monte Carlo methods
import warnings # to suppress the pandas_datareader warning
import yfinance as yf
%precision 2
pd.options.display.float_format = '{:.2f}'.format
# %config InlineBackend.figure_format = 'retina'

Announcements

Five-Minute Recap

Practice

Estimate \(\pi\) by simulating darts thrown at a dart board

Hints: Select random \(x\)s and \(y\)s such that \(-r \leq x \leq +r\) and \(-r \leq x \leq +r\). Darts are on the board if \(x^2 + y^2 \leq r^2\). The area of the circlular board is \(\pi r^2\), and the area of square around the board is \((2r)^2 = 4r^2\). The fraction \(f\) of darts on the board is the same as the ratio of circle area to square area, so \(f = \frac{\pi r^2}{4 r^2}\).

Simulate your wealth \(W_T\) by randomly sampling market returns

Use monthly market returns from the French Data Library. Only invest one cash flow \(W_0\), and plot the distribution of \(W_T\).

with warnings.catch_warnings():
    warnings.filterwarnings("ignore", category=FutureWarning)
    ff3 = (
        pdr.DataReader(
            name='F-F_Research_Data_Factors',
            data_source='famafrench',
            start='1900'
        )
        [0]
        .div(100)
    )
ff3.head()
Mkt-RF SMB HML RF
Date
1926-07 0.03 -0.03 -0.02 0.00
1926-08 0.03 -0.01 0.04 0.00
1926-09 0.00 -0.01 0.00 0.00
1926-10 -0.03 -0.00 0.01 0.00
1926-11 0.03 -0.00 -0.01 0.00

Repeat the exercise above but add end-of-month investments \(C_t\)