Thursday, November 24, 2011
Yahoo Finance Gotcha
While writing scripts to reproduce the returns information on some ETFs, I found a silly gotcha when using data from Yahoo Finance. It turns out that the website and CSV historical quotes information interprets starting dates differently. If one asks for a starting day that is not a business day, the website will also give quote information for the last business day preceding your starting day. The CSV historical quotes has the opposite behavior. If the starting day is not a business day, the earliest quote that the CSV gives is the first business day after your starting day. For example, the earliest quote http://ichart.finance.yahoo.com/table.csv?s=SCHX&a=06&b=31&c=2011&d=09&e=31&f=2011&g=d&ignore=.csv will give is 2011-08-01 whereas http://finance.yahoo.com/q/hp?s=SCHX&a=06&b=31&c=2011&d=09&e=31&f=2011&g=d will give 2011-07-29, with July 31, 2011 (the month in the URL request is also 0-origin so 06 is July) being a Sunday. This is certainly something to watch out for when fine-tuning data collection from Yahoo.
Labels:
API,
finance,
stock market
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.