Portfolio Visualizer (Long-term; substituted some of the asset classes)
- Docker and docker-compose
- Pull this repository.
- Create a folder in Python called DONOTPUSH with file api_keys.py. Add AV_KEY="<YOUR ALPHAVANTAGE KEY>".
- Set up a cronjob to run this. See example crontab provided.
- Use docker compose to set up the containers.
- This will also run on the first crontab iteration, so this is not totally necessary. You can use this to test and ensure everything works as it should.
Deployed in Docker container on Microsoft Azure server:
TODO: Will create a web server to show output. Right now, I am just storing to the database.
Python script that is the brains of the strategy. Does the following:
- Pulls any changes to set up from Github repository.
- Pulls financial data.
- Computes how the portfolio would have performed that day.
- Handles any rebalancing of portfolio to achieve set allocation.
- Pushes latest data to database.
- Updates website. TODO
JSON file that contains the strategy (allocations and how to rebalance).
InfluxDB database that stores timeseries data of how the strategy performed each day.
File containing API keys.
- Untracked from Git, so I don't accidentally my logins public.
Cron job manages docker environment. Runs script every weekday at 2pm PST (one hour after market close to get data for the day).
- Will pull the latest changes from git.
- Starts Docker
- Runs environment to get data.
- Shuts down environment and turns off docker.
Time, current balance, balance of each asset in portfolio, stock price of each asset in portfolio
- Current balance is from a starting amount of $1 in the database.
- Measurements: price -> stock prices; balance -> asset balance
TODO
Alphavantage - financial data
Docker - container
Azure - hosting server Github - website hosting
Step 1 of Python script. It would be nice if I can make a change and it automatically updates.
- Cannot figure out how to pull in Python. Alternative is to add a bash script that runs with login info.
Only run cron job on weekdays that market is open (ignore holidays).
Check for stock splits.
Store more data to server than just the performance of the portfolio.
- Individual stocks performance
Display more information on the webpage.
This is a rough project that I put together for fun. Don't treat this as a representation of what production-level/industry work I do is like.