ndfred / cad_factor_regression_analysis Goto Github PK
View Code? Open in Web Editor NEWThis project forked from btwarwick/cad_factor_regression_analysis
A limitation of the factor regression available on portfoliovisualizer.com is that it does not take FX into account. To address this, I have developed a python module that considers the CAD:USD data when performing a regression analysis on securities listed on the Toronto Stock Exchange (TSX). For Canadian Equities listed on the TSX run CDN_listed_CDN_Equity.py. For US Equities listed on the TSX run CDN_listed_US_Equity.py. US equities are analyzed using the Fama-French 5 factor model using the daily data. Canadian equities are analyzed using AQR data for MKT-RF, SMB, HML(FF), QMJ, and UMD (FF data not available for Canada). For comparative purposes, the file US_listed_US_Equity replicates the results from portfoliovisualizer.com for US listed US Equities analyzed using the FF 5-factor model with daily data. X, Custom_start_date, and Custom_end_date can be modified as required by the user. If the user does not wish to enter a custom start or end date, a value of zero will use the longest dataset possible. Prior to running the scripts, the following lines of code must be executed if their respective packages have yet to be installed: pip install pandas pip install numpy pip install DateTime pip install statsmodels pip install urllib3 pip install zipfile37 pip install investpy pip install yfinance Prior to running the CDN_listed_CDN_Equity.py script for the first time, run importAQR_QMJ.py to download the AQR dataset onto the local hard drive. Once the dataset is downloaded, the importAQR_QMJ.py script is not required to be executed unless updated data is required.