getFuturesExpirations API

The getFuturesExpiration API provides first notice and last trade dates for futures contracts.

All APIs

Contact Us to Get Access

Inputs

roots optional

A symbol or code that identifies a futures root.

Type
list (A comma or semi-colon delimited string.) 
Example
ZC,ZS 

contracts optional

A symbol or code that identifies a futures contract.

Type
list (A comma or semi-colon delimited string.) 
Example
ZCN14,ZCU14 

Outputs

Name / Requirement
Description
Type
symbol
always returned
A symbol or code that identifies the futures contract.
string
A sequence of characters. (example: GOOG)
exchange
always returned
The name of the exchange the instrument belongs to.
string
A sequence of characters. (example: GOOG)
contract
always returned
The expiration month and year of the futures contract.
string
A sequence of characters. (example: GOOG)
firstNoticeDate
always returned
The first notice date of the futures contract.
date
A date in the format of YYYY-MM-DD.
expirationDate
always returned
The expiration date.
date
A date in the format of YYYY-MM-DD.
lastTradingDay
always returned
The last trade day of the futures contract.
string
A sequence of characters. (example: GOOG)

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/getFuturesExpirations.json?apikey=<YOUR API KEY>&roots=ZC%2CZS&contracts=ZCN14%2CZCU14
Host: ondemand.websol.barchart.com

POST

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

apikey=<YOUR API KEY>&roots=ZC%2CZS&contracts=ZCN14%2CZCU14

Response

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

XML

GET

GET https://ondemand.websol.barchart.com/getFuturesExpirations.xml?apikey=<YOUR API KEY>&roots=ZC%2CZS&contracts=ZCN14%2CZCU14
Host: ondemand.websol.barchart.com

POST

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

apikey=<YOUR API KEY>&roots=ZC%2CZS&contracts=ZCN14%2CZCU14

Response


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

CSV

GET

GET https://ondemand.websol.barchart.com/getFuturesExpirations.csv?apikey=<YOUR API KEY>&roots=ZC%2CZS&contracts=ZCN14%2CZCU14
Host: ondemand.websol.barchart.com

POST

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

apikey=<YOUR API KEY>&roots=ZC%2CZS&contracts=ZCN14%2CZCU14

Response




PHP

<?php

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

$params = [
    'roots' => 'ZC,ZS',
    'contracts' => 'ZCN14,ZCU14',
];

$result = $ondemand->getFuturesExpirations($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.getFuturesExpirations("ZC,ZS", "ZCN14,ZCU14")

Perl

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

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

my $result = $ondemand->getFuturesExpirations('ZC,ZS', 'ZCN14,ZCU14');

print $result;

Python

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

result = client.service.getFuturesExpirations('ZC,ZS', 'ZCN14,ZCU14')

print result

Ruby

require 'savon'

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

response = ondemand.call(
    :getFuturesExpirations,
    message: {
        roots: 'ZC,ZS',
        contracts: 'ZCN14,ZCU14',
    }
)

response.body