Great resources to get started/ refer:
Steps
- Create a .pgpass file to store username and password
- pip install wrds
- Establish connection via
wrds.Connection() - The easiest way to look at the data is to go to WRDS SAS Studio.
- Get the variable schema of any table on SAS studio:
proc contents data= crsp.dsf;
run- Sentiment file: Provide link here Notes:
- As of July 202, Compustat no longer has S&P Dow Jones Indices. Access it through CRSP.
- For data after February 2025, you will need to change the data tables to their "*_V2" counterpart.
- Plotting styles
- Feature importance : Permutation importance not the normal feature importance. Used mean decrease in accuracy instead of mean deacrease in impurity according to simonian 2019 sklearn formula
query.sql -> data -> preprocessing.ipynb & data_prepro.py -> models_expl & models -> sector_rot.py and sector_rot ->portfolio_trade.py & test_portfolio
© Minh Quang Ngo 2025. All rights reserved.
This repository is provided for viewing and discussion purposes only. No license is granted for reuse, reproduction, or distribution of the code contained herein. Contact the author for permission regarding any use outside of this repository.
