BLS Index API
getBLSIndexes
The getBLSIndexes API provides historical price data for the price movements of 22 basic commodities whose markets are among the first to be influenced by changes in economic conditions. Sub-indices for metals, textiles, raw materials, foodstuffs, livestock, fats and oils are calculated.
View All APIstyperequired
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 date 6 months back from present day. 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
endDateoptional
The end data of the historical data query. This parameter should be set to the desired end date/time for the query (the result set will include records up to, but not including, this value). If not set, the value will default to the end of the current day. 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).
20130101
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
always returned
A sequence of characters. (example: GOOG)
always returned
A sequence of characters. (example: GOOG)
always returned
A type which includes a list of valid possible values.
GET
GET https://ondemand.websol.barchart.com/getBLSIndexes.json?apikey=YOUR_API_KEY&type=minutes&startDate=20100101&endDate=20130101&maxRecords=10
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getBLSIndexes.json
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&type=minutes&startDate=20100101&endDate=20130101&maxRecords=10
Response
{
"status": {
"code": 200,
"message": "Success."
},
"results": [
{
"symbol": "$CRBS",
"name": "CRB Spot Index",
"history": []
},
{
"symbol": "$CRBM",
"name": "CRB Metals Sub Index",
"history": []
},
{
"symbol": "$CRBT",
"name": "CRB Textiles Sub Index",
"history": []
},
{
"symbol": "$CRBR",
"name": "CRB Raw Industrials Sub Index",
"history": []
},
{
"symbol": "$CRBF",
"name": "CRB Foodstuff Sub Index",
"history": []
},
{
"symbol": "$CRBO",
"name": "CRB Fats & Oils Sub Index",
"history": []
},
{
"symbol": "$CRBL",
"name": "CRB Livestock Sub Index",
"history": []
}
]
}
GET
GET https://ondemand.websol.barchart.com/getBLSIndexes.xml?apikey=YOUR_API_KEY&type=minutes&startDate=20100101&endDate=20130101&maxRecords=10
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getBLSIndexes.xml
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&type=minutes&startDate=20100101&endDate=20130101&maxRecords=10
Response
<?xml version="1.0" encoding="utf-8"?>
<getBLSIndexes>
<status>
<code>200</code>
<message>Success.</message>
</status>
<item>
<symbol>$CRBS</symbol>
<name>CRB Spot Index</name>
<history>
</history>
</item>
<item>
<symbol>$CRBM</symbol>
<name>CRB Metals Sub Index</name>
<history>
</history>
</item>
<item>
<symbol>$CRBT</symbol>
<name>CRB Textiles Sub Index</name>
<history>
</history>
</item>
<item>
<symbol>$CRBR</symbol>
<name>CRB Raw Industrials Sub Index</name>
<history>
</history>
</item>
<item>
<symbol>$CRBF</symbol>
<name>CRB Foodstuff Sub Index</name>
<history>
</history>
</item>
<item>
<symbol>$CRBO</symbol>
<name>CRB Fats & Oils Sub Index</name>
<history>
</history>
</item>
<item>
<symbol>$CRBL</symbol>
<name>CRB Livestock Sub Index</name>
<history>
</history>
</item>
</getBLSIndexes>
GET
GET https://ondemand.websol.barchart.com/getBLSIndexes.csv?apikey=YOUR_API_KEY&type=minutes&startDate=20100101&endDate=20130101&maxRecords=10
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getBLSIndexes.csv
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&type=minutes&startDate=20100101&endDate=20130101&maxRecords=10
Response
symbol,name
"$CRBL","CRB Livestock Sub Index"
"$CRBO","CRB Fats & Oils Sub Index"
"$CRBF","CRB Foodstuff Sub Index"
"$CRBR","CRB Raw Industrials Sub Index"
"$CRBT","CRB Textiles Sub Index"
"$CRBM","CRB Metals Sub Index"
"$CRBS","CRB Spot Index"
<?php
$ondemand = new SoapClient('https://ondemand.websol.barchart.com/service?wsdl');
$params = [
'apikey' => 'YOUR_API_KEY',
'type' => 'minutes',
'startDate' => '20100101',
'endDate' => '20130101',
'maxRecords' => '10',
];
$result = $ondemand->getBLSIndexes($params);
var_dump($result);
Dim ondemand
Dim result
Set ondemand = Server.CreateObject("MSSOAP.SoapClient30")
ondemand.ClientProperty("ServerHTTPRequest") = True
ondemand.MSSoapInit("https://ondemand.websol.barchart.com/service?wsdl")
Set result = ondemand.getBLSIndexes("YOUR_API_KEY", "minutes", "20100101", "20130101", "10")
use SOAP::Lite;
use SOAP::WSDL;
my $ondemand = SOAP::Lite
-> service('https://ondemand.websol.barchart.com/service?wsdl');
my $result = $ondemand->getBLSIndexes('YOUR_API_KEY', 'minutes', '20100101', '20130101', '10');
print $result;
from suds.client import Client
ondemand = Client('https://ondemand.websol.barchart.com/service?wsdl')
result = ondemand.service.getBLSIndexes('YOUR_API_KEY', 'minutes', '20100101', '20130101', '10')
print(result)
require 'savon'
ondemand = Savon.client(wsdl: 'https://ondemand.websol.barchart.com/service?wsdl')
response = ondemand.call(
:getBLSIndexes,
message: {
apikey: 'YOUR_API_KEY',
type: 'minutes',
startDate: '20100101',
endDate: '20130101',
maxRecords: '10',
}
)
response.body