getHistory API
getHistory
The getHistory API is used to request historical time series data on stocks, indices, mutual funds, ETFs, futures, indices or forex pairs. Historical data is available as tick, minute or end-of-day data.
View All APIssymbolrequired
A symbol or code that identifies a financial instrument.
AAPL
typerequired
The type of historical data to return, including tick data, minute data, and end-of-day data.
minutes
startDateoptional
The start date of the historical data query. This parameter should be set to the desired start date/time for the query (the result set will include records back to, and including, this value). If not set, the value will default to the beginning of the day specified in the end parameter, if end is specified, or to the beginning of the current day, if end is not specified. The value should conform to the format yyyymmdd[hhmm[ss]], where fields in brackets are optional (Do not include the brackets themselves). Any optional fields that are not explicitly set will default to 0 (i.e. 20090203 will default to 20090203000000 or February 3, 2009 at 00:00:00).
20100101
maxRecordsoptional
The maximum amount of records returned. This parameter should be set to the maximum number of records desired. If not specified, there number of records returned will be determined by the date/time parameters specified as well as any defaults that apply to the query.
10
intervaloptional
The number of minutes for a minute query.
60
orderoptional
An arrangement of fields within a particular record (ascending or descending). This parameter can be set to one of two values ("asc" and "desc") in order to specify the chronological order of the result set returned. If this parameter is not specified, the order results is not guaranteed.
asc
sessionFilteroptional
This parameter modifies the default session codes/sale conditions used to return ticks for each exchange. For NYSE and AMEX, the default session filter is "@EFKX56V9" (meaning all ticks with sale conditions corresponding to one of the characters in the filter are included in the results), for NASDAQ the default is "@ABDEFKOSXY156", and for everything else all session codes/sale conditions are returned except the settle (session code '*'). If the session filter is set to a string of valid session codes (i.e. "EFK"), only ticks with the specified session codes are included in the results. If the string is prefixed with character '!' (i.e."!EFK"), all session codes except those in the string are included in the results. If the string is prefixed with character '+' (i.e. "+T"), then all the default session codes in addition to the ones specified in the string are included in the results. And if the string is prefixed with character '-' (i.e. "-EF") then all default session codes except the ones specified are included in the results. Please note that the '+' character should be escaped (to %2B) when entering the URL in a web browser or executing the query in an API that does not escape it by default.
EFK
splitsoptional
An adjustment of stock value due to corporate action. This parameter only applies to stocks and specifies whether the data returned should be adjusted for splits or not. Set to true to query for adjusted the data, or to false for non-adjusted data. If not specified, the default is true. In order to guarantee the same adjustment settings in the future, this parameter should be specified.
true
dividendsoptional
A distribution of a portion of a company's earnings. This parameter only applies to stocks and specifies whether the data returned should be adjusted for dividends or not. Set to true to query for adjusted the data, or to false for non-adjusted data. If not specified, the default is true. In order to guarantee the same adjustment settings in the future, this parameter should be specified.
true
volumeoptional
The quantity of shares or contracts traded. For futures, this parameter can be set to one of two values (contract and total) in order to specify whether the volume returned should be the contract volume or the total volume. For aggregates (such as weekly, monthly or yearly), this returns the average volume for the period specified. If the value is preceded by 'sum' (sumcontract and sumtotal), then it returns the sum of the volumes in each daily bar during the period specified. If not specified, the value will default to contract. For aggregate equities queries (such as weekly, monthly or yearly), this parameter can be set to sum to return the sum of the volumes in each daily bar during the period specified. If not specified, then the average volume is returned.
sum
nearbyoptional
This parameter specifies the offset from the front month for 'nearest' queries (data parameter set to dailynearest, weeklynearest, monthlynearest, quarterlynearest and yearlynearest). The default value for this parameter is 1, which sets nearest queries to the most current front month. If set to a value greater than 1, then the nth front month is used (for example, in August of 2010, ESU10 would be the current front month, so nearby=2 would use ESZ10, nearby=3 would use ESH11, etc.) This parameter is ignored for all other queries. Alternatively, the same functionality provided by the nearby parameter can be achieved using the symbol notation symbol=RS*n, where RS is the root symbol and n is the nth front month (i.e. symbol=ES*1, symbol=YM*3, etc.). When using this notation on the symbol parameter, the nearby parameter should be omitted.
1
jerqoptional
Whether to merge with JERQ data.
true
always returned
A sequence of characters. (example: GOOG)
always returned
A sequence of characters. (example: GOOG)
always returned
A date in the format of YYYY-MM-DD.
as requested
A sequence of characters. (example: GOOG)
as requested
A numeric type defining a number with fractional parts. (example: 2.14)
as requested
A numeric type defining a whole number. (example: 2)
as requested
A numeric type defining a number with fractional parts. (example: 2.14)
as requested
A numeric type defining a number with fractional parts. (example: 2.14)
as requested
A numeric type defining a number with fractional parts. (example: 2.14)
as requested
A numeric type defining a number with fractional parts. (example: 2.14)
as requested
A numeric type defining a whole number. (example: 2)
as requested
A numeric type defining a whole number. (example: 2)
GET
GET https://marketdata.websol.barchart.com/getHistory.json?apikey=YOUR_API_KEY&symbol=AAPL&type=minutes&startDate=20100101&maxRecords=10&interval=60&order=asc&sessionFilter=EFK&splits=true÷nds=true&volume=sum&nearby=1&jerq=true
Host: marketdata.websol.barchart.com
POST
POST https://marketdata.websol.barchart.com/getHistory.json
Host: marketdata.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&symbol=AAPL&type=minutes&startDate=20100101&maxRecords=10&interval=60&order=asc&sessionFilter=EFK&splits=true÷nds=true&volume=sum&nearby=1&jerq=true
Response
{
"status": {
"code": 200,
"message": "Success."
},
"results": [
{
"symbol": "AAPL",
"timestamp": "2012-12-28T13:00:00-05:00",
"tradingDay": "2012-12-28",
"open": 15.5855,
"high": 15.5968,
"low": 15.5588,
"close": 15.5682,
"volume": 30670020
},
{
"symbol": "AAPL",
"timestamp": "2012-12-28T14:00:00-05:00",
"tradingDay": "2012-12-28",
"open": 15.5677,
"high": 15.5749,
"low": 15.5356,
"close": 15.557,
"volume": 38225048
},
{
"symbol": "AAPL",
"timestamp": "2012-12-28T15:00:00-05:00",
"tradingDay": "2012-12-28",
"open": 15.5567,
"high": 15.6491,
"low": 15.4622,
"close": 15.5021,
"volume": 119346374
},
{
"symbol": "AAPL",
"timestamp": "2012-12-31T09:00:00-05:00",
"tradingDay": "2012-12-31",
"open": 15.5356,
"high": 15.9577,
"low": 15.4891,
"close": 15.9434,
"volume": 112222871
},
{
"symbol": "AAPL",
"timestamp": "2012-12-31T10:00:00-05:00",
"tradingDay": "2012-12-31",
"open": 15.9434,
"high": 16.0435,
"low": 15.874,
"close": 15.9805,
"volume": 125336104
},
{
"symbol": "AAPL",
"timestamp": "2012-12-31T11:00:00-05:00",
"tradingDay": "2012-12-31",
"open": 15.982,
"high": 16.0185,
"low": 15.888,
"close": 15.9802,
"volume": 71458017
},
{
"symbol": "AAPL",
"timestamp": "2012-12-31T12:00:00-05:00",
"tradingDay": "2012-12-31",
"open": 15.9835,
"high": 16.084,
"low": 15.881,
"close": 16.0131,
"volume": 88005254
},
{
"symbol": "AAPL",
"timestamp": "2012-12-31T13:00:00-05:00",
"tradingDay": "2012-12-31",
"open": 16.0121,
"high": 16.1129,
"low": 15.9558,
"close": 15.9918,
"volume": 78954772
},
{
"symbol": "AAPL",
"timestamp": "2012-12-31T14:00:00-05:00",
"tradingDay": "2012-12-31",
"open": 15.9942,
"high": 16.2894,
"low": 15.9912,
"close": 16.2567,
"volume": 101082752
},
{
"symbol": "AAPL",
"timestamp": "2012-12-31T15:00:00-05:00",
"tradingDay": "2012-12-31",
"open": 16.2519,
"high": 16.2924,
"low": 16.15,
"close": 16.2188,
"volume": 133325140
}
]
}
GET
GET https://marketdata.websol.barchart.com/getHistory.xml?apikey=YOUR_API_KEY&symbol=AAPL&type=minutes&startDate=20100101&maxRecords=10&interval=60&order=asc&sessionFilter=EFK&splits=true÷nds=true&volume=sum&nearby=1&jerq=true
Host: marketdata.websol.barchart.com
POST
POST https://marketdata.websol.barchart.com/getHistory.xml
Host: marketdata.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&symbol=AAPL&type=minutes&startDate=20100101&maxRecords=10&interval=60&order=asc&sessionFilter=EFK&splits=true÷nds=true&volume=sum&nearby=1&jerq=true
Response
<?xml version="1.0" encoding="utf-8"?>
<getHistory>
<status>
<code>200</code>
<message>Success.</message>
</status>
<item>
<symbol>AAPL</symbol>
<timestamp>2012-12-28T13:00:00-05:00</timestamp>
<tradingDay>2012-12-28</tradingDay>
<open>15.5855</open>
<high>15.5968</high>
<low>15.5588</low>
<close>15.5682</close>
<volume>30670020</volume>
</item>
<item>
<symbol>AAPL</symbol>
<timestamp>2012-12-28T14:00:00-05:00</timestamp>
<tradingDay>2012-12-28</tradingDay>
<open>15.5677</open>
<high>15.5749</high>
<low>15.5356</low>
<close>15.557</close>
<volume>38225048</volume>
</item>
<item>
<symbol>AAPL</symbol>
<timestamp>2012-12-28T15:00:00-05:00</timestamp>
<tradingDay>2012-12-28</tradingDay>
<open>15.5567</open>
<high>15.6491</high>
<low>15.4622</low>
<close>15.5021</close>
<volume>119346374</volume>
</item>
<item>
<symbol>AAPL</symbol>
<timestamp>2012-12-31T09:00:00-05:00</timestamp>
<tradingDay>2012-12-31</tradingDay>
<open>15.5356</open>
<high>15.9577</high>
<low>15.4891</low>
<close>15.9434</close>
<volume>112222871</volume>
</item>
<item>
<symbol>AAPL</symbol>
<timestamp>2012-12-31T10:00:00-05:00</timestamp>
<tradingDay>2012-12-31</tradingDay>
<open>15.9434</open>
<high>16.0435</high>
<low>15.874</low>
<close>15.9805</close>
<volume>125336104</volume>
</item>
<item>
<symbol>AAPL</symbol>
<timestamp>2012-12-31T11:00:00-05:00</timestamp>
<tradingDay>2012-12-31</tradingDay>
<open>15.982</open>
<high>16.0185</high>
<low>15.888</low>
<close>15.9802</close>
<volume>71458017</volume>
</item>
<item>
<symbol>AAPL</symbol>
<timestamp>2012-12-31T12:00:00-05:00</timestamp>
<tradingDay>2012-12-31</tradingDay>
<open>15.9835</open>
<high>16.084</high>
<low>15.881</low>
<close>16.0131</close>
<volume>88005254</volume>
</item>
<item>
<symbol>AAPL</symbol>
<timestamp>2012-12-31T13:00:00-05:00</timestamp>
<tradingDay>2012-12-31</tradingDay>
<open>16.0121</open>
<high>16.1129</high>
<low>15.9558</low>
<close>15.9918</close>
<volume>78954772</volume>
</item>
<item>
<symbol>AAPL</symbol>
<timestamp>2012-12-31T14:00:00-05:00</timestamp>
<tradingDay>2012-12-31</tradingDay>
<open>15.9942</open>
<high>16.2894</high>
<low>15.9912</low>
<close>16.2567</close>
<volume>101082752</volume>
</item>
<item>
<symbol>AAPL</symbol>
<timestamp>2012-12-31T15:00:00-05:00</timestamp>
<tradingDay>2012-12-31</tradingDay>
<open>16.2519</open>
<high>16.2924</high>
<low>16.15</low>
<close>16.2188</close>
<volume>133325140</volume>
</item>
</getHistory>
GET
GET https://marketdata.websol.barchart.com/getHistory.csv?apikey=YOUR_API_KEY&symbol=AAPL&type=minutes&startDate=20100101&maxRecords=10&interval=60&order=asc&sessionFilter=EFK&splits=true÷nds=true&volume=sum&nearby=1&jerq=true
Host: marketdata.websol.barchart.com
POST
POST https://marketdata.websol.barchart.com/getHistory.csv
Host: marketdata.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&symbol=AAPL&type=minutes&startDate=20100101&maxRecords=10&interval=60&order=asc&sessionFilter=EFK&splits=true÷nds=true&volume=sum&nearby=1&jerq=true
Response
symbol,timestamp,tradingDay,open,high,low,close,volume
"AAPL","2012-12-28T13:00:00-05:00","2012-12-28","15.5855","15.5968","15.5588","15.5682","30670020"
"AAPL","2012-12-28T14:00:00-05:00","2012-12-28","15.5677","15.5749","15.5356","15.557","38225048"
"AAPL","2012-12-28T15:00:00-05:00","2012-12-28","15.5567","15.6491","15.4622","15.5021","119346374"
"AAPL","2012-12-31T09:00:00-05:00","2012-12-31","15.5356","15.9577","15.4891","15.9434","112222871"
"AAPL","2012-12-31T10:00:00-05:00","2012-12-31","15.9434","16.0435","15.874","15.9805","125336104"
"AAPL","2012-12-31T11:00:00-05:00","2012-12-31","15.982","16.0185","15.888","15.9802","71458017"
"AAPL","2012-12-31T12:00:00-05:00","2012-12-31","15.9835","16.084","15.881","16.0131","88005254"
"AAPL","2012-12-31T13:00:00-05:00","2012-12-31","16.0121","16.1129","15.9558","15.9918","78954772"
"AAPL","2012-12-31T14:00:00-05:00","2012-12-31","15.9942","16.2894","15.9912","16.2567","101082752"
"AAPL","2012-12-31T15:00:00-05:00","2012-12-31","16.2519","16.2924","16.15","16.2188","133325140"
<?php
$ondemand = new SoapClient('https://marketdata.websol.barchart.com/service?wsdl');
$params = [
'apikey' => 'YOUR_API_KEY',
'symbol' => 'AAPL',
'type' => 'minutes',
'startDate' => '20100101',
'maxRecords' => '10',
'interval' => '60',
'order' => 'asc',
'sessionFilter' => 'EFK',
'splits' => 'true',
'dividends' => 'true',
'volume' => 'sum',
'nearby' => '1',
'jerq' => 'true',
];
$result = $ondemand->getHistory($params);
var_dump($result);
Dim ondemand
Dim result
Set ondemand = Server.CreateObject("MSSOAP.SoapClient30")
ondemand.ClientProperty("ServerHTTPRequest") = True
ondemand.MSSoapInit("https://marketdata.websol.barchart.com/service?wsdl")
Set result = ondemand.getHistory("YOUR_API_KEY", "AAPL", "minutes", "20100101", "10", "60", "asc", "EFK", "true", "true", "sum", "1", "true")
use SOAP::Lite;
use SOAP::WSDL;
my $ondemand = SOAP::Lite
-> service('https://marketdata.websol.barchart.com/service?wsdl');
my $result = $ondemand->getHistory('YOUR_API_KEY', 'AAPL', 'minutes', '20100101', '10', '60', 'asc', 'EFK', 'true', 'true', 'sum', '1', 'true');
print $result;
from suds.client import Client
ondemand = Client('https://marketdata.websol.barchart.com/service?wsdl')
result = ondemand.service.getHistory('YOUR_API_KEY', 'AAPL', 'minutes', '20100101', '10', '60', 'asc', 'EFK', 'true', 'true', 'sum', '1', 'true')
print(result)
require 'savon'
ondemand = Savon.client(wsdl: 'https://marketdata.websol.barchart.com/service?wsdl')
response = ondemand.call(
:getHistory,
message: {
apikey: 'YOUR_API_KEY',
symbol: 'AAPL',
type: 'minutes',
startDate: '20100101',
maxRecords: '10',
interval: '60',
order: 'asc',
sessionFilter: 'EFK',
splits: 'true',
dividends: 'true',
volume: 'sum',
nearby: '1',
jerq: 'true',
}
)
response.body