getGrainBids API

The getGrainBids API provides cashbid data for 30 closest locations in relation to the requested zip code. Learn more about Barchart's proprietary commodity data and grain cmdtyIndexes.

All APIs

Contact Us to Get Access


Inputs

zipCode optional

A valid zip code.

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

bidsPerCom optional

Number of total bids to be returned for each location.

Type
integer (A numeric type defining a whole number. (example: 2)) 
Example
Default

totalLocations optional

Number of total closest locations to be returned based of the searched zip code.

Type
integer (A numeric type defining a whole number. (example: 2)) 
Example
Default
30 

getAllBids optional

Return all bids for the location, instead of old crop and new crop bids.

Type
boolean (A logical type representing the truth of a value as 'true' or 'false'.) 

numOfDecimals optional

Set the number of decimals to be returned for the cash price and basis fields.

Type
integer (A numeric type defining a whole number. (example: 2)) 
Example
Default

location optional

The location id for which cash bid data is requested

Type
integer (A numeric type defining a whole number. (example: 2)) 

companyName optional

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

getAllLocations optional

Type
integer (A numeric type defining a whole number. (example: 2)) 

maxDistance optional

The max distance within which the locations should be search for.

Type
double (A numeric type defining a number with fractional parts. (example: 2.14)) 

rawDistance optional

To return the raw distance value, without appending "miles away" string

Type
boolean (A logical type representing the truth of a value as 'true' or 'false'.) 

county optional

The County name with state abbreviation separated by a hyphen for which cash bid data is requested

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

fields optional

Additional output fields requested.

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

Outputs

Name / Requirement
Description
Type
bids
always returned
An array with all bids.
enum
A type which includes a list of valid possible values.
distance
always returned
Distance in miles from the searched zip code.
string
A sequence of characters. (example: GOOG)
company
always returned
The grain company name
string
A sequence of characters. (example: GOOG)
elevatorId
as requested
The elevator id
int
A numeric type defining a whole number. (example: 2)
locationId
always returned
The location id
int
A numeric type defining a whole number. (example: 2)
location
always returned
The location name
string
A sequence of characters. (example: GOOG)
facility_type
always returned
The type of facility
string
A sequence of characters. (example: GOOG)
address
always returned
The street address of the location
string
A sequence of characters. (example: GOOG)
city
always returned
The city in which the location is located
string
A sequence of characters. (example: GOOG)
state
always returned
The state in which the location is located
string
A sequence of characters. (example: GOOG)
lng
always returned
The longitude of the location
double
A numeric type defining a number with fractional parts. (example: 2.14)
lat
always returned
The latitude of the location
double
A numeric type defining a number with fractional parts. (example: 2.14)
phone
always returned
The phone number for the location
string
A sequence of characters. (example: GOOG)
url
always returned
The public website of the grain company
string
A sequence of characters. (example: GOOG)
zip
always returned
The zip code for the location
string
A sequence of characters. (example: GOOG)
county
always returned
The county in which the location falls.
string
A sequence of characters. (example: GOOG)
county_code
as requested
County code consisting of State FIPS and County FIPS.
string
A sequence of characters. (example: GOOG)
fips_code
as requested
The FIPS formula that can be used with google fusion tables to retrieve the boundary coordinates for a county.
double
A numeric type defining a number with fractional parts. (example: 2.14)
crop_district
as requested
The crop district code.
string
A sequence of characters. (example: GOOG)
basisTimestamp
always returned
Time when basis was last updated for given elevator
dateTime
A date and time in the format of YYYY-MM-DD HH:MI:SS<TIMEZONE_OFFSET>.

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/getGrainBids.json?apikey=YOUR_API_KEY&zipCode=60606&bidsPerCom=2&totalLocations=1&getAllBids=0&numOfDecimals=2
Host: ondemand.websol.barchart.com

POST

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

apikey=YOUR_API_KEY&zipCode=60606&bidsPerCom=2&totalLocations=1&getAllBids=0&numOfDecimals=2

Response

