Download historical data

You can use the history request to download intraday, daily (end of day), weekly, monthly or yearly historical data for a specified symbol.

Request URL

http://api.kibot.com/?action=history&symbol=[symbol]&interval=[interval]&period=[period]&startdate=[startdate]&enddate=[enddate]&regularsession=[regularsession]&unadjusted=[unadjusted]&splitadjusted=[splitadjusted]&type=[type]&attach=[attach]

Response

The server returns lines with comma separated values. Here is an example:

Date

Time

Open

High

Low

Close

Volume

08/31/2011

09:30

12.52

12.68

12.5

12.66

1004620

08/31/2011

09:35

12.65

12.65

12.58

12.63

696432

Parameters

The table below describes all the parameters that are accepted:

PARAMETER

DESCRIPTION

REQUIRED

POSSIBLE VALUES

action

Specifies the action to perform on the server

YES

history

symbol

Specifies the symbol to process

YES

Any ticker symbol available on our servers. You must be authorized to download data for a particular symbol.

Complete history is available only for symbols that are part of any of your previous purchases or are offered for free.

interval

Indicates the frequency of the bars that are returned

YES

For tick data use tickbidask, tick, tick1sec, tick5sec, tick10sec, tick15sec, tick30sec.

"tick" excludes bid and ask prices, tick1sec, tick5sec, tick10sec, tick15sec and tick30sec are aggregated tick prices using 1, 5, 10, 15 and 30 second intervals.

To download aggregate bid/ask 1, 5, 15 and 30 minute data use tickbidask1, tickbidask5, tickbidask15 and tickbidask30.

For intraday data valid values are from 1 to 60 minutes and multiples of 60 like 60, 120, 180, 240 etc.

Can also be Daily, Weekly, Monthly, Yearly.

Only daily (end of day) data is available to guest (demo) users.

period

The number of days for which the data is returned

NO

Any integer value between 1 and number of days available on the server for a requested symbol. The value represents the number of calendar days to go back and it is not necessarily the number of days that will be returned from the server. If value provided is greater than the maximum number of days available, the server returns all data.

If period is not specified, the difference in days between the startdate and enddate parameters determines the number of days returned.

startdate

The start date of the data being requested (Inclusive)

NO

Date (MM/DD/YYYY)

If not specified, then the period parameter must have a valid integer value.

enddate

The end date of the data being requested (Inclusive)

NO

Date (MM/DD/YYYY)

If not specified, then the default value is the previous business day

regularsession

Indicates if only regular market session is to be included in the data

NO

1, 0

If this parameter is omitted, the server includes pre-market (8:00-9:30 a.m. ET), regular (9:30 a.m. -4:00 p.m. ET.) and after market (4:00-8:00 p.m. ET.) sessions.

Only valid for intraday and tick data requests.

Shortened trading sessions end at 1:00 p.m. for regular session and at 5 p.m. for after-hour session.

unadjusted

Indicates if unadjusted data is to be returned from the API.

NO

1, 0

Applicable only to US and Canadian stocks and ETFs. If not specified, data adjusted for splits and dividends is returned from the server.

splitadjusted

Indicates if data adjusted for splits only (excluding dividends) is to be returned from the API.

NO

1, 0

If an instrument does not have splits, unadjusted data is returned. This is the same adjustment method that is used for charts on Yahoo Finance, Google Finance and some other financial web sites. Applicable only to US and Canadian stocks and ETFs. If not specified, data adjusted for splits and dividends is returned from the server.

type

Specifies the instrument type

NO

Can be stocks, canadian, otc, forex, futures, indexes.

If not specified, stocks is used.

attach

Starts a "File Download" dialog box in a web browser and other enabled clients

NO

1, 0

This lets the web browser initiate a "File Download" dialog box allowing the user to save a file to a computer. The server modifies the Content-Disposition http header accordingly.

Remarks

You can download all the available intraday data form our servers only if a symbol is part of any of your previous purchases. For example if you purchased our ETF package, you may download the complete history for SPY, QQQ, DIA and all other ETFs that are part of the package.

All data is adjusted for splits and dividends. You can use the adjustments command to determine which symbols have been adjusted recently and download the complete history for only those symbols. In all other cases, you can download just the new data to update your existing files. First determine the last date in the file and request data from our servers after that date by specifying the startdate parameter in your history request.

Examples

Request last 5 days of 3-minute bars for MSFT (Microsoft) and include regular session only:

URL:

http://api.kibot.com?action=history&symbol=MSFT&interval=3&period=5&regularsession=1

Response:

08/31/2011,09:30,26.29,26.39,26.29,26.36,878715
08/31/2011,09:33,26.3678,26.4,26.3,26.34,588017
08/31/2011,09:36,26.3407,26.36,26.27,26.27,601274
08/31/2011,09:39,26.27,26.31,26.26,26.28,558588
08/31/2011,09:42,26.29,26.45,26.28,26.43,749685
08/31/2011,09:45,26.4201,26.47,26.39,26.4,861482

Request weekly data since 2005 for WMT (Wal-Mart Stores):

URL:

http://api.kibot.com?action=history&symbol=WMT&interval=weekly&startdate=1/1/2005

Response:

1/3/2005,53.3,54.05,53.64,53.99,58605900
1/10/2005,53.59,54.1,53.75,53.99,40737600
1/18/2005,53.53,54.29,53.48,53.01,34229500
1/24/2005,52.77,53.35,52.92,52.43,39931900
1/31/2005,52.22,53.4,52.9,53.46,44901500
2/7/2005,53.45,53.7,52.63,52.1,40027800

Request 60-minute historical data for MSFT for month August 2011:

URL:

http://api.kibot.com?action=history&symbol=MSFT&interval=60&startdate=8/1/2011&enddate=8/31/2011

Response:

08/02/2011,07:00,27.1,27.1,27.05,27.05,1500
08/02/2011,08:00,27.09,27.27,26.85,27.04,102089
08/02/2011,09:00,27.04,27.36,26.89,27.31,5748783
08/02/2011,10:00,27.32,27.45,27.12,27.2464,10761993
08/02/2011,11:00,27.24,27.28,27.08,27.19,7666654
08/02/2011,12:00,27.19,27.33,27.025,27.07,7281369



Historical Data API - Table of Contents

Introduction
    Historical data API  
    Overview
    How to get access
Commands
    Login request
    Download historical data
    Stock data adjustments
    Logout request
    Status
Examples
    Sample source code
    Sample client application
Other
    Data compression
    Server responses