Categories
Fintech

Portfolio Tracker

Back in 2017 Google Portfolios landed on the Google graveyard. It was a smart addition to Google Finance where you could track a portfolio and its performance over time. Even new services and migration offerings sprung up seeing the gap Google left.

If there was one function I miss, it was the interactive portfolio performance graph with benchmarks.

How hard can it be to build a portfolio tracker?

It turns out a simple one is really not that hard once you have Python and Pandas in your tool-belt.

I started with is a set of transactions in Excel.

I wanted to be able to

  • handle cash transactions,
  • handle commissions,
  • report in a foreign currency,
  • plot Google Portfolios like chart,
  • include one or more benchmarks on the chart.

I did not need a web application, so I went with the next best thing – a Jupyter notebook.

Ran Aroussi’s yfinance package for python makes it easy to grab end of day trading data including stock tickers and currency pairs.

Pandas is excellent for dealing with time-series data.

The essence of the approach is

  1. grab end of day trading data, indexed by ticker symbol, and date
  2. overlay transaction data in new columns
  3. cumulative sum the relevant columns

Plotly draws great interactive charts inside Jupyter.

The latest version of the notebook is now hosted on GitHub:designfultech/portfolio_tracker.

What’s next?

I am planning to add portfolio analysis to the notebook, something like pyfolio’s tearsheets from Quantopian.

Leave a Reply

Your email address will not be published. Required fields are marked *