> For the complete documentation index, see [llms.txt](https://docs-swft.swft.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-swft.swft.pro/ju-he-jiao-yi-api-jie-kou/k-xian-shu-ju.md).

# K线数据

**1. 接口调用：**

&#x20;`https://{host}/market/history/kline`&#x20;

**2. 请求参数实例**

| 参数        | 是否必须 | 说明                                                                               |
| --------- | ---- | -------------------------------------------------------------------------------- |
| channelId | 是    | 渠道id                                                                             |
| timestamp | 是    | 毫秒时间戳（UTC+8）                                                                     |
| sign      | 是    | 签名                                                                               |
| symbol    | 是    | 交易对信息                                                                            |
| period    | 是    | 返回数据时间粒度，也就是每根蜡烛的时间区间(1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year) |

#### 3.请求参数示例

```
 {
     "channelId":"channel",
     "sign":"102027D292DD0707E0D899459D91C759858D7367D223CB239A8EC3A90C30B122",
     "timestamp":"1557653925555",
     "symbol":"BTC/USDT",
     "period":"5min"
 }
```

#### 4.返回结果示例

```
{
  "data":[
    {
      "amount":"9",
      "close":"64584.05",
      "count":728,
      "high":"64678.86",
      "low":"64542.78",
      "open":"64640.77",
      "ts":"1634799300",
      "vol":"598187"
    },
    {
      "amount":"27",
      "close":"64644.22",
      "count":1605,
      "high":"64673.56",
      "low":"64403.50",
      "open":"64503.61",
      "ts":"1634799000",
      "vol":"1784771"
    },
    {
      "amount":"43",
      "close":"64503.61",
      "count":2806,
      "high":"64537.95",
      "low":"64165.55",
      "open":"64267.67",
      "ts":"1634798700",
      "vol":"2785947"
    },
    {
      "amount":"10",
      "close":"63798.99",
      "count":793,
      "high":"63821.82",
      "low":"63732.67",
      "open":"63770.11",
      "ts":"1634709600",
      "vol":"694601"
    }
  ],
  "resCode":"800",
  "resMsg":"成功",
  "resMsgEn":""
}
```

5.返回参数说明

| 字段名称         | 是否数组 | 字段     | 数据类型   |
| ------------ | ---- | ------ | ------ |
| 交易数量         | Y    | amount | String |
| 闭盘价格         | Y    | close  | String |
| 交易笔数         | Y    | count  | String |
| 最高价格         | Y    | high   | String |
| 最低价格         | Y    | low    | String |
| 开盘价格         | Y    | open   | String |
| 毫秒时间戳（UTC+8） | Y    | ts     | String |
| 成交总量         | Y    | vol    | String |
