
So here's what my program produces - the performance of my portfolio so far. The numbers represent the percentage that I'm up or down (or just down in this case...). As you can see, it's been a rocky ride (RBS has been a fun investment to have) :o) Luckily I'm in it for the long term, so I'm not fazed by the short term fluctuations... honest.
All I have to do is maintain a text file with all of my transactions, with dates, prices, quantities, etc.. and my Python script pulls the relevant data from Yahoo Finance, squirts everything into a CSV file, and then Excel produces the graph.
Hopefully things will be more meaningful when I have more datapoints. At the moment it's just a bit of fun.
Here's the Python, and a sample list of transactions:
http://www.danieltebbutt.com/stocktrack.py
http://www.danieltebbutt.com/portfolio.txt
To run, place both in the root of C:\ and make sure you have Python installed. Then just run "python stocktrack.py". It will produce performance.txt in the root of C:\, and I'll leave it to you to figure out how to import that into Excel. It contains comma-separated values: DATE,PROFIT (£ net profit),VALUE (£ total value of portfolio)
I've got a batch job with an icon on my desktop that runs the python script and then loads my spreadsheet, which automatically refreshes the data and displays the graph.
No comments:
Post a Comment