Skip to main content

Stock Portfolio Tracker Dashboard With Google Data Studio

In the series of building personal stock portfolio tracker, we have learned how to use Google Sheets to register transactions. We have then used the pivot table and GOOGLEFINANCE function to compute the latest position of the stock portfolio. We have made a step further to use Apps Scripts to compute automatically and daily the stock portfolio's evolution. However, after all, we have several tables of data as the result which do not tell any story yet. We need to present those data in graphs to understand the portfolio's performance and make improvements accordingly. We can effectively plot graphs in different aspects directly in Google Sheets as it provides many charting tools. However, in my experience, having charts and data in the same spreadsheet is not very convenient because charts and tables tend to overlap each other and of lack of interactivity. We should have a dedicated dashboard to have an overview of the stock portfolio and we can do it greatly with Google Data Studio.

Google Data Studio connects to Google Sheets to fetch data stored in spreadsheets and then to visualize those data into an interactive and beautiful dashboard. You can think of this solution as a separation of concerns:

  • Google Sheets plays the role of a database to the stock portfolio tracker. We will insert new transactions into it over time. We use built-in functions like GOOGLEFINANCE, pivot table, Apps Script, etc. to compute the position and evolution of the portfolio.
  • Google Data Studio plays the role of a graphical user interface to our stock portfolio tracker. It connects to the database, collects the prepared data, and visualizes them interactively and beautifully. It synchronizes closely with changes in the database.

In this post, I will show you how to create your own dashboard to monitor your stock portfolio using Google Sheets and Google Data Studio.

Free, easy, interactive, beautiful, real-time, no-installation-needed, and personal stock portfolio tracker

Create a report and connect data sources to spreadsheet

Google Data Studio provides a connector to Google Sheets which allows you to browse your spreadsheets and select exactly which sheet of a spreadsheet you want your report to access. You can connect many sheets to one report.

  • Make a copy of the spreadsheet presented in this post Demo stock portfolio tracker with Google Sheets
  • Create a new Blank Report from your Google Data Studio home page
  • Connect to the Transactions sheet as a data source for the report
    • Select the Google Sheets as the connector
    • In the Spreadsheet column, select the one that you copied at the first step
    • In the Worksheet column, select the Transactions sheet
    • Click Add button
    • Confirm Add To Report

How to connect Google Data Studio data source to Google Sheets
  • Do it again to connect also Positions and Evolutions sheets as data sources for the report
  • From the top menu, select Resource > Manage added data sources, we will have 3 data sources as shown in the picture below
Configure data sources for the stock investment tracker dashboard in Google Data Studio

Create indicators with Scorecard

As a smart investor, you might want to know how much your stocks currently worth at a quick glance. You can do it with scorecards:

  • From the top menu of the report, select Insert > Scorecard
  • Select Positions as the data source for this scorecard
  • Select SUM Market Value as the metric for this scorecard
  • We will have a scorecard Market Value displaying the total value for stocks owned in the portfolio as shown in the sample report above.

As a smart investor, you might want to know how much money has been invested in the portfolio at a quick glance. You can do it with scorecards and filters:

  • From the top menu of the report, select Insert > Scorecard
  • Select Transactions as the data source for this scorecard
  • Select SUM Amount as the metric for this scorecard. Rename the metric as Invested Money
  • We only take into account the transactions of types DEPOSIT and WITHDRAWAL to calculate the Invested Money. At the Filter > Scorecard Filter section, add a filter, and configure it as in the picture below.
How to create a filter in Google Data Studio

  • We will have a scorecard Invested Money displaying the total value for stocks owned in the portfolio as shown in the sample report above.
How to create scorecards in Google Data Studio

As a smart investor, there are many other indicators that you might like to track. Can you create scorecards for those indicators?

  • How many stocks are there in the portfolio?
  • How much free cash is available in the portfolio?
  • How much dividend is accumulated in the portfolio?
  • How much is the current gain / loss in the portfolio?
  • How much is the current gain / loss compared to the invested money in the portfolio?

