Portfolio Analysis Tool


(Simran Cashyap) #1

Building on some of the great discussions in the Google Portfolio Tracking thread, I wanted to be able to see a little more detail than Google Sheets would allow me.

I decided to build something more advanced, so I spent some time over the weekend coding up some ideas. Here is the latest version:

The code is written in Python and is runnable as frequently as required to create a Portfolio Overview. The only input is a CSV file of transactions (prices come from Yahoo Finance), and the output is a PDF file (as shown above).

Although this is very early stage and has lots of known limitations/improvement ideas (dividends not included, cash management, top positions, new analytics - volatility, sharpe, drawdown, etc). I’d love to get any feedback, or if anyone has any mock portfolios they can send - that could be useful to test with.

I will be open sourcing the code and hopefully packaging it up as a tool for anyone else who wants to download and use.


(Vladislav Kozub) #2

This is a great piece of work, Simran! Reminds me of WeBull a little bit, with a benchmark line and sector distribution.

How is the benchmark identified though? Is it just one of the major indexes or a customisable entity, such as S&P 500, DJI, FTSE, etc., for users to choose themselves?

Another interesting aspect to have would be a monthly performance summary with comparison to the benchmark. For example (assuming we are in April now):

Jan 2019 Feb 2019 Mar 2019 Apr 2019 Overall
Portfolio 1.20% -1.40% 1.90% 6.50% 108.29%
Benchmark 1.70% -1.35% 2.08% 4.30% 106.82%

This way you can check trailing monthly deviation against the benchmark, as well as see how the portfolio performed overall for yourself and the benchmark. In your case, you may be interested to see what went wrong with your benchmark (or went well with the portfolio) in June 2018 so that you outperformed it by circa 50%.

I am not sure how useful that is for others, but I would definitely find it convenient. Splendid work anyway! :slight_smile:


(Joseph Goh) #3

Continuing the discussion from Portfolio Analysis Tool:

That’s great work simran. Will be great if you could share the source code and will happy to contribute to improve the algorithm.


(Simran Cashyap) #4

Thanks for the feedback @Vlad

Currently, the benchmark is a customisable index, which can be changed. In the future, I’d love to enable composite benchmarks (e.g. 50% S&P, 50% Bond Index). But this is something for later once the basics are sorted.

Totally agree with the performance summary, I’ve got it on my future feature list.

@josephgoh - I will share a link to the code soon - I just want to clean up a couple of things first!