This repository contains Python files that I have created for a Master's course in Asset Pricing / Financial Economics.
The goal is to introduce students to the Python programming language, with a focus on basic data analysis and financial economics applications.
It is recommended to work through the files in the following order:
-
introduction.py (Introduction to Python, Pandas, and NumPy)
-
yfinance.py (Yahoo finance package for financial data, Introduction to dictionaries)
-
regressions.py (Financial data cleaning, Realized Variance and GARCH, CAPM, Fama-French factor model)
-
portfolioopt.py (Minimum Volatility, Max Sharpe Ratio Portfolio Optimization, Efficient Frontier) - 'portfolio.csv' dataset is used in this script
-
time_series_analysis.py (Testing for stationarity, Forecasting with ARIMA model) - 'portfolio.csv' dataset is used in this script
-
regularization.py (Regularization techniques: Ridge, Lasso) - 'data_ML.csv' dataset is used in this script
Companion slides for the regularization script can be found here
Two datasets are required to work through the scripts in this repository:
- portfolio.csv (This file can be found directly in the repository.)
- data_ML.csv (Due to the its large size (~ 100MB), this file is not included in the repository. It can be downloaded from my Dropbox here.)
Make sure you have these libraries installed:
- arch
- matplotlib
- numpy
- pandas
- pandas_datareader
- pypfopt
- seaborn
- sklearn
- statsmodels
- yfinance
TODO:
- requirements.txt
- edit regularization.py