API Reference
1. Info
- Title: gRPC API
- Version: 1.0.0
- Description: This documentation is generated from protobuf files using protoc-gen-doc.
2. Paths
MarketEngine
Time
- Summary: Time
- Method:
Time - Endpoint:
market_agg.MarketEngine/Time - Request:
- Content-Type:
application/grpc - Schema: Empty
- Content-Type:
- Response:
- Content-Type:
application/grpc - Schema: TimeResponse
- Content-Type:
Depth
- Summary: Depth
- Method:
Depth - Endpoint:
market_agg.MarketEngine/Depth - Request:
- Content-Type:
application/grpc - Schema: DepthRequest
- Content-Type:
- Response:
- Content-Type:
application/grpc - Schema: DepthResponse
- Content-Type:
Trades
- Summary: 近期成交
- Method:
Trades - Endpoint:
market_agg.MarketEngine/Trades - Request:
- Content-Type:
application/grpc - Schema: TradesRequest
- Content-Type:
- Response:
- Content-Type:
application/grpc - Schema: TradesResponse
- Content-Type:
Klines
- Summary: K线数据
- Method:
Klines - Endpoint:
market_agg.MarketEngine/Klines - Request:
- Content-Type:
application/grpc - Schema: KlinesRequest
- Content-Type:
- Response:
- Content-Type:
application/grpc - Schema: KlinesResponse
- Content-Type:
MiniTicker
- Summary: 24hr价格变动情况
- Method:
MiniTicker - Endpoint:
market_agg.MarketEngine/MiniTicker - Request:
- Content-Type:
application/grpc - Schema: Empty
- Content-Type:
- Response:
- Content-Type:
application/grpc - Schema: MiniTickerResponse
- Content-Type:
GetSymbolMiniTicker
- Summary: 指定symbol的24小时价格变动
- Method:
GetSymbolMiniTicker - Endpoint:
market_agg.MarketEngine/GetSymbolMiniTicker - Request:
- Content-Type:
application/grpc - Schema: GetSymbolMiniTickerRequest
- Content-Type:
- Response:
- Content-Type:
application/grpc - Schema: GetSymbolMiniTickerResponse
- Content-Type:
3. Components
3.1 Schemas
AllMarketPriceMessage
| Field | Type | Description |
|---|---|---|
| e | EventName | 事件名称: 1.指数价格K线 2.标记价格K线 3.溢价指数K线 4.市场价格 5.深度信息 6.近期成交 7.深度信息 8.全量深度信息 9.24hr价格变动情况 10.24hr价格变动情况(全部交易对) |
| p | MarketPriceMessage.MarketPrice | 价格数据 |
AllMiniTickerMessage
| Field | Type | Description |
|---|---|---|
| e | EventName | 事件名称: 1.指数价格K线 2.标记价格K线 3.溢价指数K线 4.市场价格 5.深度信息 6.近期成交 7.深度信息 8.全量深度信息 9.24hr价格变动情况 10.24hr价格变动情况(全部交易对) |
| m | MiniTickerMessage.MiniTicker | miniTicker数据 |
DepthRequest
| Field | Type | Description |
|---|---|---|
| symbol | string | 交易对 |
| limit | int32 | 页数:默认 1000; 最大 5000. 可选值:[5, 10, 20, 50, 100, 500, 1000, 5000] 如果 limit > 5000, 最多返回5000条数据. |
DepthResponse
| Field | Type | Description |
|---|---|---|
| symbol | string | 交易对 |
| bids | bytes | 买单:{价格,数量} |
| asks | bytes | 卖单:{价格,数量} |
GetSymbolMiniTickerRequest
| Field | Type | Description |
|---|---|---|
| symbol | string | 交易对(btc_usdt_perp|eth_usdt_perp) |
GetSymbolMiniTickerResponse
| Field | Type | Description |
|---|---|---|
| symbol | string | 交易对 |
| openPrice | string | 开盘价:24小时前开始第一笔成交价格 |
| highPrice | string | 最高价 |
| lowPrice | string | 最低价 |
| closePrice | string | 收盘价:最新成交价格 |
| volume | string | 成交量 |
| quoteVolume | string | 成交额 |
| time | int64 | none |
KlineMessage
| Field | Type | Description |
|---|---|---|
| e | EventName | 事件名称: 1.指数价格K线 2.标记价格K线 3.溢价指数K线 4.市场价格 5.深度信息 6.近期成交 7.深度信息 8.全量深度信息 9.24hr价格变动情况 10.24hr价格变动情况(全部交易对) |
| k | KlineMessage.Kline | k线数据 |
| s | string | none |
Kline
| Field | Type | Description |
|---|---|---|
| oT | int64 | 开盘时间 |
| cT | int64 | 收盘时间 |
| s | string | 交易对 |
| i | string | 周期 |
| o | string | 开盘价 |
| c | string | 收盘价 |
| h | string | 最高价 |
| l | string | 最低价 |
| v | string | 交易量 |
| q | string | 交易额 |
| n | int64 | 交易次数 |
| t | int64 | 发生时间 |
KlinesRequest
| Field | Type | Description |
|---|---|---|
| symbol | string | 交易对(btc_usdt_perp|eth_usdt_perp) |
| interval | string | 详见枚举定义:K线间隔(1m|3m|5m|15m|30m|1h|2h|4h|6h|8h|12h|1d|3d|1w|1M) |
| startTime | int64 | 从该时刻之后的成交记录开始返回结果 |
| endTime | int64 | 返回该时刻为止的成交记录 |
| limit | int32 | Default 500; max 1500. |
KlinesResponse
| Field | Type | Description |
|---|---|---|
| list | KlinesResponse.Kline | none |
Kline
| Field | Type | Description |
|---|---|---|
| openTime | int64 | 开盘时间 |
| closeTime | int64 | 收盘时间 |
| symbol | string | 交易对 |
| interval | string | 时间间隔 |
| open | string | 开盘价 |
| close | string | 收盘价 |
| high | string | 最高价 |
| low | string | 最低价 |
| volume | string | 交易量 |
| quoteVolume | string | 交易额 |
| num | int64 | 交易次数 |
| time | int64 | 时间 |
MarketKlineMessage
| Field | Type | Description |
|---|---|---|
| e | EventName | 事件名称: 1.指数价格K线 2.标记价格K线 3.溢价指数K线 4.市场价格 5.深度信息 6.近期成交 7.深度信息 8.全量深度信息 9.24hr价格变动情况 10.24hr价格变动情况(全部交易对) |
| k | MarketKlineMessage.Kline | k线数据 |
| s | string | none |
Kline
| Field | Type | Description |
|---|---|---|
| oT | int64 | 开盘时间 |
| cT | int64 | 收盘时间 |
| s | string | 交易对 |
| o | string | 开盘价 |
| c | string | 收盘价 |
| h | string | 最高价 |
| l | string | 最低价 |
| i | string | 周期 |
| t | int64 | 发生时间 |
MarketPriceMessage
| Field | Type | Description |
|---|---|---|
| e | EventName | 事件名称: 1.指数价格K线 2.标记价格K线 3.溢价指数K线 4.市场价格 5.深度信息 6.近期成交 7.深度信息 8.全量深度信息 9.24hr价格变动情况 10.24hr价格变动情况(全部交易对) |
| p | MarketPriceMessage.MarketPrice | 价格数据 |
MarketPrice
| Field | Type | Description |
|---|---|---|
| p | string | 标记价格 |
| i | string | 现货指数价格 |
| r | string | 资金费率 |
| nT | int64 | 下一次资金费时间 |
| nR | string | 下一次资金费率 |
| f | string | 溢价指数 |
| oI | string | 开仓量 |
| s | string | 交易对 |
| t | int64 | none |
MiniTickerMessage
| Field | Type | Description |
|---|---|---|
| e | EventName | 事件名称: 1.指数价格K线 2.标记价格K线 3.溢价指数K线 4.市场价格 5.深度信息 6.近期成交 7.深度信息 8.全量深度信息 9.24hr价格变动情况 10.24hr价格变动情况(全部交易对) |
| m | MiniTickerMessage.MiniTicker | miniTicker数据 |
| s | string | none |
MiniTicker
| Field | Type | Description |
|---|---|---|
| c | string | 最新成交价 |
| o | string | 24小时前开始第一笔成交价格 |
| h | string | 24小时内最高成交价 |
| l | string | 24小时内最低成交价 |
| v | string | 24小时成交量 |
| q | string | 24小时成交额 |
| s | string | 交易对 |
| t | int64 | none |
MiniTickerResponse
| Field | Type | Description |
|---|---|---|
| list | GetSymbolMiniTickerResponse | none |
TimeResponse
| Field | Type | Description |
|---|---|---|
| serverTime | int64 | 当前服务器时间 |
TradeMessage
| Field | Type | Description |
|---|---|---|
| e | EventName | 事件名称: 1.指数价格K线 2.标记价格K线 3.溢价指数K线 4.市场价格 5.深度信息 6.近期成交 7.深度信息 8.全量深度信息 9.24hr价格变动情况 10.24hr价格变动情况(全部交易对) |
| t | TradeMessage.Trade | none |
Trade
| Field | Type | Description |
|---|---|---|
| p | string | 成交价格 |
| q | string | 成交量 |
| t | int64 | 成交时间 |
| m | bool | 如true,则此次成交是一个主动卖出单,否则是一个主动买入单。 |
| s | string | 交易对 |
TradeUpdateMessage
| Field | Type | Description |
|---|---|---|
| e | EventName | 事件名称: 1.指数价格K线 2.标记价格K线 3.溢价指数K线 4.市场价格 5.深度信息 6.近期成交 7.深度信息 8.全量深度信息 9.24hr价格变动情况 10.24hr价格变动情况(全部交易对) |
| t | TradeMessage.Trade | none |
| s | string | none |
TradesRequest
| Field | Type | Description |
|---|---|---|
| symbol | string | 交易对(btc_usdt_perp|eth_usdt_perp) |
| limit | int32 | Default 500; max 1000. |
TradesResponse
| Field | Type | Description |
|---|---|---|
| list | TradesResponse.Trade | none |
Trade
| Field | Type | Description |
|---|---|---|
| price | string | 价格 |
| qty | string | 成交量 |
| quoteQty | string | 成交额 |
| time | int64 | 成交时间 |
| isBuyerMaker | bool | 买方是否为挂单方:true-是,false-否 |
| symbol | string | 交易对 |
3.2 Enums
EventName
| Name | Number | Description |
|---|---|---|
| None | 0 | none |
| IKline | 1 | 指数价格事件 |
| MKline | 2 | 标记价格事件 |
| PKline | 3 | 溢价指数事件 |
| MarketPrice | 4 | 市场价格事件 |
| Kline | 5 | K线 |
| Trade | 6 | 逐笔成交 |
| Depth | 7 | 深度信息 |
| DepthAll | 8 | 全量深度信息 |
| MiniTicker | 9 | 24hr价格变动情况 |
| MiniTickerAll | 10 | 24hr价格变动情况(全部交易对) |
| MarketPriceAll | 11 | 市场价格事件(全币种) |
| TradeAgg | 12 | 聚合成交 |
| Order | 13 | 订单事件 |
4. Scalar Value Types
| Proto Type | Go Type | C++ Type | Java Type | Python Type | Notes |
|---|---|---|---|---|---|
| double | float64 | double | double | float | |
| float | float32 | float | float | float | |
| int32 | int32 | int32 | int | int | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. |
| int64 | int64 | int64 | long | int/long | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. |
| uint32 | uint32 | uint32 | int | int/long | Uses variable-length encoding. |
| uint64 | uint64 | uint64 | long | int/long | Uses variable-length encoding. |
| sint32 | int32 | int32 | int | int | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. |
| sint64 | int64 | int64 | long | int/long | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. |
| fixed32 | uint32 | uint32 | int | int | Always four bytes. More efficient than uint32 if values are often greater than 2^28. |
| fixed64 | uint64 | uint64 | long | int/long | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. |
| sfixed32 | int32 | int32 | int | int | Always four bytes. |
| sfixed64 | int64 | int64 | long | int/long | Always eight bytes. |
| bool | bool | bool | boolean | boolean | |
| string | string | string | String | str/unicode | A string must always contain UTF-8 encoded or 7-bit ASCII text. |
| bytes | []byte | string | ByteString | str | May contain any arbitrary sequence of bytes. |
