After you clone the repository
- Create a ./data folder within this folder
- Within the data folder, we need two files:
- starting_positions.csv represents the positions you hold at the beginning. It has 4 columns
- Symbol
- Quantity (number of shares)
- Cost Basis (total money you spent to buy those shares)
- Account (name of the account where you hold these)
- trades.csv represents the trades you're going to make now. This has 6 columns
- Date
- Action (this can be 'Buy', 'Sell', or 'RSU')
- Symbol
- Quantity (number of shares bought, sold or granted)
- Price (per share)
- Account (where you made the trade)
- starting_positions.csv represents the positions you hold at the beginning. It has 4 columns
- Now run
python fetch_price_history.py fresh. This will create a prices.csv file in the /data folder with price history of all stocks that are declared in starting_positions.csv and trades.csv. - Create a ./artifacts folder within the main folder
- Run
python render_portfolio.py ytdto see your YTD performance. It also accepts "month", "week", and "quarter" as arguments. It will create 3 artifacts in ./artifacts:- A .png with graphs showing day-to-day performance, including comparison with VTI
- A Stocks*.csv that shows performance of individual stocks over this time.
- A Timeseries*.csv that shows the aggregate day-by-day performance.
- Create an email_config.py file in this folder and add the following information:
email = {
'from': 'sender_email_address@gmail.com',
'password': 'password',
'to': 'receiver_email_address@gmail.com',
'smtp_host': 'smtp.gmail.com',
'smtp_port': 465,
}
- Now run
python render_portfolio.py ytd --dest emailand it will send you a nicely formatted email. - To see which lots are at a loss right now, and can potentially be harvested for taxes:
python lot_analysis.py losses --thresh 0.9(lists lots that have lost 10% ot more of their value) - Utility to list which accounts hold a particular symbol:
python lot_analysis.py accounts --sym AAPL - Set up launchd jobs to automate receiving these emails and to update the price history. Check out the /launchd folder in the code repo for examples.