# Commodities Data API

### Overview

The [**Infoway Commodity Futures Real-Time Market Data API**](https://infoway.io/en/commodities-api) provides comprehensive data for more than **30 commodity and precious metal futures**.\
The API supports real-time and historical candlestick data, latest trade, and **order book depth**, helping users track the movements of major futures markets such as **gold, silver, oil**, and various **commodity indices**.

### 1. Retrieving the Commodity Futures List

Infoway’s futures API covers **30 major futures products** (including commodity indices).\
You can obtain the list of available futures products using one of the following methods:

**Option 1 — Download from the Web Portal**

Log in to your Infoway account and download the latest stock excel list file from the **Downloads** section at the right side of the dashboard.

**Option 2 — Query via API**

You can also retrieve the list programmatically through the **HTTP Symbol List API**.\
Refer to the [**GET /symbol-list**](/en-docs/rest-api/get-basic-info/get-symbol-list.md) documentation for usage details.

### 2. Query Methods

Infoway Commodity Futures API offers **two primary data-access methods**, optimized for different use cases:

| Method                  | Ideal Use Case                  | Description                                                                                                                                                            |
| ----------------------- | ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **HTTP API**            | Scheduled or batch queries      | Suitable for regular polling or historical data retrieval. Supports requests for fundamentals, historical candlestick data, real-time snapshots, and order book depth. |
| **WebSocket Streaming** | Low-latency, continuous updates | Best for low-latency updates and live data feeds. Allows continuous streaming of FX quotes, trades, and depth updates.                                                 |

{% hint style="info" %}
Both HTTP and WebSocket interfaces are subject to rate limits. See the [*Rate Limit Policy*](/en-docs/getting-started/api-limitation.md) section for detailed constraints.
{% endhint %}

### 3. Market Data Schemas

The Infoway Commodity Futures Real-Time Market Data API supports several types of data queries to help users monitor and analyze market activity.

#### 3.1 Real-Time Candlestick (OHLCV) Data

Access real-time candlestick data for commodity futures, including the **open**, **high**, **low**, **close** prices, as well as **volume** and **turnover**.\
This data is vital for charting and analyzing price trends over different time intervals.

You can access this data via:

* **HTTP Request:** see [*GET /candlestick*](/en-docs/rest-api/market-data/post-candlestick-real-historical.md)
* **WebSocket Subscription:** see [*WebSocket /candlestick*](/en-docs/websocket/websocket-subscribe-method/candlestick-subscription.md) topic

**Example Response**

```json
{
  "s": "XAGUSD",
  "respList": [
    {
      "t": "1752868800",
      "h": "38.22500",
      "o": "38.12555",
      "l": "38.11850",
      "c": "38.16500",
      "v": "1003.0",
      "vw": "38292.383500",
      "pc": "0.12%",
      "pca": "0.04450"
    }
  ]
}
```

#### 3.2 Real-Time Trade Ticks

Retrieve the most recent trade details for commodity futures, including **price**, **volume**, and **transaction direction**.\
This data is essential for tracking individual market transactions and executing high-frequency trading strategies.

Access methods:

* **HTTP API:** [*GET /trades*](/en-docs/rest-api/market-data/get-latest-trade.md)
* **WebSocket:** [*Subscribe to /trades*](/en-docs/websocket/websocket-subscribe-method/latest-trade-subscription.md)

**Example Response**

```json
{
  "s": "XAGUSD",
  "t": 1752872345319,
  "p": "38.165",
  "v": "1.0",
  "vw": "38.1650",
  "td": 0
}
```

#### 3.3 Real-Time Order Book Depth

Provides the **best bid and ask** prices along with the available volumes at each price level for commodity futures.

Access methods:

* **HTTP API:** [*GET /market-depth*](/en-docs/rest-api/market-data/get-market-depth.md)
* **WebSocket:** [*Subscribe to /Depth*](/en-docs/websocket/websocket-subscribe-method/depth-subscription.md)

**Example Response**

```json
{
  "s": "XAGUSD",
  "t": 1752975504045,
  "a": [
    [
      "38.18"
    ],
    [
      "1"
    ]
  ],
  "b": [
    [
      "38.15"
    ],
    [
      "1"
    ]
  ]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.infoway.io/en-docs/readme/commodities-data-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
