getFuturesByExchange API

Receive all real-time or delayed, or end-of-day Futures data by exchange through a single onDemand query.

All APIs

Contact Us to Get Access

Inputs

exchange required

The exchange code for which the list of commodities are required.

Type
enum (A type which includes a list of valid possible values.) 
Example
CME 

Valid Values:
LIFFE, IOM, CROSS, CME, CBOT, MGEX, NYMEX, CASH, KCBT, CBOE, CFE, ICEUS, LME, WCE, GBLX, IMM, BMF, ROFEX, EUIDX, SFE, ICEFI, ICE, SIMEX, EUREX, MEFF, COMEX, HKFE, ENDEX, TIFFE, MDEX, SAFEX, DME, OMX, CXMI, NYMI, TFEX, MNTRL, JPX, TAIWA, CBOTM, MATIF, LCE, BSE, SHFE, NCDEX, NZX, EEX, CZCE, DCE, TURK, MATBA, TOCOM, DGCX, MCX, CFFEX, NSE

category optional

Category of the commodity.

Type
string (A sequence of characters. (example: GOOG)) 
Example
Grains 

fields optional

Request additional optional fields.

Type
list (A comma or semi-colon delimited string.) 
Example
openInterest 

Outputs

Name / Requirement
Description
Type
symbol
always returned
A symbol or code that identifies a financial instrument.
string
A sequence of characters. (example: GOOG)
name
always returned
The type of symbol used.
string
A sequence of characters. (example: GOOG)
dayCode
always returned
The day code for the session. Day codes are "1-9" for days 1 through 9, "0" (zero) for the 10th of the month, and "A - U" for days 11 through 31.
string
A sequence of characters. (example: GOOG)
mode
always returned
An indicator representing if the quote is real-time ("R"), delayed ("I") or end-of-day ("D").
string
A sequence of characters. (example: GOOG)
lastPrice
always returned
The last price the instrument traded.
double
A numeric type defining a number with fractional parts. (example: 2.14)
tradeTimestamp
always returned
The exchange timestamp for the last traded price.
dateTime
A date and time in the format of YYYY-MM-DD HH:MI:SS<TIMEZONE_OFFSET>.
netChange
always returned
The difference between the last traded price and the previous close.
double
A numeric type defining a number with fractional parts. (example: 2.14)
percentChange
always returned
The percent difference between the last traded price and the previous close.
double
A numeric type defining a number with fractional parts. (example: 2.14)
unitCode
always returned
string
A sequence of characters. (example: GOOG)
open
always returned
The opening (first) price for the session.
double
A numeric type defining a number with fractional parts. (example: 2.14)
high
always returned
The highest traded price for the session.
double
A numeric type defining a number with fractional parts. (example: 2.14)
low
always returned
The lowest traded price for the session.
double
A numeric type defining a number with fractional parts. (example: 2.14)
close
always returned
The last traded price for the session.
double
A numeric type defining a number with fractional parts. (example: 2.14)
numTrades
always returned
The number of individual transactions over the course of a trading session.
int
A numeric type defining a whole number. (example: 2)
dollarVolume
always returned
double
A numeric type defining a number with fractional parts. (example: 2.14)
flag
always returned
If present, can be one of the following: "c" meaning that the market is closed for this instrument. "p" meaning that the market is in a pre-open state. This occurs when there are bids and offers being placed, but no trade has occurred yet. This is normally seen shortly before the official opening time for busy markets, but can also be seen throughout the day for lightly traded markets. "s" meaning that the instrument has settled, and that this is the final, settlement price.
string
A sequence of characters. (example: GOOG)
volume
always returned
The quantity of shares or contracts traded.
int
A numeric type defining a whole number. (example: 2)
previousVolume
always returned
The quantity of shares or contracts traded from the previous day.
int
A numeric type defining a whole number. (example: 2)
openInterest
as requested
The quantity of open interest for futures.
double
A numeric type defining a number with fractional parts. (example: 2.14)

Status Code Responses

200
OK
Success
400
Bad Request
The request was invalid, please see the message for more information.
500
Internal Server Error
Something is not working correctly, please contact support.


JSON

GET

GET https://ondemand.websol.barchart.com/getFuturesByExchange.json?apikey=<YOUR API KEY>&exchange=CME&category=Grains&fields=openInterest
Host: ondemand.websol.barchart.com

POST

POST https://ondemand.websol.barchart.com/getFuturesByExchange.json
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length

apikey=<YOUR API KEY>&exchange=CME&category=Grains&fields=openInterest

Response

{
    "status": {
        "code": 204,
        "message": "Success, but no content to return."
    },
    "results": null
}

XML

GET

GET https://ondemand.websol.barchart.com/getFuturesByExchange.xml?apikey=<YOUR API KEY>&exchange=CME&category=Grains&fields=openInterest
Host: ondemand.websol.barchart.com

POST

POST https://ondemand.websol.barchart.com/getFuturesByExchange.xml
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length

apikey=<YOUR API KEY>&exchange=CME&category=Grains&fields=openInterest

Response


<?xml version="1.0" encoding="utf-8"?>
 <getFuturesByExchange>
  <status>
   <code>204</code>
   <message>Success, but no content to return.</message>
  </status>
 </getFuturesByExchange>

CSV

GET

GET https://ondemand.websol.barchart.com/getFuturesByExchange.csv?apikey=<YOUR API KEY>&exchange=CME&category=Grains&fields=openInterest
Host: ondemand.websol.barchart.com

POST

POST https://ondemand.websol.barchart.com/getFuturesByExchange.csv
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length

apikey=<YOUR API KEY>&exchange=CME&category=Grains&fields=openInterest

Response




PHP

<?php

$ondemand = new SoapClient('https://ondemand.websol.barchart.com/service?wsdl');

$params = [
    'exchange' => 'CME',
    'category' => 'Grains',
    'fields' => 'openInterest',
];

$result = $ondemand->getFuturesByExchange($params);
var_dump($result);

Classic ASP

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.getFuturesByExchange("CME", "Grains", "openInterest")

Perl

use SOAP::Lite;
use SOAP::WSDL;

my $ondemand = SOAP::Lite
    -> service('https://ondemand.websol.barchart.com/service?wsdl');

my $result = $ondemand->getFuturesByExchange('CME', 'Grains', 'openInterest');

print $result;

Python

from suds.client import Client
ondemand = Client('https://ondemand.websol.barchart.com/service?wsdl')

result = client.service.getFuturesByExchange('CME', 'Grains', 'openInterest')

print result

Ruby

require 'savon'

ondemand = Savon.client(wsdl: 'https://ondemand.websol.barchart.com/service?wsdl')

response = ondemand.call(
    :getFuturesByExchange,
    message: {
        exchange: 'CME',
        category: 'Grains',
        fields: 'openInterest',
    }
)

response.body