行情接口

1. 查询深度行情

GET /quote/depth

获取指定证券的十档深度行情数据,包括买卖十档价格和数量、基本价格信息、成交信息等。

请求头

名称类型必填描述
Content-Typestring是固定值:“application/json”

查询参数

名称类型必填描述
security_codestring是证券代码,6 位数字格式
示例值:“000001”
数据校验规则:
- 长度必须为 6 位
- 只能包含数字字符

请求示例

curl --location --request GET 'http://localhost:8080/quote/depth?security_code=000001' \
--header 'Content-Type: application/json'

响应

响应体
名称类型描述
codeint错误码,0 表示成功
msgstring响应消息
dataobject深度行情数据
security_codestring证券代码
security_namestring证券名称(可选)
marketint市场类型
timestampint64数据时间戳(微秒)
update_timeint64更新时间(HHMMSSMMM格式)
trading_phaseint交易阶段
instrument_statusint合约状态
last_pricedouble最新价
pre_close_pricedouble昨收价
open_pricedouble开盘价
high_pricedouble最高价
low_pricedouble最低价
close_pricedouble收盘价
upper_limit_pricedouble涨停价
lower_limit_pricedouble跌停价
avg_pricedouble均价
total_volumeint64总成交量
total_valuedouble总成交额
num_tradesint成交笔数
total_bid_qtyint64委买总量
total_ask_qtyint64委卖总量
weighted_avg_bid_pricedouble加权平均委买价格
weighted_avg_ask_pricedouble加权平均委卖价格
total_bid_numberint委买总笔数
total_ask_numberint委卖总笔数
bid_pricearray十档买入价格数组
bid_qtyarray十档买入数量数组
ask_pricearray十档卖出价格数组
ask_qtyarray十档卖出数量数组
total_positionint64持仓总量
reference_pricedouble参考价
iopvdouble实时净值
pre_iopvdouble前日净值
channel_noint频道号
sequenceint64序列号
响应体示例
{
  "code": 0,
  "msg": "success",
  "data": {
    "security_code": "000001",
    "security_name": "平安银行",
    "market": 1,
    "timestamp": 1699261200000000,
    "update_time": 133000100,
    "trading_phase": 1,
    "instrument_status": 0,
    "last_price": 12.34,
    "pre_close_price": 12.00,
    "open_price": 12.10,
    "high_price": 12.80,
    "low_price": 11.90,
    "close_price": 12.34,
    "upper_limit_price": 13.20,
    "lower_limit_price": 10.80,
    "avg_price": 12.20,
    "total_volume": 123456789,
    "total_value": 1500000000.0,
    "num_trades": 98765,
    "total_bid_qty": 654320,
    "total_ask_qty": 543210,
    "weighted_avg_bid_price": 12.25,
    "weighted_avg_ask_price": 12.28,
    "total_bid_number": 1200,
    "total_ask_number": 1100,
    "bid_price": [12.30, 12.29, 12.28, 12.27, 12.26, 12.25, 12.24, 12.23, 12.22, 12.21],
    "bid_qty": [1000, 2000, 1500, 1200, 800, 600, 500, 400, 300, 200],
    "ask_price": [12.35, 12.36, 12.37, 12.38, 12.39, 12.40, 12.41, 12.42, 12.43, 12.44],
    "ask_qty": [900, 1800, 1400, 1100, 700, 550, 450, 350, 250, 150],
    "total_position": 0,
    "reference_price": 12.00,
    "iopv": 0.0,
    "pre_iopv": 0.0,
    "channel_no": 1,
    "sequence": 123456789
  }
}

2. 查询指数数据

GET /quote/index

获取指定指数的基本数据,包括指数值、成交信息等。

请求头

名称类型必填描述
Content-Typestring是固定值:“application/json”

查询参数

名称类型必填描述
security_codestring是证券代码,6 位数字格式
示例值:“000001”
数据校验规则:
- 长度必须为 6 位
- 只能包含数字字符

请求示例

curl --location --request GET 'http://localhost:8080/quote/index?security_code=000001' \
--header 'Content-Type: application/json'

响应

响应体
名称类型描述
codeint错误码,0 表示成功
msgstring响应消息
dataobject指数数据
security_codestring证券代码
security_namestring证券名称
marketint市场类型
timestampint64数据时间戳(微秒)
update_timeint64更新时间(HHMMSSMMM格式,如093015123表示09:30:15.123)
trading_phaseint交易阶段
last_indexdouble最新指数
pre_close_indexdouble昨收指数
open_indexdouble开盘指数
high_indexdouble最高指数
low_indexdouble最低指数
close_indexdouble收盘指数
total_volumeint64总成交量
total_valuedouble总成交额
num_tradesint成交笔数
sequenceint64序列号
响应体示例
{
  "code": 0,
  "msg": "success",
  "data": {
    "security_code": "000001",
    "security_name": "上证指数",
    "market": 1,
    "timestamp": 1699261200000000,
    "update_time": 093015123,
    "trading_phase": 1,
    "last_index": 3500.12,
    "pre_close_index": 3490.00,
    "open_index": 3495.00,
    "high_index": 3510.00,
    "low_index": 3480.00,
    "close_index": 3500.12,
    "total_volume": 100000000,
    "total_value": 5000000000.0,
    "num_trades": 200000,
    "sequence": 987654321
  }
}

3. 查询五十档深度

GET /quote/depth-fifty

获取指定证券的五十档深度行情,包含更详细的委托明细(最多 100 笔委托,买卖各 50 笔)。

请求头