Track portfolio's evolution with Time series

As a smart investor, you might want to track the portfolio's value as well as gain / loss over time. You can do it with a time series chart with 2 series: one for the Gain on the right axis and one for the Portfolio Value on the left:

  • From the top menu of the report, select Insert > Time series
  • Select Evolutions as the data source
  • Select Date as Date Range Dimension
  • Select Date as Dimension
  • Select SUM Portfolio Value as the Metric
  • Add the second metric and select SUM Gain for it
  • Switch to the Style tab
  • In the General section, select Linear Interpolation for Missing Data
  • If the Gain and Portfolio Value can not be on the same scale, one can be plotted on the left axis, other can be plotted on the right axis.
How to create a time series chart in Google Data Studio to track stock investment portfolio

As a smart dividend investor, you might want to track the dividend earned over time, by month, and by year. You can do it with a cumulative time series and drill down option:

  • From the top menu of the report, select Insert > Time series
  • Select Transactions as the data source
  • Select Date as Date Range Dimension
  • Select Date as Dimension
  • Click then the edit button and select Year Month for Granularity
  • Activate the Drill down to have options of plotting by month and also by year
  • Select SUM Amount as Metric
  • Rename the metric as Dividend
  • Create a filter to select only transactions of type dividend and add the filter into Time series filter in the Filter section
  • Switch to the Style tab
  • Select Cumulative for the Series #1
How to create a time series chart in Google Data Studio to track earning dividend of a stock investment portfolio

As a smart investor, you might want to track the invested money over time, by month, and by year? Can you do it?

Monitor distribution of the portfolio with Bar chart

As a smart investor, you might want to compare the Cost and the Market Value among stocks of the portfolio. You can do it with a bar chart:

  • From the top menu of the report, select Insert > Bar chart
  • Select Positions as the data source
  • Select Symbol as the Dimension
  • Select SUM Cost and SUM Market Value as the Metric
How to create a bar chart in Google Data Studio to manage a stock investment portfolio

As a smart investor, you might want to compare the Capital Gain % and Yield % among stocks of the portfolio. Can you do it?

Monitor dividend earnings by month and by stock with Pivot table

As a smart dividend investor, you might want to know the distribution of dividends by month and by stock. You can do it with a pivot table whose columns are months of year and rows are stocks presented in your portfolio:

  • From the top menu of the report, select Insert > Pivot table
  • Select Transactions as data source
  • Select Date as Date Range Dimension
  • Select Symbol as Row dimension
  • Select Date as Column dimension
  • Click then the edit button and select Month for Granularity
  • Select SUM Amount as Metric
  • Rename the metric as Dividend
  • Check Show Grand Total for both Rows and Columns in the Totals section
  • Select Dividend and Descending for Row #1 in the Sorting section
  • Select Month and Ascending for Column #1 in the Sorting section
  • Create a filter to select only transactions of type dividend and add the filter into Time series filter in the Filter section
  • Switch to the Style tab
  • Select Heatmap for the Metric #1
How to use pivot table in Google Data Studio to keep track of earning dividend of a stock investment portfolio

As a smart investor, you might want to know the distribution of invested money by month and by year. Can you do it?

Interact with reports

As I mentioned earlier, with Google Data Studio, you can create a dashboard that is not only beautiful but also interactive. What I mean by an interactive dashboard is the ability to control dynamically which data used to display. With Google Data Studio, you have many ways for adding interactions to your dashboard.

Drill down

If your data is hierarchical, drill-down allows users to switch dynamically between levels of that hierarchy. For example, we can say transactions in a stock portfolio are hierarchical data by time because we can explore those data by year, by month, or even by date. As you have already added the drill-down option into your dividend and invested money time series above, let's see what it actually looks like.

How to use drill-down to switch between month and year on a time series chart in Google Data Studio to manage a stock investment portfolio

Date range, filter control, data control

