消息格式
大约 4 分钟
消息格式
客户端消息
心跳消息
长时间不与服务器交互,服务器将关闭连接,可以按时间间隔发送一个心跳包,维持与服务端的连接。
消息类型:
heartbeat
请求示例:
{
"type": "heartbeat",
"tag": 0
}
请求参数:
参数名称 | 参数说明 | 是否必须 | 数据类型 |
---|---|---|---|
type | heartbeat | true | string |
{
"type": "heartbeat"
}
响应参数:
{
"type": "heartbeat",
"tag": 0,
"errorCode": 0
}
订阅行情
消息类型:
dynamic_subscribe
请求示例:
{
"type": "dynamic_subscribe",
"tag": 0,
"body": {
"labels": ["000001.SZ"]
}
}
请求参数:
参数名称 | 参数说明 | 是否必须 | 数据类型 |
---|---|---|---|
type | dynamic_subscribe | true | string |
body.labels | 订阅的股票代码 | true | array |
{
"type": "dynamic_subscribe",
"tag": 0,
"body": {
"labels": []
}
}
响应参数:
{
"type": "dynamic_subscribe",
"tag": 0,
"errorCode": 0
}
取消订阅行情
消息类型:
dynamic_cancel
请求示例:
{
"type": "dynamic_cancel",
"tag": 0,
"body": {
"labels": ["000001.SZ"]
}
}
请求参数:
参数名称 | 参数说明 | 是否必须 | 数据类型 |
---|---|---|---|
type | dynamic_cancel | true | string |
body.labels | 取消订阅的股票代码 | true | array |
{
"type": "dynamic_cancel",
"tag": 0,
"body": {
"labels": []
}
}
响应参数:
{
"type": "dynamic_cancel",
"tag": 0,
"errorCode": 0
}
K 线订阅
消息类型:
kline_subscribe
klineType可用值:DAY,MIN,MIN5,MIN15,MIN30,MIN60,MIN120,MONTH,WEEK,YEAR
请求示例:
{
"type": "kline_subscribe",
"tag": 0,
"body": {
"label": "000001.SZ",
"klineType": "MIN30"
}
}
请求参数:
参数名称 | 参数说明 | 是否必须 | 数据类型 |
---|---|---|---|
type | kline_subscribe | true | string |
body.label | 订阅的股票代码 | true | string |
body.klineType | 订阅的 K 线类型 | true | string |
{
"type": "kline_subscribe",
"tag": 0,
"body": {
"label": "",
"klineType": ""
}
}
响应参数:
{
"type": "kline_subscribe",
"tag": 0,
"errorCode": 0
}
取消 K 线订阅
消息类型:
kline_cancel
请求示例:
{
"type": "kline_cancel",
"tag": 0,
"body": {
"label": "000001.SZ",
"klineType": ["MIN30", "WEEK"]
}
}
请求参数:
参数名称 | 参数说明 | 是否必须 | 数据类型 |
---|---|---|---|
type | kline_cancel | true | string |
body.label | 取消订阅的股票代码 | true | string |
body.klineTypeList | 取消订阅的 K 线类型 | true | array |
{
"type": "kline_cancel",
"tag": 0,
"body": {
"label": "",
"klineTypeList": []
}
}
响应参数:
{
"type": "kline_cancel",
"tag": 0
}
订阅分时行情
消息类型:
minute_subscribe
请求示例:
{
"type": "minute_subscribe",
"tag": 0,
"body": {
"label": "000001.SZ"
}
}
请求参数:
参数名称 | 参数说明 | 是否必须 | 数据类型 |
---|---|---|---|
type | minute_subscribe | true | string |
body.label | 订阅的股票代码 | true | string |
{
"type": "minute_subscribe",
"tag": 0,
"body": {
"label": ""
}
}
响应参数:
{
"type": "kline_cancel",
"tag": 0
}
取消订阅分时行情
消息类型:
minute_cancel
请求示例:
{
"type": "minute_cancel",
"tag": 0,
"body": {
"label": "000001.SZ"
}
}
请求参数:
参数名称 | 参数说明 | 是否必须 | 数据类型 |
---|---|---|---|
type | minute_cancel | true | string |
body.label | 取消订阅的股票代码 | true | string |
{
"type": "minute_cancel",
"tag": 0,
"body": {
"label": ""
}
}
响应参数:
{
"type": "minute_cancel",
"tag": 0
}
取消全部订阅
消息类型:
cancel_all
请求参数:
参数名称 | 参数说明 | 是否必须 | 数据类型 |
---|---|---|---|
type | cancel_all | true | string |
{
"type": "cancel_all",
"tag": 0
}
响应参数:
{
"type": "cancel_all",
"tag": 0
}
服务端消息
行情推送
消息类型:
dynamic_push
响应参数:
参数名称 | 参数说明 | 是否必须 | 数据类型 |
---|---|---|---|
type | 数据类型 | 是 | string |
body.quoteTime | 行情时间戳 | 否 | long |
body.label | 代码 | 否 | string |
body.name | 名称 | 否 | string |
body.prevClose | 昨收 | 否 | double |
body.open | 今开 | 否 | double |
body.high | 最高 | 否 | double |
body.low | 最低 | 否 | double |
body.newPx | 最新价 | 否 | double |
body.buy | 买入价 | 否 | double |
body.sell | 卖出价 | 否 | double |
body.volume | 成交量 | 否 | bigDecimal |
body.amount | 成交额 | 否 | bigDecimal |
body.buy1 | 买 1 价 | 否 | double |
body.buy2 | 买 2 价 | 否 | double |
body.buy3 | 买 3 价 | 否 | double |
body.buy4 | 买 4 价 | 否 | double |
body.buy5 | 买 5 价 | 否 | double |
body.sell1 | 卖 1 价 | 否 | double |
body.sell2 | 卖 2 价 | 否 | double |
body.sell3 | 卖 3 价 | 否 | double |
body.sell4 | 卖 4 价 | 否 | double |
body.sell5 | 卖 5 价 | 否 | double |
body.buyVolume1 | 买 1 量 | 否 | double |
body.buyVolume2 | 买 2 量 | 否 | double |
body.buyVolume3 | 买 3 量 | 否 | double |
body.buyVolume4 | 买 4 量 | 否 | double |
body.buyVolume5 | 买 5 量 | 否 | double |
body.sellVolume1 | 卖 1 量 | 否 | double |
body.sellVolume2 | 卖 2 量 | 否 | double |
body.sellVolume3 | 卖 3 量 | 否 | double |
body.sellVolume4 | 卖 4 量 | 否 | double |
body.sellVolume5 | 卖 5 量 | 否 | double |
body.deal | 成交量笔数 | 否 | bigDecimal |
响应示例:
{
"type": "dynamic_push",
"body": {
"quoteTime": 0,
"label": "",
"name": "",
"prevClose": 0.0,
"open": 0.0,
"high": 0.0,
"low": 0.0,
"newPx": 0.0,
"buy": 0.0,
"sell": 0.0,
"volume": "0",
"amount": "0",
"buy1": 0.0,
"buy2": 0.0,
"buy3": 0.0,
"buy4": 0.0,
"buy5": 0.0,
"sell1": 0.0,
"sell2": 0.0,
"sell3": 0.0,
"sell4": 0.0,
"sell5": 0.0,
"buyVolume1": 0.0,
"buyVolume2": 0.0,
"buyVolume3": 0.0,
"buyVolume4": 0.0,
"buyVolume5": 0.0,
"sellVolume1": 0.0,
"sellVolume2": 0.0,
"sellVolume3": 0.0,
"sellVolume4": 0.0,
"sellVolume5": 0.0,
"deal": "0"
}
}
K 线推送
消息类型:
kline_push
响应参数:
参数名称 | 参数说明 | 是否必须 | 数据类型 |
---|---|---|---|
type | 数据类型 | 是 | 字符串 |
body.klineType | K 线类型 | 是 | string |
body.quoteTime | 行情时间戳 | 是 | long |
body.label | 代码 | 是 | string |
body.close | 收盘价 | 是 | double |
body.open | 开盘价 | 是 | double |
body.high | 最高 | 是 | double |
body.low | 最低 | 是 | double |
body.volume | 成交量 | 是 | bigDecimal |
body.amount | 成交金额 | 是 | bigDecimal |
响应示例:
{
"type": "kline_push",
"body": {
"klineType": "",
"quoteTime": 0,
"label": "",
"close": 0.0,
"open": 0.0,
"high": 0.0,
"low": 0.0,
"volume": "0",
"amount": "0"
}
}
分时行情推送
消息类型:
minute_push
响应参数:
参数名称 | 参数说明 | 是否必须 | 数据类型 |
---|---|---|---|
label | 股票代码 | true | string |
quoteTimel | 行情时间 | true | long |
price | 成交价 | true | double |
volume | 成交量 | true | bigDecimal |
amount | 成交额 | true | bigDecimal |
响应示例:
{
"type": "minute_push",
"body": {
"label": "",
"quoteTime": 0,
"price": 0.0,
"volume": "0",
"amount": "0"
}
}