Warning: mysql_connect() [function.mysql-connect]: Host 'banshee.dreamhost.com' is not allowed to connect to this MySQL server in /home/christianowens/developer.stocklytics.com/index.php on line 5

Warning: mysql_select_db() [function.mysql-select-db]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /home/christianowens/developer.stocklytics.com/index.php on line 6

Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/christianowens/developer.stocklytics.com/index.php on line 6
Stocklytics Developer Center: Historical Prices API
Historical Prices API (V1.0)

The Historical Prices API can be used to look up the Open, Close, High and Low price, as well as the volume of stock traded for a stock code within a particular date range. The API supports the downloading the entire historical data set we have on file for a stock, we index data for a stock with a start date of January 1st 1980.

API Version: 1.0


API Endpoint
Queries should be sent to the following API endpoint.
http://api.stocklytics.com/historicalPrices/API_VERSION/


Accepted Parameters
The following parameters are accepted, all should be sent to the URL via a GET variable.

api_key Required Allows us to identify the request initiator.
stock Required The stock code/ticker for the stock to look up. (eg. AAPL for Apple, Inc.)
format Optional Format of returned data. Either CSV or JSON.
order Optional Order of returned data sorted by date. ASC for Ascending, DESC for Decending.
start
end
Optional The start and end dates to return data for. Supply dates in the format: YYYY-MM-DD


Example Request
A sample request URL to the Historical Data API.
http://api.stocklytics.com/historicalPrices/1.0/?api_key=jdiosjhf4joe&stock=AAPL&format=JSON&order=DESC&start=2011-01-01&end=2011-01-10


Example Response
This is an example JSON response for the above example request.
{
   "2011-01-03":{
      "open":"325.6400",
      "close":"329.5700",
      "high":"330.2600",
      "low":"324.8400",
      "volume":"15883600"
   },
   "2011-01-04":{
      "open":"332.4400",
      "close":"331.2900",
      "high":"332.5000",
      "low":"328.1500",
      "volume":"11038600"
   },
   "2011-01-05":{
      "open":"329.5500",
      "close":"334.0000",
      "high":"334.3400",
      "low":"329.5000",
      "volume":"9058700"
   },
   "2011-01-06":{
      "open":"334.7200",
      "close":"333.7300",
      "high":"335.2500",
      "low":"332.9000",
      "volume":"10709500"
   },
   "2011-01-07":{
      "open":"333.9900",
      "close":"336.1200",
      "high":"336.3500",
      "low":"331.9000",
      "volume":"11096800"
   },
   "2011-01-10":{
      "open":"338.8300",
      "close":"342.4500",
      "high":"343.2300",
      "low":"337.1700",
      "volume":"16000400"
   }
}


Notes
As you'll notice from the above data, even though we requested a date range of 10 days, only 6 days are returned.

As trading doesn't happen on weekends, data for these days isn't recorded and is therefore not returned via API requests. This applies for all days that the markets are closed.

You'll need an API Key to use this API. If you have a Stocklytics developer account, go ahead and login to retrieve your API key. If you're not a registered developer, go ahead and sign up for free.
Login
Sign Up


Company Data
Historical Prices
Intraday Historical Prices
Stock News
Stock Tweets


Current Price Widget
Stocklytics Button
Stock Graph Widget

Warning: mysql_close(): no MySQL-Link resource supplied in /home/christianowens/developer.stocklytics.com/index.php on line 62