Cash Grain Instruments API
getGrainInstruments
The getGrainInstruments API is used to request symbol and metadata information regarding physical grain instruments across Barchart's cash bids and grain indexes. Users can request information based on crop type / root symbol, geo-location, or areas that are codified by FIPS standards. Returned instruments and their corresponding symbols can be passed to getQuote or getHistory to retrieve the associated price data - as requested by the end user. Find our more about our commodity data offerings here.
View All APIsinstrumentTyperequired
The type of grain instruments. This parameter should be set to the desired instrument type for the query.
indexBasis
instrumentRootrequired
A 2-char indicator for commodities. This parameter should be set to the root that represents the desired commodity for the query. Roots that are denoted as "all" are valid for both bid and index data - if "bids" then there is no index associated with that root.
ZC: All kinds of Corn and Milo/Sorghum (all), ZS: All kinds of Soybeans (all), ZW: All kinds of Soft Red Winter Wheat (all), MW: All kinds of Spring Wheat (all), KE: All kinds of Hard Red Winter Wheat (all), FW: All kinds of Feed Wheat (bids), DW: All kinds of Durum Wheat (bids), CW: Wheat (Club) (bids), ZM: Soybean Meal (bids), HS: Soybeans (Hulls) (bids), ZO: Oats (bids), BB: Barley (bids), ZR: Rice (bids), ZK: Ethanol (E85) (bids), GP: Peas (Green) (bids), YP: Peas (Yellow) (bids), SF: Birdseed or Sunflowers (bids), RY: Rye (bids), RS: Canola (bids), PC: Pulse Crops (Peas, Dry Beans, Lentils & Chickpeas) (bids), PB: Beans (Pinto) (bids), LB: Beans (Lentil) (bids), GB: Beans (Garbonzo) (bids), MI: Millet (bids), MD: Distiller Grains (MWDGS) (bids), DG: Distiller Grains (DDGS) (bids), FL: Flax (bids), CS: Cottonseed (bids)
ZC
zipCodeoptional
A valid zip code to refine the area that cash bids orgin from. This parameter is required if stateFipsCode has not been set. This is the only way to query Canada grain bids.
stateFipsCodeoptional
A valid 2-digit state code used to define the area that the underlying grain data (bids or indexes) will be returned from. This parameter is required if zipCode and indexGroup have not been set. Note that calls using this field will return instruments for counties and districts that are associated with the requested stateFipsCode - in addition any instruments with an area equal to the user specified stateFipsCode.
Please click here to get a list of possible values.
districtCodeoptional
A valid 2-digit district code used to define the area that the underlying grain data (bids or indexes) will be returned from. Note that calls using this field will return instruments for counties that are associated with the requested districtCode - in addition any instruments with an area equal to the user specified districtCode.
Please click here to get a list of possible values.
countyFipsCodeoptional
A valid 3-digit county code use to define the the area that the underlying grain data (bids or indexes) will be returned from.
Please click here to get a list of possible values.
deliveryMonthoptional
The last month in the delivery window for cash bids or indexes using the following format: "YYYYMM"(i.e. 202412). For example, a bid with a delivery window of 202412 through 202503 can only be retrieved by input of 202503.
For instrumentType = 'IndexBasis' or 'IndexCash', this parameter accepts rolling month codes: 'A' - 'L', which represent the forward delivery month from front month (A) to the 11th (L) forward month
202412
indexGroupoptional
A valid index aggregate level that returns all index instruments belonging to a specific indexGroup.Combining indexGroup and country or region are the only way to query national indexes and regional indexes.
This parameter may required if stateFipsCode has not been set.
nation
countryoptional
The short country name to further refine the index instruments.
US
regionoptional
A short region name to further refine the index instruments.
maxRecordsoptional
The maximum amount of records returned. This parameter should be set to the maximum number of records desired. Default value is 200
25
pagerequired
The value to set for pagination.
1
locationIdoptional
The locationId for which all cash bid symbol should be returned.
4435
always returned
A sequence of characters. (example: GOOG)
always returned
A sequence of characters. (example: GOOG)
as requested
(ONLY returned for instrument type bidBasis or bidCash.)
A sequence of characters. (example: GOOG)
always returned
A sequence of characters. (example: GOOG)
always returned
A sequence of characters. (example: GOOG)
as requested
(ONLY returned for instrument type bidBasis or bidCash.)
A date and time in the format of YYYY-MM-DD HH:MI:SS<TIMEZONE_OFFSET>.
always returned
A date and time in the format of YYYY-MM-DD HH:MI:SS<TIMEZONE_OFFSET>.
as requested
(ONLY returned for instrument type bidBasis or bidCash.)
A sequence of characters. (example: GOOG)
as requested
(ONLY returned for instrument type bidBasis or bidCash.)
A sequence of characters. (example: GOOG)
as requested
(ONLY returned for instrument type bidBasis or bidCash.)
A sequence of characters. (example: GOOG)
as requested
(ONLY returned for instrument type bidBasis or bidCash.)
A sequence of characters. (example: GOOG)
as requested
(ONLY returned for instrument type bidBasis or bidCash.)
A sequence of characters. (example: GOOG)
as requested
(ONLY returned for instrument type bidBasis or bidCash.)
A sequence of characters. (example: GOOG)
always returned
A sequence of characters. (example: GOOG)
as requested
A sequence of characters. (example: GOOG)
as requested
(ONLY returned for instrument type bidBasis or bidCash.)
A sequence of characters. (example: GOOG)
as requested
(ONLY returned for instrument type bidBasis or bidCash.)
A sequence of characters. (example: GOOG)
always returned
A sequence of characters. (example: GOOG)
as requested
(ONLY returned for instrument type indexBasis or indexCash.)
A sequence of characters. (example: GOOG)
as requested
(ONLY returned for instrument type indexBasis or indexCash.)
A sequence of characters. (example: GOOG)
as requested
(ONLY returned for instrument type indexBasis or indexCash.)
A sequence of characters. (example: GOOG)
as requested
(ONLY returned for instrument type bidBasis or bidCash.)
A sequence of characters. (example: GOOG)
as requested
(ONLY returned for instrument type bidBasis or bidCash.)
A sequence of characters. (example: GOOG)
always returned
A sequence of characters. (example: GOOG)
always returned
A sequence of characters. (example: GOOG)
always returned
A sequence of characters. (example: GOOG)
GET
GET https://ondemand.websol.barchart.com/getGrainInstruments.json?apikey=YOUR_API_KEY&instrumentType=indexBasis&instrumentRoot=ZC&deliveryMonth=202412&indexGroup=nation&country=US&maxRecords=25&page=1&locationId=4435
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getGrainInstruments.json
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&instrumentType=indexBasis&instrumentRoot=ZC&deliveryMonth=202412&indexGroup=nation&country=US&maxRecords=25&page=1&locationId=4435
Response
{
"status": {
"code": 200,
"message": "Success."
},
"results": [
{
"symbol": "ZCBZ24US.CM",
"symbolDescription": "US Corn Basis Idx Dec 2024",
"commodity": "Corn (#2 Yellow)",
"underlyingFuture": "ZCH25",
"deliveryEnd": "2024-12-31T17:59:59-06:00",
"state": "",
"county": "",
"indexGroup": "nation",
"country": "US",
"region": "",
"countyFipsCode": "",
"districtCode": "",
"stateFipsCode": ""
}
]
}
GET
GET https://ondemand.websol.barchart.com/getGrainInstruments.xml?apikey=YOUR_API_KEY&instrumentType=indexBasis&instrumentRoot=ZC&deliveryMonth=202412&indexGroup=nation&country=US&maxRecords=25&page=1&locationId=4435
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getGrainInstruments.xml
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&instrumentType=indexBasis&instrumentRoot=ZC&deliveryMonth=202412&indexGroup=nation&country=US&maxRecords=25&page=1&locationId=4435
Response
<?xml version="1.0" encoding="utf-8"?>
<getGrainInstruments>
<status>
<code>200</code>
<message>Success.</message>
</status>
<item>
<symbol>ZCBZ24US.CM</symbol>
<symbolDescription>US Corn Basis Idx Dec 2024</symbolDescription>
<commodity>Corn (#2 Yellow)</commodity>
<underlyingFuture>ZCH25</underlyingFuture>
<deliveryEnd>2024-12-31T17:59:59-06:00</deliveryEnd>
<state/>
<county/>
<indexGroup>nation</indexGroup>
<country>US</country>
<region/>
<countyFipsCode/>
<districtCode/>
<stateFipsCode/>
</item>
</getGrainInstruments>
GET
GET https://ondemand.websol.barchart.com/getGrainInstruments.csv?apikey=YOUR_API_KEY&instrumentType=indexBasis&instrumentRoot=ZC&deliveryMonth=202412&indexGroup=nation&country=US&maxRecords=25&page=1&locationId=4435
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getGrainInstruments.csv
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&instrumentType=indexBasis&instrumentRoot=ZC&deliveryMonth=202412&indexGroup=nation&country=US&maxRecords=25&page=1&locationId=4435
Response
symbol,symbolDescription,commodity,underlyingFuture,deliveryEnd,state,county,indexGroup,country,region,countyFipsCode,districtCode,stateFipsCode
"ZCBZ24US.CM","US Corn Basis Idx Dec 2024","Corn (#2 Yellow)","ZCH25","2024-12-31T17:59:59-06:00","","","nation","US","","","",""
<?php
$ondemand = new SoapClient('https://ondemand.websol.barchart.com/service?wsdl');
$params = [
'apikey' => 'YOUR_API_KEY',
'instrumentType' => 'indexBasis',
'instrumentRoot' => 'ZC',
'deliveryMonth' => '202412',
'indexGroup' => 'nation',
'country' => 'US',
'maxRecords' => '25',
'page' => '1',
'locationId' => '4435',
];
$result = $ondemand->getGrainInstruments($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.getGrainInstruments("YOUR_API_KEY", "indexBasis", "ZC", "202412", "nation", "US", "25", "1", "4435")
use SOAP::Lite;
use SOAP::WSDL;
my $ondemand = SOAP::Lite
-> service('https://ondemand.websol.barchart.com/service?wsdl');
my $result = $ondemand->getGrainInstruments('YOUR_API_KEY', 'indexBasis', 'ZC', '202412', 'nation', 'US', '25', '1', '4435');
print $result;
from suds.client import Client
ondemand = Client('https://ondemand.websol.barchart.com/service?wsdl')
result = ondemand.service.getGrainInstruments('YOUR_API_KEY', 'indexBasis', 'ZC', '202412', 'nation', 'US', '25', '1', '4435')
print(result)
require 'savon'
ondemand = Savon.client(wsdl: 'https://ondemand.websol.barchart.com/service?wsdl')
response = ondemand.call(
:getGrainInstruments,
message: {
apikey: 'YOUR_API_KEY',
instrumentType: 'indexBasis',
instrumentRoot: 'ZC',
deliveryMonth: '202412',
indexGroup: 'nation',
country: 'US',
maxRecords: '25',
page: '1',
locationId: '4435',
}
)
response.body