So far, you have created several filters and add them to your chart. Those filters are fixed by the report's creators and viewers can not change them. However, Google Data Studio provides also filters that can be controlled by viewers of the report. They are Filter control, Date range (a special type of filter control), and Data control.

As a smart investor, you might want to know the performance of your portfolio during a specific period. You can do it by adding a Date range control to your report:

  • From the top menu of the report, select Insert > Date range
  • You can select the Default date range as you prefer or let it be the Auto date range as default

You can change then the date range to see the performance of your portfolio last year, last quarter, or last month.

How to use date range control in Google Data Studio to manage a stock investment portfolio

Chart as a filter control

Another interesting thing about Google Data Studio is that you can use directly a chart or a table as a filter control. This feature makes your dashboard very interactive. As a smart investor, you might want to see the performance of not only your portfolio as a whole but also each individual stock. You can do it by checking the box Apply filter in the Interactions section of each chart or table that you want to use as a filter control.

How to use cross-filtering in Google Data Studio to manage interactively a stock investment portfolio

Note

To better understand the overall concept, please check out this post Create personal stock portfolio tracker with Google Sheets and Google Data Studio.

References

Disclaimer

The post is only for informational purposes and not for trading purposes or financial advice.

Feedback

If you have any feedback, question, or request please:

Support this blog

If you value my work, please support me with as little as a cup of coffee! I appreciate it. Thank you!

Share with your friends

If you read it this far, I hope you have enjoyed the content of this post. If you like it, share it with your friends!

Comments

  1. Hi, I was wondering if you can help me out with this - I am trying to create a candlestick dashboard on Google Data Studio where I can easily switch to different stock and monitor its price movements using the drop down filers

    My data source is a google sheet of data with the following headers (date/high/low/open/close/volume), with each stock having its own tab within the sheet. This is generated from google finance function.

    However, when I tried to blend data based on date, i get 5 different date metrics (each named after the stock/ sheet tab i named). I ended up having a lot of metrics (date/high/low/open/close/volume) x each stock on Google Data studio.

    I've tried to ask on reddit and the comment i get was to have all 4 stocks on the same sheet, within the same tab. I'm not sure if that is the best way as I intend to add new stocks whenever I need it: https://www.reddit.com/r/GoogleDataStudio/comments/t20a9y/how_to_create_controls_to_see_different_stocks/

    It'd be great if you can advise on how I should approach setting this up on Google data studio. Thank you!

    ReplyDelete
    Replies
    1. Hi,

      If I understand correctly your idea, you want to monitor dynamically price of many stocks and to be able to select a stock within a drop-down selection. It means if you select stock A, it should show the prices chart of stock A. If you select stock B, it should show the prices chart of stock B.

      If that's the case, I think you only need to organize data in only one sheet, instead of having a separate sheet for each stock. So, that only sheet contains the 6 columns that you already have (date/high/low/open/close/volume), plus the column SYMBOL.

      In that case, you don't need to use blend data based on date. You can simply create a drop-down selection based on the column SYMBOL. This drop-down selection should be a single value only, and you should pre-select a default value.

      If you add new stocks to the sheet, they should be available for selection immediately in the Google Data Studio dashboard.

      Let me know what you think of this solution and whether it helps you. If I have time, I can do a tutorial post on it with more details.

      Thanks for stopping by my blog.

      Delete

Post a Comment

Popular posts

Compute cost basis of stocks with FIFO method in Google Sheets

Compute cost basis of stocks with FIFO method in Google Sheets

After selling a portion of my holdings in a stock, the cost basis for the remain shares of that stock in my portfolio is not simply the sum of all transactions. When selling, I need to decide which shares I want to sell. One of the most common accounting methods is FIFO (first in, first out), meaning that the shares I bought earliest will be the shares I sell first. As you might already know, I use Google Sheets extensively to manage my stock portfolio investment, but, at the moment of writing this post, I find that Google Sheets does not provide a built-in formula for FIFO. Luckily, with lots of effort, I succeeded in building my own FIFO solution in Google Sheets, and I want to share it on this blog. In this post, I explain how to implement FIFO method in Google Sheets to compute cost basis in stocks investing.
Use SPARKLINE to create 52-week range price indicator chart for stocks in Google Sheets

