Skip to content

donbowen/portfolio-frontier-streamlit-dashboard

Repository files navigation

What is this?

In a prior year, a team named "Wall Street Bets" (Lana Butorovic, Austen Johnson, Joseph Min, and Ryan Schmid) wrote a web app hosted out of this repo. They used PyPortfolioOpt to plot the efficient frontier and tangency portfolio, and then developed a short quiz to assess the risk aversion parameter for a quadratic utility maximizing investor. With this parameter, they suggested a utlity maximizing portfolio.

Sadly, their site is no longer working because Heroku, where they hosted it, stopped free services. So I'm porting their project here to demonstrate the use of Streamlit for dashboard development and deployment. I've refactored the code in places and added a small tweak to the code to allow for levered portfolios (by shorting the risk free asset).

You can see this dashboard in action here!

How to

If you want to get this app working on your computer so you can use it, play around with it, or modify it, you need:

  1. A working python / Anaconda installation
  2. Git

Then, open a terminal and run these commands one at a time:

# download files (you can do this via github desktop too)
cd <path to your FIN377 folder> # make sure the cd isn't a repo or inside a repo!
git clone https://github.com/donbowen/portfolio-frontier-streamlit-dashboard.git

# move the terminal to the new folder (adjust next line if necessary)
cd portfolio-frontier-streamlit-dashboard  

# this deletes the .git subfolder, so you can make this your own repo
# MAKE SURE THE cd IS THE portfolio-frontier-streamlit-dashboard FOLDER FIRST!
rm -r -fo .git 

# set up the packages you need for this app to work 
# (YOU CAN SKIP THESE if you have already streamlit-env, or you can 
# give this one a slightly diff name by modifying the environment.yml file)
conda env create -f streamlit_env.yml
conda activate streamlit-env

# start the app in a browser window
streamlit run app.py

# open any IDE you want to modify app - spyder > jupyterlab for this
spyder  # and when you save the file, the app website will update

To deploy the site on the web,

  1. Use Github Desktop to make this a repo your own account.
  2. Go to streamlit's website, sign up, and deploy it by giving it the URL to your repo.
  3. Wait a short time... and voila!

Update requests

  1. Easy for me: Add Github action to run update_data_cache.py once a month.
  2. Easy for anyone: The requirements file has no version restrictions. We should set exact versions.

Notes

While it seems duplicative to have a requirements.txt and a streamlit_env.yml, the former is needed by Streamlit and the latter makes setting up a conda environment quickly easy. So keep both.

Releases

No releases published

Packages

No packages published

Languages