12.2. Watching Stocks
Nothing changed the stock market quite like the Web. What used to be the domain of financial experts has become something that the everyman can now take part in. Online trading companies like E*Trade have changed the face of stock trading forever. Regardless of this change, the Web is first, and foremost, a vast repository of information, and stock price information is no exception.
12.2.1. Getting Yahoo! Finance Information
While not as feature filled as some Yahoo! premium services, basic stock reporting with Yahoo! Finance can easily be used in any Web application. The 15-minute delay certainly isn't desirable for anyone wanting up-to-the-second information, but this free service could satisfy anyone who wants to casually watch certain stocks during the day.
Yahoo! Finance stock information comes in comma-separated value (CSV) format, and you use the following URL to download information on any stock:
http://finance.yahoo.com/d/quotes.csv?s=stock_symbols&f=special_tags
Stock symbols should be separated by a plus sign (+). There's a host of information available for each individual stock, and you can specify what pieces of information you want with special tags. For example, the URL to get the day's opening price and the last trade's price for Microsoft's and GE's stock would look like this:
http://finance.yahoo.com/d/quotes.csv?s=MSFT+GE&f=ol1
For a complete list of available tags, visit www.gummy-stuff.org/Yahoo-data.htm.
The widget built in this section ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access