> ## Documentation Index
> Fetch the complete documentation index at: https://developer.wooxpro.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 获取历史 K 线

`获取交易对的历史 K 线数据。`

#### 请求URL

`GET https://api.woox.io/v3/public/klineHistory`

#### 请求限制

每个 IP 每 1 秒最多 10 次请求

#### 请求参数

> 请求

```shell theme={null}
curl "https://api.woox.io/v3/public/klineHistory?symbol=PERP_BTC_USDT&type=1d&limit=2"
```

| 参数 | 类型 | 是否必填 | 描述 |
| :- | :- | :- | :- |
| symbol | String | 是 | 交易对，如 `PERP_BTC_USDT` |
| type | String | 是 | K 线周期：`1m` `3m` `5m` `15m` `30m` `1h` `2h` `4h` `6h` `12h` `1d` `1w` `1mon` `1y` |
| before | Integer | 否 | 向前翻页的起始时间戳游标，结果不包含游标对应的那根 K 线。`before` 和 `after` 二选一，同时传入时以 `before` 为准 |
| after | Integer | 否 | 向后翻页的起始时间戳游标，结果不包含游标对应的那根 K 线。`before` 和 `after` 二选一，同时传入时以 `before` 为准 |
| limit | Integer | 否 | 查询的 K 线数量，默认 `100`，最大 `1000` |

`before` 和 `after` 都不传时，从最新的一根 K 线开始返回。

#### 响应详情

返回格式与 [获取 K 线](https://developer.wooxpro.com/cn/restful_public_v3/kline.md) 相同。

> 响应

```json theme={null}
{
  "success": true,
  "timestamp": 1794963202000,
  "data": {
    "rows": [
      {
        "symbol": "PERP_BTC_USDT",
        "open": "65309",
        "close": "64800",
        "high": "65691",
        "low": "63321",
        "volume": "11.20818",
        "amount": "722935",
        "type": "1d",
        "startTimestamp": 1794873600000,
        "endTimestamp": 1794960000000
      }
    ]
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.