-
Notifications
You must be signed in to change notification settings - Fork 0
Implement Fama-French Factor Model #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@CameronBeneteau I am working on the OOP version of this as well. Can I make a ticket for it once this is accepted? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great so far @JeremyOrr4, just a few deprecation warnings to fix if they're quick and easy. I'm good if you keep this file and add a file for the OOP version in this PR.
The main things I want to see from OOP are:
- Custom input ticker
- Custom input start/end dates (yyyy-mm-dd)
- Custom input list of factors (you can assume they will be in the CSV columns because we will be calculating/storing them separately)
OOP version should work with any combination of this set of inputs.
Also not sure if you prefer notebooks (.ipynb) or Python files (.py) for development. I'm good with either as long as it's easy to follow and we can clearly see the steps. I almost want to say notebooks might be better for the time being just so we can see intermediate steps and calculations, but up to you.
|
Yeah for your comments I agree with the shift to notebook. I'll make that change and fix the deprecations. Also sounds good, I will keep the branch open and work on the newer version with what you mentioned. I think I will create a src folder for it as well |
|
@CameronBeneteau I have the basic OOP and functionalities requested. I still have some minor code improvements and ideas of what to add but we can chat at weekly meeting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert this committed file
| .venv | ||
| .venv | ||
| .vscode/ | ||
| venv/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add __pycache__ to this (make sure it's global for any folder/directory)
| start_date = "2006-01-01" # Start date for the analysis (format: YYYY-MM-DD) | ||
| end_date = "2023-12-31" # End date for the analysis (format: YYYY-MM-DD) | ||
| ff_data_path = "../data/F-F_Research_Data_Factors_Jer.CSV" # Path to the Fama-French factors CSV file | ||
| factors = ["Mkt-RF"] # List of factors to include in the regression (e.g., "Mkt-RF", "SMB", "HML") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Show an example workflow on how to run
python3 -m .venv venv
source .venv/bin/activate
etc...
python3 main.pyComments at the end of lines here look funny, maybe do something like:
ticker: The stock or ETF ticker symbol (e.g., "QQQ" for the Nasdaq-100 ETF)
etc...
| ticker = "QQQ" | ||
| start_date = "2006-01-01" | ||
| end_date = "2023-12-31" | ||
| ff_data_path = "../data/F-F_Research_Data_Factors_Jer.CSV" | ||
| factors = ["Mkt-RF"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can these be passed as CLI arguments instead? Default values can be these, though.
Example: https://github.com/DFIC-Quant-Fund/Fund-Monitor/blob/main/Portfolio.py#L206
| regression.run_fama_fetch() | ||
|
|
||
| if __name__ == "__main__": | ||
| main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't call main() in here, remove the function and put logic here, will make it easier to read CLI params.
Closes #1
Added my example of the fama-fetch tutorial