Python Script - Load CSV, Calculate Returns, Display Charts


Spent some time this evening to do something quick

Decided to stop at this point, there are many more that can be done to enhance how the output looks, gonna take it easy, leave the rest for next time.

For now, it is just a simple summary table exported to Excel (detailed day-by-day values by tickers interactive dashboard can be created using one of the intermediate outputs in the code).

Would anyone be interested in using python to process the transaction history csv files?

Will spend a few hours myself to write that up. If you guys are interested I’ll put that up to my GitHub page too. Let me know.

Planning to have a script that splits out data table by tickers:
Return in original / gbp + fx impact
Average price after each transaction

Then put together a nice graph with the data.

  • Yes
  • No

0 voters


I’d be happy to work on this with you. My laptop is currently in another country though. I know there are also some users on this forum who have made some nice interfaces for tools like this. Let me see can I find and tag them. Could be a nice group project.

Edit: here are two previous pieces of work. It could be cool to merge Nick’s work into Alex’s work. Then add your features to Alex’s work. Then house the results on a web app somewhere.

Just a thought :slight_smile: Could be cool to do your own thing and start from scratch too.

@nickspacemonkey Home · nickspacemonkey/efficient_frontier Wiki · GitHub



Hello, I am the creator of Python Portfolio Tracker (Github link of the project).

I haven’t coded anything new in that project for almost a year but I would love to collaborate in order to create something better. We can use some of my old code to skip a lot of the tedious stuff (like reading the .csv and performing calculations to find out what the user holds now and at what average price).

@obrienciaran @London_chick If you guys are interested pm me. My code is far from perfect but I have gotten some experience since then and I could probably fix some of the issues I had. The fact that you guys use different currencies than me (Euro) will also help us find and fix problems.


Hey man, thanks for reaching out, I will have a look at what you’ve created :wink:


Is this if any help?

Having a look back, it’s getting more difficult to get data out of google finance or yahoo, and that sheet doesn’t add in dividends, but does the rest you need for TWRR.

1 Like

Looks like you were busy! I’d need a bit of a walkthrough but this looks thorough enough. Certainly enough to draw ideas from.

Seems OP has parked this project for now according to her updated original comment. I might pick this up in the new year as a hobby project and add/consolidate the work done by previous posters here.

This is nice, but I’m really quite annoyed that community has to create Python scripts to see portfolio returns and visualize their holdings. Isn’t it like the very basic functionality to have this kind of stuff without need of 3rd party scripts? Alas what we get is in-app forum where people post ■■■■ memes and pump micro cap ShitCos. Who even asked for that?

1 Like

@rkampas was thinking the same - how difficult can it be for the T212 dev team to build a dashboard tool…
@obrienciaran if you look at the .py file I shared on my GitHub, the code takes transaction csv as input and spits out (1) deposit, withdrawal (2) realised return for closed position (3) number of share and cost per share for open position. My plan is to use yfinance and plotly to generate daily portfolio values. Let me know if you do get that done before me!


Good luck. The difficulty I found with finance was getting the right price based on the ticker.

1 Like

If I recall correctly, it’s relatively easy to connect to Yahoo’s API for this. The pre-req is having some coding knowledge however.

@London_chick I will do! I’ll take a look at this over the next few days.

@London_chick I forked your repository, refactored the code, and opened a pull request on GitHub.

sick guy, merged it now! looks a lot cleaner now, apologies for late reply