Cash Grain Bid API

getGrainBids

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

By submitting this form you are opting in to receive email communications from Barchart for related product, service or company information, updates and announcements. You can unsubscribe at anytime. View our Privacy Policy.

Inputs

requestType optional

The type of request that is being requested in order to determine the type of data to be returned.

Type
enum (A type which includes a list of valid possible values.) 
Default
bids 

Valid Values:
commodities, locations, bids

location optional

A location id or a code identifies a or multiple grain buying location(s) that cash bid will be returned for. A valid code consist of multiple location ids separated by a comma, and the code can contain up to 100 locations. A list of valid location ids can be retrieved by using this API with input: requestType = location. location and several other inputs -geographic coordinates, zipCode, maxDistance, county, totalLocations- are mutually exclusive.

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

latitude optional

The latitude of a valid geographic coordinates to define the center of area that cashbid will be returned for. Geographic coordinates and Zipcode are mutually exclusive.

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

longitude optional

The longitude of a valid geographic coordinates to define the center of area that cashbid will be returned for. Geographic coordinates and Zipcode are mutually exclusive.

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

zipCode optional

A valid US or Canadian zip code to define the area that cash bids orginate from.

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

maxDistance optional

The maximum distance from searched zipcode or the requested geo coordinates in miles. This input helps to define the area that cash bids will be returned from. Maximum value is 250.

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

county optional

A valid string code which represents the concatenation of county name and state code seperated by a hyphen.

Type
string (A sequence of characters. (example: GOOG)) 
Example
BOONE COUNTY-IA 

fipsCode optional

A concatenation of state FIPS code and county FIPS code without separator to define the county that cash bids will be returned for. Please click here to get a list of possible values.

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

commodityName optional

A standard commodity name or a name list that separated by pipe (|) to filter cashbid. Note that the input need to be encoded in UTF-8. A list of valid commodity names can be retrieved by using this API with input: requestType = commodities.

Type
list (A comma or semi-colon delimited string.) 
Example
Soybeans|Corn (#2 Yellow) 

totalLocations optional

The maximum number of locations to be returned based of the zip code provided by the user. Default value is 30.

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

getAllBids optional

Return all cash bids for each location.

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

bidsPerCom optional

The maximum number of cash bids to be returned for each commodity per location. This parameter should be set to the maximum number of cash bids the user wishes to be returned.

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

numOfDecimals optional

The level of precision in decimal places of price and basis to be returned.

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

fields optional

Additional as per-requested fields that the user can define. Requested fields should be separated by a comma.

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

deliveryStart optional

The start date for the delivery period for qualified bids.

Type
dateTime (A date and time in the format of YYYY-MM-DD HH:MI:SS<TIMEZONE_OFFSET>.) 

deliveryEnd optional

The end date for the delivery period for qualified bids.

Type
dateTime (A date and time in the format of YYYY-MM-DD HH:MI:SS<TIMEZONE_OFFSET>.) 

Outputs

Name / Requirement
Description
Type
bids
always returned
A list of cash bids from a grain buying location. Each cash bid contains the meta and price data applicable to that location.
enum
A type which includes a list of valid possible values.
distance
always returned
Distance of the elevator in miles from the input zip code.
string
A sequence of characters. (example: GOOG)
company
always returned
Name of the applicable grain buying elevator.
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
Name of location that grain bid originated from.
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
City associated with the underlying grain bid.
string
A sequence of characters. (example: GOOG)
state
always returned
2-char abbreviation of the state that contains the applicable cash bid.
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 name of the county containing the applicable cash bid.
string
A sequence of characters. (example: GOOG)
county_code
as requested
Concatenation of stateFipsCode, countyFipsCode, and classFipsCode.
string
A sequence of characters. (example: GOOG)
fips_code
as requested
FIPS code for the county. Concatenation of stateFipsCode and countyFipsCode.
double
A numeric type defining a number with fractional parts. (example: 2.14)
crop_district
as requested
District code of crop reporting district that is associated with the applicable cash bid.
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>.
commodities
as requested
enum
A type which includes a list of valid possible values.
basisTimestampRaw
always returned
Unix timestamp when basis was last updated for the given elevator.
int
A numeric type defining a whole number. (example: 2)

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.




PHP

<?php

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

$params = [
    'apikey' => 'YOUR_API_KEY',
    'latitude' => '',
    'longitude' => '',
    'zipCode' => '60606',
    'county' => 'BOONE COUNTY-IA',
    'fipsCode' => '17053',
    'commodityName' => 'Soybeans|Corn (#2 Yellow)',
    'bidsPerCom' => '2',
    '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", "BOONE COUNTY-IA", "17053", "Soybeans|Corn (#2 Yellow)", "2", "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', 'BOONE COUNTY-IA', '17053', 'Soybeans|Corn (#2 Yellow)', '2', '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', 'BOONE COUNTY-IA', '17053', 'Soybeans|Corn (#2 Yellow)', '2', '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',
        latitude: '',
        longitude: '',
        zipCode: '60606',
        county: 'BOONE COUNTY-IA',
        fipsCode: '17053',
        commodityName: 'Soybeans|Corn (#2 Yellow)',
        bidsPerCom: '2',
        numOfDecimals: '2',
    }
)

response.body