Stock Price Database: A Mini SimpleDB Application

To demonstrate how to query and retrieve information from SimpleDB, we will need a meaningful set of data to work with. In this section we will work through a small application that shows how to load historical stock price information into the SimpleDB service and how to perform queries against this data. Stock prices are a rather dull topic, but because this data is both freely available and contains a range of data types, it will serve our purposes well.

Obtain Historic Stock Price Data

For this application we will need to obtain daily stock price data for a company over a reasonable period, such as for the 2007 calendar year. Such information is available for a number of stocks from Yahoo! Finance at http://finance.yahoo.com. This web site provides daily stock price information that you can download as a comma-separated (CSV) text file which is ideal for automated processing.

To keep things upbeat, let us start with a well-known company whose stocks performed better than most in 2007: Apple, Inc. The following URL leads to a Yahoo! Finances page listing the daily prices paid for Apple stock in 2007. If you wish, you can substitute the stock code portion of this URL (AAPL) with another stock code to view information on a different company: http://finance.yahoo.com/q/hp?s=AAPL&a=00&b=1&c=2007&d=00&e=1&f=2008&g=d?

Table 13-11 lists the fields included in the historical prices data.

Table 13-11. Stock price fields available from Yahoo! ...

Get Programming Amazon Web Services now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.