Economic Data API
getCmdtyStats
The getCmdtyStats API is used to request information on various fundamentals, commodity statistics, and economic data. Users can request information by data series with historical information available through to inception for most series. cmdtyStats™ is the premier source of aggregated commodity statistics – all made available in one easy to use API.
View All APIssymbolrequired
A unique symbol that identifies a data series.
USDA-SOYB-PROD-MS-96.CS
startDateoptional
The start date of the historical data query. This parameter should be set to the desired start date/time for the query (the result set will include records back to, and including, this value). If not set, the value will default to the 1 year back from current data. Note that if the date range requested by the user is more extensive than the user's permissions allow for, the output range will be determined based on an offset from the startDate.
20231030
endDateoptional
The end date of the historical data query. This parameter should be set to the desired end date/time for the query (the result set will include records back to, and including, this value). If not set, the value will default to the last day of current year. Note that if the date range requested by the user is more extensive than the user's permissions allow for, the output range will be determined based on an offset from the startDate.
20241030
orderoptional
An arrangement of fields within a particular record (ascending or descending). This parameter can be set to one of two values ("asc" and "desc") in order to specify the chronological order of the result set returned.
asc
always returned
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)
always returned
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)
as requested
A type which includes a list of valid possible values.
always returned
A sequence of characters. (example: GOOG)
always returned
A sequence of characters. (example: GOOG)
always returned
A numeric type defining a whole number. (example: 2)
always returned
A sequence of characters. (example: GOOG)
always returned
A sequence of characters. (example: GOOG)
always returned
A type which includes a list of valid possible values.
as requested
A type which includes a list of valid possible values.
always returned
A sequence of characters. (example: GOOG)
always returned
A date in the format of YYYY-MM-DD.
always returned
A type which includes a list of valid possible values.
GET
GET https://ondemand.websol.barchart.com/getCmdtyStats.json?apikey=YOUR_API_KEY&symbol=USDA-SOYB-PROD-MS-96.CS&startDate=20231030&endDate=20241030&order=asc
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getCmdtyStats.json
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&symbol=USDA-SOYB-PROD-MS-96.CS&startDate=20231030&endDate=20241030&order=asc
Response
{
"status": {
"code": 200,
"message": "Success."
},
"results": [
{
"symbol": "USDA-SOYB-PROD-MS-96.CS",
"shortSymbol": "UD09002O.CS",
"shortName": "MS Soybeans PROD",
"mediumName": "MS Soybeans PROD",
"longName": "MS Soybeans Production",
"seriesDescription": "Soybeans;Production,Annual,Bushel;Mississippi;Soybeans for Beans Area Harvested, Yield, and Production",
"item": "Soybeans",
"measurement": "Production",
"frequency": "Annual",
"unit": "Bushel",
"multiplier": 1,
"area": "Mississippi",
"areaType": "State",
"sources": [
"USDA",
"NASS",
"Crop Production",
"Soybeans for Beans Area Harvested, Yield, and Production",
"NASS Crops"
],
"unitDescription": "Bushel",
"lastRefresh": "2024-10-03",
"stats": [
{
"date": "2023-12-31",
"value": "119280000"
}
]
}
]
}
GET
GET https://ondemand.websol.barchart.com/getCmdtyStats.xml?apikey=YOUR_API_KEY&symbol=USDA-SOYB-PROD-MS-96.CS&startDate=20231030&endDate=20241030&order=asc
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getCmdtyStats.xml
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&symbol=USDA-SOYB-PROD-MS-96.CS&startDate=20231030&endDate=20241030&order=asc
Response
<?xml version="1.0" encoding="utf-8"?>
<getCmdtyStats>
<status>
<code>200</code>
<message>Success.</message>
</status>
<item>
<symbol>USDA-SOYB-PROD-MS-96.CS</symbol>
<shortSymbol>UD09002O.CS</shortSymbol>
<shortName>MS Soybeans PROD</shortName>
<mediumName>MS Soybeans PROD</mediumName>
<longName>MS Soybeans Production</longName>
<seriesDescription>Soybeans;Production,Annual,Bushel;Mississippi;Soybeans for Beans Area Harvested, Yield, and Production</seriesDescription>
<item>Soybeans</item>
<measurement>Production</measurement>
<frequency>Annual</frequency>
<unit>Bushel</unit>
<multiplier>1</multiplier>
<area>Mississippi</area>
<areaType>State</areaType>
<sources>
<source>USDA</source>
<source>NASS</source>
<source>Crop Production</source>
<source>Soybeans for Beans Area Harvested, Yield, and Production</source>
<source>NASS Crops</source>
</sources>
<unitDescription>Bushel</unitDescription>
<lastRefresh>2024-10-03</lastRefresh>
<stats>
<stat>
<date>2023-12-31</date>
<value>119280000</value>
</stat>
</stats>
</item>
</getCmdtyStats>
GET
GET https://ondemand.websol.barchart.com/getCmdtyStats.csv?apikey=YOUR_API_KEY&symbol=USDA-SOYB-PROD-MS-96.CS&startDate=20231030&endDate=20241030&order=asc
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getCmdtyStats.csv
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&symbol=USDA-SOYB-PROD-MS-96.CS&startDate=20231030&endDate=20241030&order=asc
Response
date,value,symbol,shortSymbol,shortName,mediumName,longName,seriesDescription,item,measurement,frequency,unit,multiplier,area,areaType,sources,unitDescription,lastRefresh
"2023-12-31","119280000","USDA-SOYB-PROD-MS-96.CS","UD09002O.CS","MS Soybeans PROD","MS Soybeans PROD","MS Soybeans Production","Soybeans;Production,Annual,Bushel;Mississippi;Soybeans for Beans Area Harvested, Yield, and Production","Soybeans","Production","Annual","Bushel","1","Mississippi","State","USDA|NASS|Crop Production|Soybeans for Beans Area Harvested, Yield, and Production|NASS Crops","Bushel","2024-10-03"
<?php
$ondemand = new SoapClient('https://ondemand.websol.barchart.com/service?wsdl');
$params = [
'apikey' => 'YOUR_API_KEY',
'symbol' => 'USDA-SOYB-PROD-MS-96.CS',
'startDate' => '20231030',
'endDate' => '20241030',
'order' => 'asc',
];
$result = $ondemand->getCmdtyStats($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.getCmdtyStats("YOUR_API_KEY", "USDA-SOYB-PROD-MS-96.CS", "20231030", "20241030", "asc")
use SOAP::Lite;
use SOAP::WSDL;
my $ondemand = SOAP::Lite
-> service('https://ondemand.websol.barchart.com/service?wsdl');
my $result = $ondemand->getCmdtyStats('YOUR_API_KEY', 'USDA-SOYB-PROD-MS-96.CS', '20231030', '20241030', 'asc');
print $result;
from suds.client import Client
ondemand = Client('https://ondemand.websol.barchart.com/service?wsdl')
result = ondemand.service.getCmdtyStats('YOUR_API_KEY', 'USDA-SOYB-PROD-MS-96.CS', '20231030', '20241030', 'asc')
print(result)
require 'savon'
ondemand = Savon.client(wsdl: 'https://ondemand.websol.barchart.com/service?wsdl')
response = ondemand.call(
:getCmdtyStats,
message: {
apikey: 'YOUR_API_KEY',
symbol: 'USDA-SOYB-PROD-MS-96.CS',
startDate: '20231030',
endDate: '20241030',
order: 'asc',
}
)
response.body