Stock Portfolio Tracker - The Portfolio History Feature | Investment Moats Skip to Content

Stock Portfolio Tracker – The Portfolio History Feature

For newer readers, you might not be aware that I do share my current portfolio on my blog.

You can take a look at My Current Portfolio.

The tables are published from a Stock Portfolio Tracker, which is based off Google Spreadsheet.

It is FREE and to use it, you can read the instructions here.

This stock portfolio tracker is suitable for you if:

  1. You are more of a buy and hold investor
  2. Wants to track your portfolio based on transactions (buy, sell, dividend, bonus shares, rights issues, capital reductions)
  3. Auto-updates prices for stock exchanges supported by Google and Yahoo
  4. Familiar with how to use spreadsheets
  5. Likes to DIY

In the last few months, I added a feature called Portfolio History to it. Portfolio history simply takes the daily portfolio summary snapshot and archive it so that you can review it in the future.

Stock Portfolio Tracker - Portfolio History

Data from Portfolio Summary gets ported to Portfolio History (click to view larger image)

This is quite easily done in that you could create a system that:

  1. Every night after dinner, you review your portfolio
  2. Type each entry porting the information over from the Portfolio Summary

Then you can have very nice looking charts like this:

Of course, I made the spreadsheet auto-copy the data over to Portfolio History.

Here is how.

The Auto-Copy at Night Feature Explain

Google spreadsheet allows you to run some script in the background. What is nifty about this is that you can set a timer when some of these functions are triggered.

So what I did was to

  1. create a function that copy the live data from Portfolio Summary to Portfolio History
  2. set a trigger to run this function every 1 am for example

For those of you with the new sheet, you will need to manually set #2 (set the trigger to run nightly or in the day if you prefer)

For those of you with an existing version of Stock Portfolio Tracker, you will need to

  1. add the Portfolio History sheet to your existing Stock Portfolio Tracker
  2. copy the functions over to your existing Stock Portfolio Tracker
  3. set the trigger to run the function

Step 1: Add the Portfolio History sheet

For folks with the existing spreadsheet, you need to add the Portfolio History sheet.

First make a copy of my existing version of spreadsheet. You can do this by going to File > Make a copy (don’t use the Share function on the top right side)

When you click on the Portfolio History > Copy to…..

Secondly,search for your existing Stock Portfolio Tracker and add this Portfolio History to it.

Third, clear my data on the Portfolio History you have copied over to your version of Stock Portfolio Tracker. You do not need my history. You will be populating your own portfolio history.

Step 2: Add the Functions from My Version of Stock Portfolio Tracker to Your Stock Portfolio Tracker

This is for people with an existing older version of Stock Portfolio Tracker.

We will need to port the functions from the script editor to your current Stock Portfolio Tracker.

First, at MY version of Stock Portfolio Tracker, launch the Script Editor by going to Tools > Script Editor…

Second, do the same for YOUR version of Stock Portfolio Tracker. Be careful, recognize which tab is my version and which is your version.

Third, copy the Global Variables section from My version of Script Editor to YOUR version of Script Editor.

Fourth, copy the function copyLivePortfolioDataToHistory() from MY version to YOUR version.

Do note that the whole function starts from function copyLivePortfolioDataToHistory(){ to the closing bracket }.

Fifth, click the save button on YOUR version of script editor to save the function.

Step 3: Set the Trigger to run at Periodic Interval

This step should be done if you have MY version or you are using an existing older version.

First, select the function copyLivePortfolioDataToHistory in the drop down next to the bug icon.

Second, click on the clock icon which lets us set the triggers.

Third, Click on the link “No triggers set up. Click here to add one now”

Fourth, we set the permutations when this function will run.

I prefer to set it to run daily, so I select Day timer, and then I select the interval to run. I run mine at 1 to 2 am.

Fifth, click the Save button below.

Step 4: Test your Script

To see if your script is running properly, we click the Run button when copyLivePortfolioDatatoHistory is selected.

You should see a new row populated. Your charts should be updating as well. somehow Row 2 seems to be always empty. If you have a solution do let me know.

That’s it

If you need more help

I hope that you will find this functionality addition useful.

It is my wish that you guys take this spreadsheet and go crazy with it. If you are new to spreadsheet, treat playing around with it as an experience gain.

If you need help porting, even after this guide, my support is open at [email protected].

I do levy a support charge of USD10.00 through Paypal. Email me and I will guide you through the details.

REITs: How can Cash Flow be Artificially Boosted to Give Higher Dividends
← Previous
Optimizing Money on Food, Killing the Hunger Monster, Feeling Full and Insulin Resistance
Next →

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This site uses Akismet to reduce spam. Learn how your comment data is processed.