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

Connect the Transactions sheet as data source to the report

  • 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 3 data sources for the report: Transactions, Positions, Evolutions

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.

Filter to keep only transactions of types: DEPOSIT, WITHDRAWAL

  • We will have a scorecard Invested Money displaying the total value for stocks owned in the portfolio as shown in the sample report above.

Sample scorecards with 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.

Time Series for portfolio value and gain

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

Time Series for dividend

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

Bar chart for cost and market value

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

Pivot table for displaying dividend by stock and by month

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.

Use drill-down to switch between month and year on a time series chart

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.

Select date range

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.

Use chart as an interactive filter control

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

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

People also enjoyed…

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

Create a dividend income tracker with Google Sheets by simply using pivot tables

As my investment strategy is to buy stocks that pay regular and stable dividends during a long-term period, I need to monitor my dividends income by stocks, by months, and by years, so that I can answer quickly and exactly the following questions: How much dividend did I receive on a given month and a given year? How much dividend did I receive for a given stock in a given year? Have a given stock's annual dividend per share kept increasing gradually over years? Have a given stock's annual dividend yield been stable over years? In this post, I explain how to create a dividend tracker with Google Sheets. Manage stock transactions with Google Sheets Create dividend tracker with Google Sheets Track annual dividend amount of stocks Track dividend amount by month and by year Track annual dividend per share of stocks Track annual dividend yield of stocks Demo Conclusion References Manage stock transactions with Google Sheets I use a spreadsheet on Goo

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. With the solution in the form of a formula , we don't even need to understand how column index and letters map each other. With apps script, we need to understand the mapping to come up with an algorithm. In a spreadsheet, columns are indexed alphabetically, starting from A. Obviously, the first 26 columns correspond to 26 alphabet characters, A to Z. The next 676 columns ( 26*26 ), from 27th to 702nd, are indexed with 2 letters. [AA, AB, ... AY, AZ], [BA, BB, ... BY, BZ],