January 2020
Beginner to intermediate
432 pages
11h 24m
English
Follow these steps to implement the four- and five-factor models in Python.
import pandas as pdimport yfinance as yfimport statsmodels.formula.api as smfimport pandas_datareader.data as web
RISKY_ASSET = 'AMZN'START_DATE = '2013-12-31'END_DATE = '2018-12-31'
# three factors df_three_factor = web.DataReader('F-F_Research_Data_Factors', 'famafrench', start=START_DATE)[0]df_three_factor.index = df_three_factor.index.format()# momentum factordf_mom = web.DataReader('F-F_Momentum_Factor', 'famafrench', start=START_DATE)[0]df_mom.index = df_mom.index.format()# five factorsdf_five_factor = web.DataReader('F-F_Research_Data_5_Factors_2x3', ...Read now
Unlock full access