Use SPARKLINE to create 52-week range price indicator chart for stocks in Google Sheets

The 52-week range price indicator chart shows the relative position of the current price compared to the 52-week low and the 52-week high price. It visualizes whether the current price is closer to the 52-week low or the 52-week high price. In this post, I explain how to create a 52-week range price indicator chart for stocks by using the SPARKLINE function and the GOOGLEFINANCE function in Google Sheets.
How to convert column index into letters with Google Apps Script

How to convert column index into letters with Google Apps Script

Although Google Sheets does not provide a ready-to-use function that takes a column index as an input and returns corresponding letters as output, we can still do the task by leveraging other built-in functions ADDRESS , REGEXEXTRACT , INDEX , SPLIT as shown in the post . However, in form of a formula, that solution is not applicable for scripting with Google Apps Script. In this post, we look at how to write a utility function with Google Apps Script that converts column index into corresponding letters.
Create personal stock portfolio tracker with Google Sheets and Google Data Studio

Create personal stock portfolio tracker with Google Sheets and Google Data Studio

I have been investing in the stock market for a while. I was looking for a software tool that could help me better manage my portfolio, but, could not find one that satisfied my needs. One day, I discovered that the Google Sheets application has a built-in function called GOOGLEFINANCE which fetches current or historical prices of stocks into spreadsheets. So I thought it is totally possible to build my own personal portfolio tracker with Google Sheets. I can register my transactions in a sheet and use the pivot table, built-in functions such as GOOGLEFINANCE, and Apps Script to automate the computation for daily evolutions of my portfolio as well as the current position for each stock in my portfolio. I then drew some sort of charts within the spreadsheet to have some visual ideas of my portfolio. However, I quickly found it inconvenient to have the charts overlapped the table and to switch back and forth among sheets in the spreadsheet. That's when I came to know the existen
Slice array in Google Sheets

Slice array in Google Sheets

Many functions in Google Sheets return an array as the result. However, I find that there is a lack of built-in support functions in Google Sheets when working with an array. For example, the GOOGLEFINANCE function can return the historical prices of a stock as a table of two columns and the first-row being headers Date and Close. How can I ignore the headers or remove the headers from the results?
GOOGLEFINANCE Best Practices

GOOGLEFINANCE Best Practices

Anyone using Google Sheets to manage stock portfolio investment must know how to use the GOOGLEFINANCE function to fetch historical prices of stocks. As I have used it extensively to manage my stock portfolio investment in Google Sheets , I have learned several best practices for using the GOOGLEFINANCE function that I would like to share in this post.
Stock Correlation Analysis With Google Sheets

Stock Correlation Analysis With Google Sheets

Correlation is a statistical relationship that measures how related the movement of one variable is compared to another variable. For example, stock prices fluctuate over time and are correlated accordingly or inversely to one another. Understanding stock correlation and being able to perform analysis are very helpful in managing a stock portfolio investment. In this post, I explain in details how to perform correlation analysis among stocks in Google Sheets.
How to copy data in Google Sheets as HTML table

How to copy data in Google Sheets as HTML table

I often need to extract some sample data in Google Sheets and present it in my blog as an HTML table. However, when copying a selected range in Google Sheets and paste it outside the Google Sheets, I only get plain text. In this post, I explain how to copy data in Google Sheets as an HTML table by writing a small Apps Script program.
Manage Stock Transactions With Google Sheets

Manage Stock Transactions With Google Sheets

The first task of building a stock portfolio tracker is to design a solution to register transactions. A transaction is an event when change happens to a stock portfolio, for instance, selling shares of a company, depositing money, or receiving dividends. Transactions are essential inputs to a stock portfolio tracker and it is important to keep track of transactions to make good decisions in investment. In this post, I will explain step by step how to keep track of stock transactions with Google Sheets.