# 外汇实时行情接口

## 1. 获取外汇货币对清单

Infoway外汇API支持查询40组主流货币对。您可以通过以下两种方式获取货币对清单：

* **下载清单文件**：登录您的账户后台，在底部找到文件下载链接。
* **通过HTTP接口查询**：如需通过接口获取外汇清单，请参考[GET查询产品列表](/rest-api/basic-info/get-symbol-list.md)。

## 2. 查询方式

我们为不同需求的用户提供两种高效的外汇行情查询方式：

| 查询方式        | 适用场景                                                               |
| ----------- | ------------------------------------------------------------------ |
| HTTP接口      | 适用于定期或批量查询的用户，支持灵活的查询请求。通过HTTP接口，您可以查询A股上市公司的基础信息、历史行情、实时K线、盘口等数据。 |
| WebSocket订阅 | 适合用于获取快速更新的实时行情数据，确保您获取最低延迟的行情推送。                                  |

{% hint style="info" %}
HTTP或者WebSocket均对查询频率有限制，详细限制说明请见[此页面](/getting-started/api-limitation.md)。
{% endhint %}

## 3. 支持的数据类型

Infoway外汇实时行情接口提供以下几种数据查询服务：

### 3.1 获取外汇实时K线数据

提供实时的外汇K线数据，包括开盘、最高、最低、收盘价格、成交量、成交额、涨跌幅、涨跌额，帮助用户捕捉市场走势。详细了解如何获取K线，请前往

* [HTTP请求K线](/rest-api/http-endpoints/get-candles.md)
* [WebSocket订阅K线](/websocket-api/subscribe-and-unsubscribe/candles-subscribe.md)。

以下是USDGBP的实时K线返回示例：

<pre><code>{
  "s": "USDGBP",    //产品代码
  "respList": [
    {
      "t": "1752872400",  //秒时间戳（UTC+8）
      "h": "0.74578",    //最高价
      "o": "0.74527",    //开盘价
      "l": "0.74503",    //最低价
      "c": "0.74503",    //收盘价
      "v": "45.0",    //成交量
      "vw": "33.530460",    //成交额
      "pc": "-0.09%",    //涨跌幅
      "pca": "-0.00065"    //涨跌额
<strong>    }
</strong>  ]
}
</code></pre>

### 3.2 外汇**实时成交明细**

查询外汇最新成交明细，确保获取市场的最新交易信息。详细接入方法请前往：

* [GET实时成交明细](/rest-api/http-endpoints/get-trade.md)
* [WebSocket订阅成交明细](/websocket-api/subscribe-and-unsubscribe/trade-subscribe.md)

实时成交明细返回示例如下：

```
{
  "s": "USDGBP",    //产品代码
  "t": 1752875078529,    //毫秒时间戳(UTC+8)
  "p": "0.74503",    //交易价格
  "v": "1.0",    //成交量
  "vw": "0.745030",    //成交额
  "td": 0    //交易方向 1：BUY 2：SELL 0：默认值
}
```

### 3.3 外汇买卖**盘口数据**

Infoway API提供外汇买卖盘口查询，帮助用户了解市场深度和流动性。详细接入步骤请前往：

* [GET查询盘口数据](/rest-api/http-endpoints/get-depth.md)
* [WebSocket订阅盘口数据](/websocket-api/subscribe-and-unsubscribe/depth-subscribe.md)

外汇盘口返回示例如下：

```
{
  "s": "USDGBP",    //产品代码 
  "t": 1752932303508,    //毫秒时间戳(UTC+8)
  "a": [
    [
      "0.74507"    //买一价
    ],
    [
      "1"    //买一量
    ]
  ],
  "b": [
    [
      "0.74503"    //卖一价
    ],
    [
      "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/readme/forex-realtime-market-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.
