Hi everyone, my algorithm would like to automatically extract Fama French factors from the official Fama French website as it updates itself monthly.
I am currently working on it in research environment and am unable to load the fama french factors from the website.
from io import StringIO
csv = qb.Download("https://mba.tuck.dartmouth.edu/pages/faculty/ken.french/ftp/F-F_Research_Data_Factors_CSV.zip")
# read file (which needs to be a csv) to a pandas DataFrame. include following imports above
# from io import StringIO
# import pandas as pd
df = pd.read_csv(StringIO(csv))
the error i'm getting is: ParserError: Error tokenizing data. C error: Expected 1 fields in line 4, saw 2.
Can someone please help me out with this issue/is there a more efficient way to automatically pull fama french 3 factors as it updates itself monthly?
Shile Wen
Hi John,
The file is zipped, so reading it into QuantConnect is not possible. To use these files, we would first need to unzip them, then upload the files to a remote file sharing service, such as Dropbox or Github, before reading it in using custom data. If you'd like to use files uploaded already, which we may update periodically in the future, please see this repo.
Furthermore, we have a few Fama French strategies implemented, and they can be found in this thread.
Best,
Shile Wen
EpsilonOcean
Hi Shile Wen, I've unzipped and uploaded but am still getting the same error as above. Any ideas?
Shile Wen
Hi EpsilonOcean,
Please provide the new url as well as the updated backtest/code.
Best,
Shile Wen
John Fogel
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!