Skip to content

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
  • Response:

Depth

  • Summary: Depth
  • Method: Depth
  • Endpoint: market_agg.MarketEngine/Depth
  • Request:
  • Response:

Trades

  • Summary: 近期成交
  • Method: Trades
  • Endpoint: market_agg.MarketEngine/Trades
  • Request:
  • Response:

Klines

  • Summary: K线数据
  • Method: Klines
  • Endpoint: market_agg.MarketEngine/Klines
  • Request:
  • Response:

MiniTicker

  • Summary: 24hr价格变动情况
  • Method: MiniTicker
  • Endpoint: market_agg.MarketEngine/MiniTicker
  • Request:
    • Content-Type: application/grpc
    • Schema: Empty
  • Response:

GetSymbolMiniTicker

  • Summary: 指定symbol的24小时价格变动
  • Method: GetSymbolMiniTicker
  • Endpoint: market_agg.MarketEngine/GetSymbolMiniTicker
  • Request:
  • Response:

3. Components

3.1 Schemas

AllMarketPriceMessage

FieldTypeDescription
eEventName事件名称: 1.指数价格K线 2.标记价格K线 3.溢价指数K线 4.市场价格 5.深度信息 6.近期成交 7.深度信息 8.全量深度信息 9.24hr价格变动情况 10.24hr价格变动情况(全部交易对)
pMarketPriceMessage.MarketPrice价格数据

AllMiniTickerMessage

FieldTypeDescription
eEventName事件名称: 1.指数价格K线 2.标记价格K线 3.溢价指数K线 4.市场价格 5.深度信息 6.近期成交 7.深度信息 8.全量深度信息 9.24hr价格变动情况 10.24hr价格变动情况(全部交易对)
mMiniTickerMessage.MiniTickerminiTicker数据

DepthRequest

FieldTypeDescription
symbolstring交易对
limitint32页数:默认 1000; 最大 5000. 可选值:[5, 10, 20, 50, 100, 500, 1000, 5000] 如果 limit > 5000, 最多返回5000条数据.

DepthResponse

FieldTypeDescription
symbolstring交易对
bidsbytes买单:{价格,数量}
asksbytes卖单:{价格,数量}

GetSymbolMiniTickerRequest

FieldTypeDescription
symbolstring交易对(btc_usdt_perp|eth_usdt_perp)

GetSymbolMiniTickerResponse

FieldTypeDescription
symbolstring交易对
openPricestring开盘价:24小时前开始第一笔成交价格
highPricestring最高价
lowPricestring最低价
closePricestring收盘价:最新成交价格
volumestring成交量
quoteVolumestring成交额
timeint64none

KlineMessage

FieldTypeDescription
eEventName事件名称: 1.指数价格K线 2.标记价格K线 3.溢价指数K线 4.市场价格 5.深度信息 6.近期成交 7.深度信息 8.全量深度信息 9.24hr价格变动情况 10.24hr价格变动情况(全部交易对)
kKlineMessage.Klinek线数据
sstringnone

Kline

FieldTypeDescription
oTint64开盘时间
cTint64收盘时间
sstring交易对
istring周期
ostring开盘价
cstring收盘价
hstring最高价
lstring最低价
vstring交易量
qstring交易额
nint64交易次数
tint64发生时间

KlinesRequest

FieldTypeDescription
symbolstring交易对(btc_usdt_perp|eth_usdt_perp)
intervalstring详见枚举定义:K线间隔(1m|3m|5m|15m|30m|1h|2h|4h|6h|8h|12h|1d|3d|1w|1M)
startTimeint64从该时刻之后的成交记录开始返回结果
endTimeint64返回该时刻为止的成交记录
limitint32Default 500; max 1500.

KlinesResponse

FieldTypeDescription
listKlinesResponse.Klinenone

Kline

FieldTypeDescription
openTimeint64开盘时间
closeTimeint64收盘时间
symbolstring交易对
intervalstring时间间隔
openstring开盘价
closestring收盘价
highstring最高价
lowstring最低价
volumestring交易量
quoteVolumestring交易额
numint64交易次数
timeint64时间

MarketKlineMessage

FieldTypeDescription
eEventName事件名称: 1.指数价格K线 2.标记价格K线 3.溢价指数K线 4.市场价格 5.深度信息 6.近期成交 7.深度信息 8.全量深度信息 9.24hr价格变动情况 10.24hr价格变动情况(全部交易对)
kMarketKlineMessage.Klinek线数据
sstringnone

Kline

