Skip to content

akulaarora/My-All-Weather-Strategy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Akul's All Weather Strategy Implementation (Quick Design Doc)

Links

Whitepaper

Portfolio Visualizer

Portfolio Visualizer (Long-term; substituted some of the asset classes)

How to deploy this

Prerequisites

  • Docker and docker-compose

Steps

  1. Pull this repository.
  2. Create a folder in Python called DONOTPUSH with file api_keys.py. Add AV_KEY="<YOUR ALPHAVANTAGE KEY>".
  3. Set up a cronjob to run this. See example crontab provided.
  4. 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.

How this Works

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.

Docker environment

Python script that is the brains of the strategy. Does the following:

  1. Pulls any changes to set up from Github repository.
  2. Pulls financial data.
  3. Computes how the portfolio would have performed that day.
  4. Handles any rebalancing of portfolio to achieve set allocation.
  5. Pushes latest data to database.
  6. 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.

Cronjob manager

Cron job manages docker environment. Runs script every weekday at 2pm PST (one hour after market close to get data for the day).

  1. Will pull the latest changes from git.
  2. Starts Docker
  3. Runs environment to get data.
  4. Shuts down environment and turns off docker.

InfluxDB inforomation stored

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

Web server

TODO

Services used

Alphavantage - financial data

Docker - container

Azure - hosting server Github - website hosting

Further work

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.

Notes

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published