{
    "status": {
        "code": 200,
        "message": "Success."
    },
    "results": [
        {
            "bids": [
                {
                    "id": "7234503",
                    "commodity": "Yellow Corn",
                    "symbol": "ZCN18",
                    "delivery_start": "2018-05-01 00:00:00",
                    "delivery_end": "2018-05-31 23:59:59",
                    "basis": "-3.00",
                    "notes": null,
                    "active": true,
                    "sym_root": "ZC",
                    "commodity_id": "102567",
                    "commodity_display_name": "Corn (#2 Yellow)",
                    "unitvalue": 1,
                    "unitweight": 56,
                    "deliveryMonth": "May18",
                    "deliveryYear": "2018",
                    "basismonth": "Jul 2018",
                    "timestamp": 1527184543,
                    "as_of": "12:55",
                    "price": "4.02",
                    "pricecwt": "7.174107",
                    "basiscwt": -5.35714285714,
                    "pricetonne": "158.161801",
                    "basistonne": -118.104642857,
                    "change": "-0.0375",
                    "rawchange": -0.0375,
                    "pctchange": "-0.92",
                    "cashprice": "4.02",
                    "cashpricetonne": "158.161801",
                    "delivery_sort": "2018-05-01 00:00:00",
                    "delivery_start_raw": "2018-05-01 00:00:00",
                    "delivery_end_raw": "2018-05-31 23:59:59"
                },
                {
                    "id": "6073711",
                    "commodity": "Yellow Corn",
                    "symbol": "ZCZ18",
                    "delivery_start": "2018-10-01 00:00:00",
                    "delivery_end": "2018-10-31 23:59:59",
                    "basis": "-15.00",
                    "notes": null,
                    "active": true,
                    "sym_root": "ZC",
                    "commodity_id": "102567",
                    "commodity_display_name": "Corn (#2 Yellow)",
                    "unitvalue": 1,
                    "unitweight": 56,
                    "deliveryMonth": "Oct18",
                    "deliveryYear": "2018",
                    "basismonth": "Dec 2018",
                    "timestamp": 1527184541,
                    "as_of": "12:55",
                    "price": "4.08",
                    "pricecwt": "7.28125",
                    "basiscwt": -26.7857142857,
                    "pricetonne": "160.523894",
                    "basistonne": -590.523214286,
                    "change": "-0.0375",
                    "rawchange": -0.0375,
                    "pctchange": "-0.91",
                    "cashprice": "4.08",
                    "cashpricetonne": "160.523894",
                    "delivery_sort": "2018-10-01 00:00:00",
                    "delivery_start_raw": "2018-10-01 00:00:00",
                    "delivery_end_raw": "2018-10-31 23:59:59"
                }
            ],
            "distance": "15 miles away",
            "company": "Cargill US",
            "locationId": 37865,
            "location": "Hammond, SSNA",
            "facility_type": "Country Elevator",
            "address": "1100 Indianapolis Blvrd",
            "city": "Hammond",
            "state": "IN",
            "lng": -87.51411,
            "lat": 41.69292,
            "phone": "219-473-2298",
            "url": "www.cargillag.com",
            "zip": "46320",
            "county": "Lake County",
            "basisTimestamp": "2018-05-24T13:02:58-05:00"
        }
    ]
}

XML

GET

GET https://ondemand.websol.barchart.com/getGrainBids.xml?apikey=YOUR_API_KEY&zipCode=60606&bidsPerCom=2&totalLocations=1&getAllBids=0&numOfDecimals=2
Host: ondemand.websol.barchart.com

POST

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

apikey=YOUR_API_KEY&zipCode=60606&bidsPerCom=2&totalLocations=1&getAllBids=0&numOfDecimals=2

Response