FieldTypeDescription
oTint64开盘时间
cTint64收盘时间
sstring交易对
ostring开盘价
cstring收盘价
hstring最高价
lstring最低价
istring周期
tint64发生时间

MarketPriceMessage

FieldTypeDescription
eEventName事件名称: 1.指数价格K线 2.标记价格K线 3.溢价指数K线 4.市场价格 5.深度信息 6.近期成交 7.深度信息 8.全量深度信息 9.24hr价格变动情况 10.24hr价格变动情况(全部交易对)
pMarketPriceMessage.MarketPrice价格数据

MarketPrice

FieldTypeDescription
pstring标记价格
istring现货指数价格
rstring资金费率
nTint64下一次资金费时间
nRstring下一次资金费率
fstring溢价指数
oIstring开仓量
sstring交易对
tint64none

MiniTickerMessage

FieldTypeDescription
eEventName事件名称: 1.指数价格K线 2.标记价格K线 3.溢价指数K线 4.市场价格 5.深度信息 6.近期成交 7.深度信息 8.全量深度信息 9.24hr价格变动情况 10.24hr价格变动情况(全部交易对)
mMiniTickerMessage.MiniTickerminiTicker数据
sstringnone

MiniTicker

FieldTypeDescription
cstring最新成交价
ostring24小时前开始第一笔成交价格
hstring24小时内最高成交价
lstring24小时内最低成交价
vstring24小时成交量
qstring24小时成交额
sstring交易对
tint64none

MiniTickerResponse

FieldTypeDescription
listGetSymbolMiniTickerResponsenone

TimeResponse

FieldTypeDescription
serverTimeint64当前服务器时间

TradeMessage

FieldTypeDescription
eEventName事件名称: 1.指数价格K线 2.标记价格K线 3.溢价指数K线 4.市场价格 5.深度信息 6.近期成交 7.深度信息 8.全量深度信息 9.24hr价格变动情况 10.24hr价格变动情况(全部交易对)
tTradeMessage.Tradenone

Trade

FieldTypeDescription
pstring成交价格
qstring成交量
tint64成交时间
mbool如true,则此次成交是一个主动卖出单,否则是一个主动买入单。
sstring交易对

TradeUpdateMessage

FieldTypeDescription
eEventName事件名称: 1.指数价格K线 2.标记价格K线 3.溢价指数K线 4.市场价格 5.深度信息 6.近期成交 7.深度信息 8.全量深度信息 9.24hr价格变动情况 10.24hr价格变动情况(全部交易对)
tTradeMessage.Tradenone
sstringnone

TradesRequest

FieldTypeDescription
symbolstring交易对(btc_usdt_perp|eth_usdt_perp)
limitint32Default 500; max 1000.

TradesResponse

FieldTypeDescription
listTradesResponse.Tradenone

Trade

FieldTypeDescription
pricestring价格
qtystring成交量
quoteQtystring成交额
timeint64成交时间
isBuyerMakerbool买方是否为挂单方:true-是,false-否
symbolstring交易对

3.2 Enums

EventName

NameNumberDescription
None0none
IKline1指数价格事件
MKline2标记价格事件
PKline3溢价指数事件
MarketPrice4市场价格事件
Kline5K线
Trade6逐笔成交
Depth7深度信息
DepthAll8全量深度信息
MiniTicker924hr价格变动情况
MiniTickerAll1024hr价格变动情况(全部交易对)
MarketPriceAll11市场价格事件(全币种)
TradeAgg12聚合成交
Order13订单事件

4. Scalar Value Types

Proto TypeGo TypeC++ TypeJava TypePython TypeNotes
doublefloat64doubledoublefloat
floatfloat32floatfloatfloat
int32int32int32intintUses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead.
int64int64int64longint/longUses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead.
uint32uint32uint32intint/longUses variable-length encoding.
uint64uint64uint64longint/longUses variable-length encoding.
sint32int32int32intintUses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s.
sint64int64int64longint/longUses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s.
fixed32uint32uint32intintAlways four bytes. More efficient than uint32 if values are often greater than 2^28.
fixed64uint64uint64longint/longAlways eight bytes. More efficient than uint64 if values are often greater than 2^56.
sfixed32int32int32intintAlways four bytes.
sfixed64int64int64longint/longAlways eight bytes.
boolboolboolbooleanboolean
stringstringstringStringstr/unicodeA string must always contain UTF-8 encoded or 7-bit ASCII text.
bytes[]bytestringByteStringstrMay contain any arbitrary sequence of bytes.

🚀 构建现代化数字资产交易平台