Skip to content

Consolidated Investment Portfolio Analytics

wilsonleong edited this page Jan 13, 2022 · 68 revisions

#PortfolioAnalytics #MarketData #FX #Equities #ETFs #MutualFunds #IRR #NAV #PnL #Python #pandas #matplotlib #API #MongoDB #NoSQL

Problem statement

  1. My investment accounts are scattered across different brokers in multiple currencies (GBP, SGD, HKD) due to my employment history.
  2. PAD (Personal Account Dealing) reporting to my employer's Compliance department is manual and very time-consuming.
  3. There is no holistic view of overall performance or composition of my portfolio to aid my investment decisions.

Solution

I built my own portfolio analytics tool that consolidates all my transactions across countries and brokers, connects to Yahoo Finance via API for historical market data (NAV and FX rates), handles the FX conversions, and produces the following output:

  1. consolidated investments with NAV, realised & unrealised PnL in a single currency
  2. calculates my portfolio IRR (internal rate of return) and benchmarks it against S&P 500 index returns over different date ranges
  3. displays consolidated investment cost vs valuation over time in a single currency
  4. displays consolidated PnL over time, break down by dividends and trading PnL
  5. displays composition of portfolio, asset allocation, currency exposure
  6. displays top holdings, their individual performance; and top gainers & losers
  7. automated PAD reporting

Project Kanban Board

URL: https://github.com/wilsonleong/PortfolioAnalytics/projects/1

Example Output

How do I measure whether I'm actually better off (and by how much) managing my own portfolio, than simply buying an ETF that tracks S&P 500 (e.g. SPY)? --> benchmark my portfolio IRR (internal rate of return) against S&P 500 returns

Portfolio Performance

Breakdown of daily fluctuation in portfolio valuation Gainers and Losers

Top Holdings

Top Holdings Performance

Investment Cost vs Valuation

Last 6M PnL

Portfolio Composition

Asset Allocation & Currency Exposure

Product Type Breakdown

Holdings by Fund Manager

Note: Yes I know, MongoDB might be an overkill for this. It was not a technical choice, it's my way to familiarise myself with NoSQL :)