<?xml version="1.0" encoding="utf-8"?>
 <getGrainBids>
  <status>
   <code>200</code>
   <message>Success.</message>
  </status>
  <item>
   <bids>
    <bid>
     <id>7234503</id>
     <commodity>Yellow Corn</commodity>
     <symbol>ZCN18</symbol>
     <delivery_start>2018-05-01 00:00:00</delivery_start>
     <delivery_end>2018-05-31 23:59:59</delivery_end>
     <basis>-3.00</basis>
     <notes></notes>
     <active>1</active>
     <sym_root>ZC</sym_root>
     <commodity_id>102567</commodity_id>
     <commodity_display_name>Corn (#2 Yellow)</commodity_display_name>
     <unitvalue>1</unitvalue>
     <unitweight>56</unitweight>
     <deliveryMonth>May18</deliveryMonth>
     <deliveryYear>2018</deliveryYear>
     <basismonth>Jul 2018</basismonth>
     <timestamp>1527184543</timestamp>
     <as_of>12:55</as_of>
     <price>4.02</price>
     <pricecwt>7.174107</pricecwt>
     <basiscwt>-5.35714285714</basiscwt>
     <pricetonne>158.161801</pricetonne>
     <basistonne>-118.104642857</basistonne>
     <change>-0.0375</change>
     <rawchange>-0.0375</rawchange>
     <pctchange>-0.92</pctchange>
     <cashprice>4.02</cashprice>
     <cashpricetonne>158.161801</cashpricetonne>
     <delivery_sort>2018-05-01 00:00:00</delivery_sort>
     <delivery_start_raw>2018-05-01 00:00:00</delivery_start_raw>
     <delivery_end_raw>2018-05-31 23:59:59</delivery_end_raw>
    </bid>
    <bid>
     <id>6073711</id>
     <commodity>Yellow Corn</commodity>
     <symbol>ZCZ18</symbol>
     <delivery_start>2018-10-01 00:00:00</delivery_start>
     <delivery_end>2018-10-31 23:59:59</delivery_end>
     <basis>-15.00</basis>
     <notes></notes>
     <active>1</active>
     <sym_root>ZC</sym_root>
     <commodity_id>102567</commodity_id>
     <commodity_display_name>Corn (#2 Yellow)</commodity_display_name>
     <unitvalue>1</unitvalue>
     <unitweight>56</unitweight>
     <deliveryMonth>Oct18</deliveryMonth>
     <deliveryYear>2018</deliveryYear>
     <basismonth>Dec 2018</basismonth>
     <timestamp>1527184541</timestamp>
     <as_of>12:55</as_of>
     <price>4.08</price>
     <pricecwt>7.28125</pricecwt>
     <basiscwt>-26.7857142857</basiscwt>
     <pricetonne>160.523894</pricetonne>
     <basistonne>-590.523214286</basistonne>
     <change>-0.0375</change>
     <rawchange>-0.0375</rawchange>
     <pctchange>-0.91</pctchange>
     <cashprice>4.08</cashprice>
     <cashpricetonne>160.523894</cashpricetonne>
     <delivery_sort>2018-10-01 00:00:00</delivery_sort>
     <delivery_start_raw>2018-10-01 00:00:00</delivery_start_raw>
     <delivery_end_raw>2018-10-31 23:59:59</delivery_end_raw>
    </bid>
   </bids>
   <distance>15 miles away</distance>
   <company>Cargill US</company>
   <locationId>37865</locationId>
   <location>Hammond, SSNA</location>
   <facility_type>Country Elevator</facility_type>
   <address>1100 Indianapolis Blvrd</address>
   <city>Hammond</city>
   <state>IN</state>
   <lng>-87.51411</lng>
   <lat>41.69292</lat>
   <phone>219-473-2298</phone>
   <url>www.cargillag.com</url>
   <zip>46320</zip>
   <county>Lake County</county>
   <basisTimestamp>2018-05-24T13:02:58-05:00</basisTimestamp>
  </item>
 </getGrainBids>

CSV

GET

GET https://ondemand.websol.barchart.com/getGrainBids.csv?apikey=YOUR_API_KEY&zipCode=60606&bidsPerCom=2&totalLocations=1&getAllBids=0&numOfDecimals=2
Host: ondemand.websol.barchart.com

POST

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

apikey=YOUR_API_KEY&zipCode=60606&bidsPerCom=2&totalLocations=1&getAllBids=0&numOfDecimals=2

Response

id,commodity,symbol,delivery_start,delivery_end,basis,notes,active,sym_root,commodity_id,commodity_display_name,unitvalue,unitweight,deliveryMonth,deliveryYear,basismonth,timestamp,as_of,price,pricecwt,basiscwt,pricetonne,basistonne,change,rawchange,pctchange,cashprice,cashpricetonne,delivery_sort,delivery_start_raw,delivery_end_raw,distance,company,elevatorId,locationId,location,address,city,state,lng,lat,phone,url,zip,basis_as_of,county,county_code,fips_code,crop_district,facility_type,basisTimestamp
"7234503","Yellow Corn","ZCN18","2018-05-01 00:00:00","2018-05-31 23:59:59","-3.00","","1","ZC","102567","Corn (#2 Yellow)","1","56","May18","2018","Jul 2018","1527184543","12:55","4.02","7.174107","-5.35714285714","158.161801","-118.104642857","-0.0375","-0.0375","-0.92","4.02","158.161801","2018-05-01 00:00:00","2018-05-01 00:00:00","2018-05-31 23:59:59","15 miles away","Cargill US","1789","37865","Hammond, SSNA","1100 Indianapolis Blvrd","Hammond","IN","-87.514110000","41.692920000","219-473-2298","www.cargillag.com","46320","2018-05-24 13:02:58","Lake County","IN-18-089-H1","18089","D10","Country Elevator","2018-05-24T13:02:58-05:00"
"6073711","Yellow Corn","ZCZ18","2018-10-01 00:00:00","2018-10-31 23:59:59","-15.00","","1","ZC","102567","Corn (#2 Yellow)","1","56","Oct18","2018","Dec 2018","1527184541","12:55","4.08","7.28125","-26.7857142857","160.523894","-590.523214286","-0.0375","-0.0375","-0.91","4.08","160.523894","2018-10-01 00:00:00","2018-10-01 00:00:00","2018-10-31 23:59:59","15 miles away","Cargill US","1789","37865","Hammond, SSNA","1100 Indianapolis Blvrd","Hammond","IN","-87.514110000","41.692920000","219-473-2298","www.cargillag.com","46320","2018-05-24 13:02:58","Lake County","IN-18-089-H1","18089","D10","Country Elevator","2018-05-24T13:02:58-05:00"


PHP

<?php

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

$params = [
    'apikey' => 'YOUR_API_KEY',
    'zipCode' => '60606',
    'bidsPerCom' => '2',
    'totalLocations' => '1',
    'getAllBids' => '',
    'numOfDecimals' => '2',
];

$result = $ondemand->getGrainBids($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.getGrainBids("YOUR_API_KEY", "60606", "2", "1", "", "2")

Perl

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

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

my $result = $ondemand->getGrainBids('YOUR_API_KEY', '60606', '2', '1', '', '2');

print $result;

Python

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

result = client.service.getGrainBids('YOUR_API_KEY', '60606', '2', '1', '', '2')

print result

Ruby

require 'savon'

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

response = ondemand.call(
    :getGrainBids,
    message: {
        apikey: 'YOUR_API_KEY',
        zipCode: '60606',
        bidsPerCom: '2',
        totalLocations: '1',
        getAllBids: '',
        numOfDecimals: '2',
    }
)

response.body