Long/Short Equity Portfolio Stress Test.
This project will read the weights file for constituents (.csv), download historical prices (store them in a SQLAlchemy Core powered db) and calculate portfolio and benchmark returns.
Once daily return series are obtained, a portfolio beta is calculated and used for stress testing.
Results are currently outputted to a styled web page.
Jinja2
numpy
pandas
pandas-datareader
psycopg2
SQLAlchemy
seaborn
scipy
Install the dependencies with
pip install -r requirements.txt
Also, if it is desired to convert the html output into a pdf, you can do this using wkhtmltopdf.
python src/run_stress_test.py --weights_file example_weights.csv
Your weights.csv
should look like this
ticker,weight
ticker1,0.6
ticker2,0.2
ticker3,-0.4
...
Here's how the visuals would look like: