Checking your Managed Funds performance with VFP

Posted on September 8, 2004. Filed under: Visual FoxPro |

Checking your Managed Funds performance with VFP

If you like to keep track of how your managed funds are performing you’ve probably used one of the many web sites such as ninemsn to get the latest prices and performance. There’s a stack of them out there, but I find the ninemsn site pretty easy to use. Invariably they all make a call to either Morningstar, Assirt or Van Eyk and you can work out which one you prefer.

eg go to ninemsn and select a few funds to investigate:
http://investor.ninemsn.com.au/investor/funds_mstar/finder.asp

Enter a fund manager eg Colonial Fist State and select the 4 star funds. You’ll get a list with Balanced funds, Developing companies fund etc

Click on the Developing Companies link and you’ll be taken to something like:
http://investor.ninemsn.com.au/investor/Funds_MStar/Profiles/profile.asp?Symbol=4437
which displays the latest prices, performance and a graph

A bit of source viewing will show you that ninemsn calls a web service on the Morningstar site eg
http://www.morningstar.com.au/FundData/Templates/quicktake.xml?Symbol=4437&CountryId=AUS&PrintFlag=true
And yes, it returns it as XML. Too easy. The key really is knowing what the fund number is (ie 4437 in the case of Developing Companies).

But, that can be tedious to go through each time, so what you really want to do is write a quick app to download all your funds for you.
With VFP this is very simple. The following code will give you the idea.

LOCAL nFund, cURL, oXMLHTTP, cString
nFund = 4437
cURL = ‘http://www.morningstar.com.au/FundData/Templates/quicktake.xml?Symbol=’ + TRANSFORM(nFund) + ‘&CountryId=AUS&PrintFlag=true’

oXMLHTTP = CREATEOBJECT(“Microsoft.XMLHTTP”)
cString = ”
oXMLHTTP.open( “GET”, cURL, .F.)

* Retrieve document
oXMLHTTP.send()

* Check HTTP status code returned by the request
IF oXMLHTTP.status # 200
* Call error handler…
ENDIF
cString = oXMLHTTP.responseBody

cString is your XML string of the fund data, which you can load and walk down the nodes to use.
You can play with this and mold it to your liking.
And if you want the nice little graph then the link is very similar:

cGIFURL = ‘http://www.morningstar.com.au/tools/general/tools/AUS_qt_images/’ + TRANSFORM(nFund) + ‘.gif’
…do your download stuff with oXMLHTTP again…
cGIF = oXMLHTTP.responseBody
= STRTOFILE(cGIF, TRANSFORM(nFund) + ‘.gif’)

You can wrap this in your own function and call for each of the funds you are interested in. You just need to work out the fund numbers you need, and this is easy from the ninemsm page.

From here it is not too hard to write an app that automatically retrieves your funds data each day (eg it takes approx 3-4 seconds to download and process 30 or so funds). Before you know it you’ve got a month or two of historical information and the basis for performing some analysis on your funds. A few reports aren’t hard to write either. Take it on your notebook next time you visit your financial planner and see how it compares to his/her suit of expensive analysis tools. Next perhaps you want to develop it into something that allows you to analyse which funds are worth buying…
By the way, you know Morningstar is international right? Next stop, tap into the US funds, but I’ll leave that for another time.

Disclaimer: stick to personal use for this – although the information is freely available (anything unsecured on the web is fair game in my opinion) you wouldn’t want to be using this for anything commercial whereby you sold the data – I’m no lawyer but I reckon there’s a chance you’d be stepping on some copyright toes…

Advertisements

Make a Comment

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Liked it here?
Why not try sites on the blogroll...

%d bloggers like this: