> For the complete documentation index, see [llms.txt](https://weex-1.gitbook.io/zh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://weex-1.gitbook.io/zh/restapi/gong-gong-hang-qing-jie-kou.md).

# 公共行情接口

### 获取某个Ticker信息 <a href="#ticker" id="ticker"></a>

限速规则：20次/1s

**HTTP请求** 获取某个ticker信息

* GET /api/spot/v1/market/ticker

**请求参数**

| 参数名    | 参数类型   | 是否必须 | 描述    |
| ------ | ------ | ---- | ----- |
| symbol | String | 是    | 交易对名称 |

> 返回数据:

```
{
    "code":"00000",
    "data":{
        "symbol":"BTCUSDT",
        "high24h":"34413.1",
        "low24h":"34413.1",
        "close":"34413.1",
        "quoteVol":"0",
        "baseVol":"0",
        "usdtVol":"0",
        "ts":"1625125755277"
    },
    "msg":"success",
    "requestTime":1625125756372
}
```

**返回值说明**

| 返回字段     | 字段说明    |
| -------- | ------- |
| symbol   | 币对名称    |
| high24h  | 24小时最高价 |
| close    | 最新成交价   |
| low24h   | 24小时最低价 |
| quoteVol | 计价币成交额  |
| baseVol  | 基础币成交额  |
| usdtVol  | usdt成交额 |
| ts       | 时间戳     |

### 获取全部Ticker信息 <a href="#ticker-2" id="ticker-2"></a>

限速规则：20次/1s

**HTTP请求**

获取全部ticker信息

* GET /api/spot/v1/market/tickers

> 返回数据

```
{
    "code":"00000",
    "data":[
      {
        "symbol":"BTCUSDT",
        "high24h":"34413.1",
        "low24h":"34413.1",
        "close":"34413.1",
        "quoteVol":"0",
        "baseVol":"0",
        "usdtVol":"0",
        "ts":"1625125755277"
    }
    ]
    "msg":"success",
    "requestTime":1625125756372
}
```

**返回值说明**

| 返回字段     | 字段说明    |
| -------- | ------- |
| symbol   | 币对名称    |
| high24h  | 24小时最高价 |
| close    | 最新成交价   |
| low24h   | 24小时最低价 |
| ts       | 系统时间戳   |
| baseVol  | 基础币量    |
| quoteVol | 计价币量    |
| usdtVol  | usdt币量  |

### 获取成交数据 <a href="#id-2fdd066e43" id="id-2fdd066e43"></a>

限速规则：20次/1s

**HTTP请求**

获取成交数据

* GET /api/spot/v1/market/fills

**请求参数**

| 参数名    | 参数类型   | 是否必须 | 描述           |
| ------ | ------ | ---- | ------------ |
| symbol | String | 是    | 交易对ID        |
| limit  | String | 否    | 默认100，最大2000 |

> 返回数据:

```
{
    "code":"00000",
    "msg":"success",
    "requestTime":1622097283024,
    "data":[
        {
            "symbol":"BFTUSDT_SPBL",
            "tradeId":"781698148534505473",
            "side":"buy",
            "fillPrice":"2.38735",
            "fillQuantity":"2470.6224",
            "fillTime":"1622097282536"
        },
        {
            "symbol":"BFTUSDT_SPBL",
            "tradeId":"781698140590493697",
            "side":"sell",
            "fillPrice":"2.38649",
            "fillQuantity":"3239.7976",
            "fillTime":"1622097280642"
        }
    ]
}
```

**返回值说明**

| 返回字段         | 字段说明  |
| ------------ | ----- |
| symbol       | 合约名称  |
| tradeId      | 成交单id |
| side         | 交易方向  |
| fillPrice    | 成交价格  |
| fillQuantity | 成交数量  |
| fillTime     | 成交时间  |

### 获取K线数据 <a href="#k" id="k"></a>

限速规则：20次/1s

**HTTP请求** 获取K线数据

* GET /api/spot/v1/market/candles

**请求参数**

| 参数名    | 参数类型   | 是否必须 | 描述                   |
| ------ | ------ | ---- | -------------------- |
| symbol | String | 是    | 合约名称                 |
| period | String | 是    | K线的时间单位,粒度（取值参考如下列表) |
| after  | String | 否    | 时间之后的                |
| before | String | 否    | 时间之前的                |
| limit  | String | 否    |                      |

> 返回数据:

```
{
    "code":"00000",
    "msg":"success",
    "requestTime":1622097356073,
    "data":[
        {
            "open":"2.34517",
            "high":"2.34771",
            "low":"2.34214",
            "close":"2.34555",
            "quoteVol":"189631.101357091",
            "baseVol":"80862.6823",
            "usdtVol":"189631.101357091",
            "ts":"1622091360000"
        },
        {
            "open":"2.34391",
            "high":"2.34903",
            "low":"2.34391",
            "close":"2.34608",
            "quoteVol":"167725.002115681",
            "baseVol":"71479.3205",
            "usdtVol":"167725.002115681",
            "ts":"1622091420000"
        }
    ]
}
```

**返回值说明**

| 返回字段     | 字段说明    |
| -------- | ------- |
| ts       | 系统时间戳   |
| open     | 开盘价格    |
| high     | 最高价格    |
| low      | 最低价格    |
| close    | 收盘价格    |
| baseVol  | 交易币成交量  |
| quoteVol | 计价币成交量  |
| usdtVol  | usdt成交量 |

### 获取深度数据 <a href="#id-5139801b64" id="id-5139801b64"></a>

限速规则：20次/1s

**HTTP请求** 获取K线数据

* GET /api/spot/v1/market/depth

**请求参数**

| 参数名    | 参数类型   | 是否必须 | 描述                                                   |
| ------ | ------ | ---- | ---------------------------------------------------- |
| symbol | String | 是    | 合约名称                                                 |
| type   | String | 是    | 默认：step0： 不合并，取值：step0,step1，step2，step3，step4，step5 |
| limit  | String | 否    | 查询条数 默认150                                           |

> 返回数据

```
{
    "code":"00000",
    "msg":"success",
    "requestTime":1622102974025,
    "data":{
        "asks":[
            [
                "38084.5",
                "0.0039"
            ],
            [
                "38085.7",
                "0.0018"
            ],
            [
                "38086.7",
                "0.0310"
            ],
            [
                "38088.2",
                "0.5303"
            ]
        ],
        "bids":[
            [
                "38073.7",
                "0.4993000000000000"
            ],
            [
                "38073.4",
                "0.4500"
            ],
            [
                "38073.3",
                "0.1179"
            ],
            [
                "38071.5",
                "0.2162"
            ]
        ],
        "timestamp":"1622102974025"
    }
}
```

<br>
