I am using Yahoo Finance API (http://download.finance.yahoo.com/d/quotes.csv?s=...
) to get information for a client's site.
I am wondering if anybody knows how to get the Performance Data
using the api?
It's on the mid, right-hand-side of (https://au.finance.yahoo.com/q?s=KROO for example) eg, "YTD Return", "3yr AVG Return", etc
I have build the PHP myself and am using this page (http://www.jarloo.com/yahoo_finance/) for the data variables. I have tried Google search and Yahoo dev section but can't find anything.
Will be very grateful if anyone can help!
Right, so I've done it! Thought I'd explain as it took me so long to figure out and others may be in the same boat.
You can get CSV historical results through Yahoo Finance using a different link:
http://ichart.yahoo.com/table.csv?s=KROO&a=11&b=31&c=2013&d=3&e=30&f=2014
a/b/c = month(-1)/day/year FROM
d/e/f = month(-1)/day/year TO
I was struggling to get the same result as Yahoo until I noticed that Yahoo Finance only calculates their YTD return based on the end of the last month (so it's really a YTM!)
This is how I have done it and I get exactly the same as Yahoo Finance. Tested on a few codes.
$ytd = $t - $f;
$ytd = $ytd / $f;
$ytd = $ytd * 100;
return $ytd;
In this instance:
$f
is the close price from the 31st Dec the previous year
$t
is the close price from the last day of last month
For the application I am using this for I will be just calculating using the current price, rather than the last month's closing price as I feel that this would be a true YTD.
Good Luck!