# Commodity Futures Data API - Quotes, History, Options, Barchart (`nabeelbaghoor/commodity-futures-market-data-api`) Actor

Commodity and futures market data from your own Barchart OnDemand key: real-time or delayed quotes, OHLC price history, futures options with greeks, contract specs, expirations, all futures on an exchange, local grain cash bids, USDA grain prices and commodity statistics. Read only.

- **URL**: https://apify.com/nabeelbaghoor/commodity-futures-market-data-api.md
- **Developed by:** [Nabeel Hassan](https://apify.com/nabeelbaghoor) (community)
- **Categories:** Business, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 quote, price bar or futures option returneds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Commodity Futures Data API - Quotes, History, Options, Barchart

Pull commodity and futures quotes, price history, options on futures, contract specifications, expirations, local grain cash bids, USDA grain prices and commodity statistics from Barchart OnDemand into a dataset, a spreadsheet or a warehouse. Uses your own Barchart OnDemand API key, reads only, and charges only for rows that carry data.

### What it collects

- **Quotes**: last price, net and percent change, open, high, low, close, volume, previous close and volume, trade time, real-time, delayed or end-of-day mode, and on request open interest, settlement, previous settlement, expiration date, last trading day, 52 week high and low, exchange margin and implied volatility. Futures, stocks, indexes, ETFs, currencies and crypto, by symbol, with Barchart's futures notation: `ZC*1` for the front corn contract, `ZC^F` for every corn contract.
- **Price history**: ticks, minute bars, or daily, weekly, monthly, quarterly and yearly OHLC bars with volume and open interest, for one contract, a nearest futures series that rolls through the front months (with nearby offset, roll timing and back adjustment), or a continuation series.
- **Futures by exchange**: a quote for every futures contract listed on CBOT, CME, NYMEX, COMEX, ICE US, EUREX, LIFFE, MATIF, BMF, SAFEX and 50 more exchanges, optionally for one category such as Grains or Meats.
- **Futures options**: every option on a futures root or contract, with strike, expiration, last, change, premium, volume, open interest, implied volatility and delta, gamma, theta and vega.
- **Futures specifications**: contract name, size, months traded, tick value, point value, trading hours, exchange margin and daily limit, by root, exchange or category.
- **Futures expirations**: first notice date, expiration date and last trading day rule for each contract.
- **Grain cash bids**: cash price, basis, futures month, change and delivery period from local elevators, processors and terminals around a ZIP code, a point, a county or a list of locations, with each buyer's company, address, phone, coordinates and distance.
- **USDA grain prices**: USDA reported export, processor, river, terminal and barge loading bids for corn, soybeans, wheat classes, oats, soybean meal and soybean oil, with low and high price and basis.
- **Commodity statistics**: dated values of statistics series such as USDA crop production, yield and stocks, with the item, measurement, unit, area and sources.
- Read only, pay per result, bring your own key.

### How to use it

1. Get a Barchart OnDemand API key: Barchart issues one with an OnDemand subscription. The APIs and exchanges you can read are what your subscription includes.
2. Paste the key into the **API key** field (stored as a secret), or set the `DATA_API_KEY` environment secret on the actor.
3. Pick **What to read**, fill in the symbols, roots, exchange or place it needs, and start the run.

A run without a key ends cleanly with a message asking for one, before any request is sent.

### Input

| Field | What it does |
| --- | --- |
| What to read | Quotes (default), price history, futures by exchange, futures options, futures specifications, futures expirations, grain cash bids, USDA grain prices or commodity statistics. |
| Symbols | Barchart symbols for quotes and history (`ZC*1`, `CLZ26`, `GC^F`, `AAPL`), option symbols for futures options, series symbols for statistics. |
| Futures roots, Futures contracts | `ZC`, `CL`, `GC`, or `ZCN26`, for options, specifications and expirations. |
| Exchange, Category | Futures by exchange (required), options and specifications. |
| Futures categories | Specifications: energies, financials, grains, indices, meats, metals, softs, currencies. |
| Extra output fields | Optional fields to add to quotes, futures by exchange, options and expirations, such as `openInterest` or `settlement`. |
| History type, Start date, End date, Sort order, Minutes per bar, Volume, Nearby contract, Back adjust, Roll days before expiration, Contract roll | Price history. |
| Option type, Option expiration month, Option expiration day | Futures options filters. |
| ZIP code, Latitude, Longitude, Maximum distance, County, County FIPS code, Location ids, Commodities, Number of locations, Bids per commodity, All bids, Delivery from, Delivery until | Grain cash bids. |
| USDA commodity types, USDA bid types | USDA grain prices filters. |
| Maximum results | Row cap for the whole run. |
| Requests per minute | Pacing. |
| API key | Your Barchart OnDemand API key, as a secret. |

### Access and limits on the Barchart side

- Every API reads only what your OnDemand subscription includes. Real-time exchange data needs the matching exchange entitlements; otherwise quotes come back delayed or end-of-day, and the `provider_mode` column says which.
- Grain cash bids take one area per run. Location ids exclude the ZIP code, point, distance, county and location count, and a point excludes the ZIP code; the actor leaves the losing inputs off and says so in the log rather than sending a combination the provider would narrow silently.
- Some APIs check their required inputs before the key, so a refused request does not confirm the key is good. The run says so when that happens.
- Your Barchart agreement and the exchanges' rules decide what you may do with the data. Exchange market data is licensed per user and per use, and displaying or redistributing it to others usually needs a separate license and exchange fees. This actor does not change those terms.

### FAQ

#### What is Barchart OnDemand?

Barchart OnDemand is Barchart's market data API at ondemand.websol.barchart.com. It serves quotes and history for futures, stocks, indexes, currencies and crypto, futures and options reference data, grain cash bids, USDA data, news and fundamentals, documented one API per page at barchart.com/ondemand/api. This actor wraps the commodity and futures APIs among them. The docs and the live host were checked on 2026-10-06.

#### Do I need a Barchart account?

Yes. This actor is bring-your-own-key and never ships one. A missing or refused key ends the run cleanly with a message saying which it was, and an API your subscription does not include is reported the same way.

#### How do I get the front month corn, crude oil and gold prices?

Pick quotes and set the symbols to `ZC*1`, `CL*1` and `GC*1`. Add `openInterest`, `settlement` and `expirationDate` to the extra output fields for the futures specific columns.

#### How do I get a continuous daily history of a futures contract?

Pick price history, set the symbol to the root with a nearby offset such as `ZC*1`, or set the history type to Daily nearest with the root `ZC` and choose the nearby contract, the roll days and back adjustment. Set a start and end date.

#### Can I get local grain cash prices and basis?

Yes. Pick grain cash bids and set a ZIP code, for example a farm's ZIP code, plus the commodities you want. Each row is one cash bid at one elevator or processor, with the cash price, basis, futures month, delivery period and the buyer's address and distance.

#### Is my key safe?

The key is sent in the POST body the provider documents, never in a URL, is never logged, and is stripped from any error text.

#### How is it priced?

Pay per result: a low price per quote, price bar, futures option, contract specification, expiration or statistic, and a higher price per grain cash bid or USDA grain price. Requests that find nothing are free. Your Barchart subscription applies separately.

### Example output

```json
{
  "mode": "quote",
  "modeLabel": "Quotes",
  "recordType": "quote",
  "query": "ZC*1,CL*1",
  "found": true,
  "id": "ZCZ26",
  "symbol": "ZCZ26",
  "name": "Corn",
  "date": "2026-10-05T13:20:00-05:00",
  "price": 421.25,
  "exchange": "CBOT",
  "retrievedAt": "2026-10-06T09:14:52.118Z",
  "note": null,
  "dayCode": "5",
  "serverTimestamp": "2026-10-05T19:52:00-05:00",
  "provider_mode": "i",
  "lastPrice": 421.25,
  "tradeTimestamp": "2026-10-05T13:20:00-05:00",
  "netChange": -2.5,
  "percentChange": -0.59,
  "unitCode": "2",
  "open": 423.75,
  "high": 425,
  "low": 420.5,
  "close": 421.25,
  "numTrades": 61234,
  "flag": "s",
  "volume": 182340,
  "previousVolume": 176210,
  "openInterest": 712455,
  "settlement": 421.25,
  "expirationDate": "2026-12-14"
}
```

Values are illustrative; every field is one the provider documents. Option rows carry `strike`, `type`, `premium`, `impliedVolatility` and the greeks; grain bid rows carry `cashprice`, `basis`, `basismonth`, `delivery_start` and the location columns `company`, `locationName`, `city`, `state`, `zip` and `distance`.

### Keyword map

commodity futures API, futures market data API, commodity price API, futures quotes, futures price history, continuous futures data, futures options data, options greeks, futures contract specifications, futures expiration dates, first notice date, grain cash bids API, grain basis data, USDA grain prices, corn price data, soybean price data, crude oil futures data, gold futures price, CBOT CME NYMEX COMEX data, Barchart OnDemand API, getQuote, getHistory, getGrainBids.

# Actor input Schema

## `mode` (type: `string`):

Quotes reads the latest real-time, delayed or end-of-day quote of each symbol. Price history reads ticks, minute bars or daily to yearly bars of each symbol, including nearest and continuation futures series. Futures by exchange quotes every contract on one exchange. Futures options reads options on a futures root or contract with greeks. Specifications and expirations read futures contract reference data. Grain cash bids reads local elevator and processor bids around a place. USDA grain prices reads USDA reported cash grain bids. Commodity statistics reads dated values of statistics series.

## `symbols` (type: `array`):

Quotes, price history, futures options (option symbols) and commodity statistics (series symbols). Barchart symbols, one per line: ZC*1 is the front corn contract, ZC*2 the second, ZC^F every corn contract, CLZ26 one contract, GC\*0 the active gold contract; stocks, indexes, currencies and crypto use their Barchart symbols such as AAPL or $SPX. Statistics series look like USDA-SOYB-PROD-MS-96.CS.

## `roots` (type: `array`):

Futures options, specifications and expirations. Futures root symbols such as ZC (corn), ZS (soybeans), ZW (wheat), CL (crude oil), NG (natural gas), GC (gold), LE (live cattle), one per line.

## `contracts` (type: `array`):

Futures options and expirations. Futures contract symbols such as ZCN26 or CLZ26, one per line.

## `exchange` (type: `string`):

Futures by exchange (required), futures options and futures specifications. The exchange code, such as CBOT, CME, NYMEX, COMEX, ICEUS or EUREX.

## `category` (type: `string`):

Futures by exchange. Only contracts in this commodity category, such as Grains, Energies, Metals or Meats.

## `futuresCategories` (type: `array`):

Futures specifications. Only these categories.

## `extraFields` (type: `array`):

Quotes, futures by exchange, futures options and expirations. Optional output fields to add, named as in the Barchart OnDemand docs, such as openInterest, settlement, previousSettlement, expirationDate, lastTradingDay, fiftyTwoWkHigh, exchangeMargin or impliedVolatility for quotes, or premium and openInterest for options.

## `historyType` (type: `string`):

Price history. Ticks, minute bars, or daily, weekly, monthly, quarterly or yearly bars. The Nearest types roll a futures root through its front contracts; the Continue types build a continuation series.

## `startDate` (type: `string`):

Price history and commodity statistics. As YYYY-MM-DD, or YYYY-MM-DD HH:MM for minute and tick history. Price history without a start date returns only the current day.

## `endDate` (type: `string`):

Price history and commodity statistics. As YYYY-MM-DD, or YYYY-MM-DD HH:MM for minute and tick history.

## `sortOrder` (type: `string`):

Price history and commodity statistics. Oldest first or newest first. Empty uses the provider default.

## `interval` (type: `integer`):

Price history, minute types only. The number of minutes in each bar, such as 5, 15 or 60.

## `volumeType` (type: `string`):

Price history. For futures, contract or total volume; the sum types add daily volumes over weekly and longer bars instead of averaging them.

## `nearby` (type: `integer`):

Price history, Nearest types. 1 is the front month, 2 the next contract and so on.

## `backAdjust` (type: `boolean`):

Price history, multi-contract futures series. Adjust earlier contracts by the roll gap.

## `daysToExpiration` (type: `integer`):

Price history, multi-contract futures series. Calendar days before expiration to switch to the next contract, 0 to 60.

## `contractRoll` (type: `string`):

Price history, Nearest types. Roll on expiration, or on combined volume and open interest.

## `optionType` (type: `string`):

Futures options. Calls or puts only. Empty reads both.

## `expirationMonth` (type: `integer`):

Futures options. Only options expiring in this month, 1 to 12.

## `expirationDay` (type: `integer`):

Futures options. Only options expiring on this day of the month.

## `zipCode` (type: `string`):

Grain cash bids. A US ZIP code or Canadian postal code; bids come from the closest buying locations.

## `latitude` (type: `string`):

Grain cash bids. The center of the area, with the longitude, instead of a ZIP code.

## `longitude` (type: `string`):

Grain cash bids. The center of the area, with the latitude.

## `maxDistance` (type: `integer`):

Grain cash bids. How far from the ZIP code or point, up to 250 miles. The provider default is 100.

## `county` (type: `string`):

Grain cash bids. A county name and state code joined by a hyphen, such as BOONE COUNTY-IA.

## `fipsCode` (type: `string`):

Grain cash bids. The state and county FIPS codes together, such as 17053.

## `locationIds` (type: `array`):

Grain cash bids. Numeric grain buying location ids, up to 100. When set, the ZIP code, point, distance, county and number of locations are left off, as the provider requires.

## `commodityNames` (type: `array`):

Grain cash bids. Only these commodities, by standard name, such as Soybeans or Corn (#2 Yellow).

## `totalLocations` (type: `integer`):

Grain cash bids. How many buying locations to return. The provider default is 30.

## `bidsPerCommodity` (type: `integer`):

Grain cash bids. The most bids per commodity at each location. The provider default is 2.

## `allBids` (type: `boolean`):

Grain cash bids. Return every cash bid at each location.

## `deliveryStart` (type: `string`):

Grain cash bids. Only bids for delivery starting on or after this date, as YYYY-MM-DD.

## `deliveryEnd` (type: `string`):

Grain cash bids. Only bids for delivery ending on or before this date, as YYYY-MM-DD.

## `usdaCommodityTypes` (type: `array`):

USDA grain prices. Only these commodities. Empty reads all.

## `usdaBidTypes` (type: `array`):

USDA grain prices. Only these bid types. Empty reads all.

## `maxResults` (type: `integer`):

The most rows this run returns and charges for, across all symbols and requests. Price history asks the provider for no more records than are left.

## `requestsPerMinute` (type: `integer`):

Pacing. Barchart OnDemand query limits depend on your subscription; the actor also waits and retries when the provider answers 429.

## `apiKey` (type: `string`):

Your own Barchart OnDemand API key, issued by Barchart with your OnDemand subscription. Stored as a secret and sent in the request body, never in a URL. You can instead set the DATA_API_KEY environment secret.

## Actor input object example

```json
{
  "mode": "quote",
  "symbols": [
    "ZC*1",
    "CL*1",
    "GC*1"
  ],
  "historyType": "daily",
  "zipCode": "50031",
  "maxResults": 500,
  "requestsPerMinute": 60
}
```

# Actor output Schema

## `records` (type: `string`):

One row per quote, price bar, futures option, contract specification, expiration, grain cash bid, USDA grain price or commodity statistic.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "symbols": [
        "ZC*1",
        "CL*1",
        "GC*1"
    ],
    "zipCode": "50031"
};

// Run the Actor and wait for it to finish
const run = await client.actor("nabeelbaghoor/commodity-futures-market-data-api").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "symbols": [
        "ZC*1",
        "CL*1",
        "GC*1",
    ],
    "zipCode": "50031",
}

# Run the Actor and wait for it to finish
run = client.actor("nabeelbaghoor/commodity-futures-market-data-api").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "symbols": [
    "ZC*1",
    "CL*1",
    "GC*1"
  ],
  "zipCode": "50031"
}' |
apify call nabeelbaghoor/commodity-futures-market-data-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,nabeelbaghoor/commodity-futures-market-data-api"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/CJyW5Lbg7IKEiK4CO/builds/8cVjI6ZkfxudvKkDJ/openapi.json
