# GET Latest Trade

### Overview

The **Real-Time Trade Details API** provides the latest trade data for various financial products, including stocks, cryptocurrencies, forex, energy, commodities, and more. This API allows users to retrieve latest trade details for a specified list of symbols.

### Endpoint

<table><thead><tr><th width="179.77777099609375">Market</th><th>Endpoint</th></tr></thead><tbody><tr><td>Stocks</td><td><code>https://data.infoway.io/stock/batch_trade/{codes}</code></td></tr><tr><td>Crypto</td><td><code>https://data.infoway.io/crypto/batch_trade/{codes}</code></td></tr><tr><td>Forex, Commodities, Futures</td><td><code>https://data.infoway.io/common/batch_trade/{codes}</code></td></tr></tbody></table>

### Request Frequency

This API shares the same rate limits as other endpoints. The number of allowed requests per second depends on your subscription plan. Please refer to the [**Rate Limit Policy**](https://docs.infoway.io/en-docs/getting-started/api-limitation/rest-api-limitation) for details.

### Error Codes

See the [HTTP Error Codes](https://docs.infoway.io/en-docs/getting-started/error-codes/rest-api-error-codes) section for reference.

### Authentication

Each request must include your **API Key** in the header.

| **Header** | **Type** | **Required** | **Description**                                 |
| ---------- | -------- | ------------ | ----------------------------------------------- |
| `apiKey`   | String   | Yes          | Your API Key associated with your current plan. |

### Request Parameters

| **Parameter** | **Type** | **Required** | **Description**                                                           | **Example**       |
| ------------- | -------- | ------------ | ------------------------------------------------------------------------- | ----------------- |
| `codes`       | String   | Yes          | Comma-separated list of product codes to query.(Up to 100 symbol at once) | `TSLA.US,AAPL.US` |

### Example Request

```
GET https://data.infoway.io/stock/batch_trade/TSLA.US,AAPL.US

```

### Example Response

```json
{
  "ret": 200,
  "msg": "success",
  "traceId": "27bdafb1-c735-4499-aad1-553820284895",
  "data": [
    {
      "s": "XAUAUD",
      "t": 1750177346523,
      "p": "5188.211",
      "v": "3.0",
      "vw": "15564.6330",
      "td": 0
    },
    {
      "s": "USDCNY",
      "t": 1750175583124,
      "p": "7.184",
      "v": "1.0",
      "vw": "7.1840",
      "td": 0
    }
  ]
}
```

### Response Fields

| **Field** | **Type** | **Required** | **Description**                                                  | **Example / Values** |
| --------- | -------- | ------------ | ---------------------------------------------------------------- | -------------------- |
| `s`       | String   | Yes          | The symbol or product code.                                      | `USDCNY`             |
| `t`       | Long     | Yes          | The trade timestamp in Unix epoch format (milliseconds).         | `1747382898892`      |
| `p`       | String   | Yes          | The price of the trade.                                          | `34.650`             |
| `v`       | String   | Yes          | The volume of the trade.                                         | `439000`             |
| `vw`      | String   | Yes          | The weighted average price of the trade.                         | `15211350.000`       |
| `td`      | int      | Yes          | The trade direction: `0` for default, `1` for Buy, `2` for Sell. | `0`                  |

### Notes

* This API is ideal for tracking real-time transaction details across various markets.
* You can query multiple products in a single request by separating their codes with commas (up to a supported limit).
* The `td` field indicates the trade direction (whether the trade was a Buy or a Sell).