名称类型必填描述
Content-Typestring是固定值:“application/json”

查询参数

名称类型必填描述
security_codestring是证券代码,6 位数字格式
示例值:“000001”
数据校验规则:
- 长度必须为 6 位
- 只能包含数字字符

请求示例

curl --location --request GET 'http://localhost:8080/quote/depth-fifty?security_code=000001' \
--header 'Content-Type: application/json'

响应

响应体
名称类型描述
codeint错误码,0 表示成功
msgstring响应消息
dataobject五十档深度数据
security_codestring证券代码
security_namestring证券名称
marketint市场类型
timestampint64数据时间戳(微秒)
update_timeint64更新时间(HHMMSSMMM格式,如093015123表示09:30:15.123)
bid_pricedouble买一价
bid_qtyint64买一量
bid_num_ordersint买一笔数
bid_show_ordersint买一展示笔数
ask_pricedouble卖一价
ask_qtyint64卖一量
ask_num_ordersint卖一笔数
ask_show_ordersint卖一展示笔数
ordersarray委托明细数组(最多 100 笔)
channel_noint频道号
sequenceint64序列号
响应体示例
{
  "code": 0,
  "msg": "success",
  "data": {
    "security_code": "000001",
    "security_name": "平安银行",
    "market": 1,
    "timestamp": 1699261200000000,
    "update_time": 093015123,
    "bid_price": 12.30,
    "bid_qty": 1000,
    "bid_num_orders": 5,
    "bid_show_orders": 5,
    "ask_price": 12.35,
    "ask_qty": 900,
    "ask_num_orders": 4,
    "ask_show_orders": 4,
    "orders": [
      100, 200, 150, 120, 80, 60, 50, 40, 30, 20,
      90, 180, 140, 110, 70, 55, 45, 35, 25, 15
    ],
    "channel_no": 1,
    "sequence": 123456790
  }
}

4. 查询委托数据

GET /quote/entrust

获取指定证券的最新委托数据,包含委托的详细信息。

请求头

名称类型必填描述
Content-Typestring是固定值:“application/json”

查询参数

名称类型必填描述
security_codestring是证券代码,6 位数字格式
示例值:“000001”
数据校验规则:
- 长度必须为 6 位
- 只能包含数字字符

请求示例

curl --location --request GET 'http://localhost:8080/quote/entrust?security_code=000001' \
--header 'Content-Type: application/json'

响应

响应体
名称类型描述
codeint错误码,0 表示成功
msgstring响应消息
dataobject委托数据
security_codestring证券代码
security_namestring证券名称
marketint市场类型
timestampint64数据时间戳(微秒)
transact_timeint64委托时间(微秒)
order_typestring委托类型
sidestring买卖方向
bs_flagstring买卖标志(B/S)
order_nostring委托编号
order_indexint委托索引
pricedouble委托价格
qtyint64委托数量
balanceint64剩余数量
channel_noint频道号
biz_indexint64业务索引
appl_seq_numint64应用序号
sequenceint64序列号
响应体示例
{
  "code": 0,
  "msg": "success",
  "data": {
    "security_code": "000001",
    "security_name": "平安银行",
    "market": 1,
    "timestamp": 1699261200000000,
    "transact_time": 1699261200500000,
    "order_type": "limit",
    "side": "buy",
    "bs_flag": "B",
    "order_no": "B123456789",
    "order_index": 1001,
    "price": 12.30,
    "qty": 1000,
    "balance": 1000,
    "channel_no": 1,
    "biz_index": 10001,
    "appl_seq_num": 50001,
    "sequence": 123456791
  }
}

5. 查询成交数据

GET /quote/trade

获取指定证券的最新成交数据,包含成交的详细信息。

请求头

名称类型必填描述
Content-Typestring是固定值:“application/json”

查询参数

名称类型必填描述
security_codestring是证券代码,6 位数字格式
示例值:“000001”
数据校验规则:
- 长度必须为 6 位
- 只能包含数字字符

请求示例

curl --location --request GET 'http://localhost:8080/quote/trade?security_code=000001' \
--header 'Content-Type: application/json'

响应

响应体
名称类型描述
codeint错误码,0 表示成功
msgstring响应消息
dataobject成交数据
security_codestring证券代码
security_namestring证券名称
marketint市场类型
timestampint64数据时间戳(微秒)
transact_timeint64成交时间(微秒)
trade_idstring成交编号
trade_indexint成交索引
pricedouble成交价格
qtyint64成交数量
valuedouble成交金额
bid_order_nostring买方委托编号
ask_order_nostring卖方委托编号
bid_appl_seq_numint64买方应用序号
ask_appl_seq_numint64卖方应用序号
exec_typestring执行类型
trade_flagint成交标志
channel_noint频道号
biz_indexint64业务索引
appl_seq_numint64应用序号
sequenceint64序列号
响应体示例
{
  "code": 0,
  "msg": "success",
  "data": {
    "security_code": "000001",
    "security_name": "平安银行",
    "market": 1,
    "timestamp": 1699261200000000,
    "transact_time": 1699261200600000,
    "trade_id": "T123456789",
    "trade_index": 1001,
    "price": 12.32,
    "qty": 2000,
    "value": 24640.0,
    "bid_order_no": "B123456789",
    "ask_order_no": "S987654321",
    "bid_appl_seq_num": 50001,
    "ask_appl_seq_num": 50002,
    "exec_type": "trade",
    "trade_flag": 0,
    "channel_no": 1,
    "biz_index": 10002,
    "appl_seq_num": 60001,
    "sequence": 123456792
  }
}