Tired of going click-click when trying to upload your stock purchases on Google Finance? This repository aims at reducing the manual work required to populate the portfolio(s) in Google Finance UI by reading from CSV/TSV files.
Demo Video:
demo.mov
- Fill up the contents of
data/portfolio.csv
file with the links to the portfolios with their names. Example:
Group_Name,Group_Link
# Comments are included like this with # in beginning of line
group1, https://www.google.com/finance/portfolio/<groupUUID1>
group2, https://www.google.com/finance/portfolio/<groupUUID2>
group3, https://www.google.com/finance/portfolio/<groupUUID3>
-
The value in
Group_Name
you provide in the file does NOT need to be the same as how the portfolio is called. -
To find the UUID for the group, navigate to the portfolio in the UI and find the 32-character long identifier in the address bar when the portfolio is open.
-
Fill up the contents of
data/stonks_*.tsv
file. You can choose to have one file to contain all your data, or you can define your data across multiple files. All the data present in the TSV files would be added to your Google Finance Portfolio. Example:
Symbol Action Date Units Price/unit Currency Group
# Comments are included like this with # in beginning of line
AMZN BUY 2022-01-01 1.234567 97.76 USD group1
AMZN BUY 2023-01-01 2.345678 99.02 USD group2
AMZN SELL 2024-01-01 3.456789 95.86 USD group3
-
Note that
Action
can only be either ofBUY
/SELL
. -
Note that the values in
Group
column are a subset ofGroup_Name
values we defined indata/portfolio.csv
file. -
We use venv to install the dependencies as follows:
python -m venv venv;
source venv/bin/activate;
pip install -r requirements.txt;
- With the data filled in, run the program as follows:
python main.py --email <your_email_here> --password <your_password_here> \
--directory <link_to_data_directory>
-
In case MFA is enabled in your account, add
--mfa
switch to your run. It will insert a 30s wait period which will allow you to finish the MFA for logging in. -
You can specify if you want to input data only based on the date of transaction:
- To only input data after a certain date, use
--start_date
switch - To only input data before a certain date, use
--end_date
switch - To limit input data between a date range, use both switches together
- To only input data after a certain date, use
-
You can limit if you want to input data for just one trade symbol. To do that, specify the symbol using
--symbol
switch. -
You can also limit if you want to input data for just one portfolio. To do that, specify the symbol using
--group
switch. -
You can use all the switches in conjunction with each other to fill the data as you want.
-
The error messages about the stocks that couldn't be bought would be displayed as log messages.
-
The script doesn't sell any stocks and will log which stock needs to be sold off.
Open an issue here.