# 获取回购
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_corporate_actions_buybacks(code, next_key=None, num=None)
介绍
获取股票的回购记录(港股 / A 股,支持分页)
参数
参数 类型 说明 code str 股票代码 如 HK.00700;支持港股、A股正股及基金next_key str 分页标识 首次不填,续拉时填上次返回的 next_key;"-1" 表示无更多数据num int 每页数量 每页返回数量,默认 10,范围 1~50返回
参数 类型 说明 ret RET_CODE 接口调用结果 data dict 当 ret == RET_OK,返回回购数据字典 str 当 ret != RET_OK,返回错误描述 返回字典包含以下字段:
字段 类型 说明 next_key str 分页标识 "-1" 表示无更多数据;续拉时将此值传入请求参数 next_keyhk_buy_back_list pd.DataFrame 港股回购列表 每项见 hk_buy_back_list 字段表;A股标的此列表为空a_buy_back_list pd.DataFrame A股回购列表 每项见 a_buy_back_list 字段表;港股标的此列表为空hk_buy_back_list 字段(港股回购条目):
字段 类型 说明 publ_date int 公告日时间戳 Unix 时间戳(秒),对应市场时区publ_date_str str 公告日 格式 YYYY-MM-DD,对应市场时区end_date int 回购截止日时间戳 Unix 时间戳(秒),对应市场时区end_date_str str 回购截止日 格式 YYYY-MM-DD,对应市场时区buy_back_money float 回购金额 buy_back_sum int 回购股数 单位:股percentage float 占总股本比例 百分号前的值,如 12.34 表示 12.34%high_price float 最高回购价 low_price float 最低回购价 cumulative_sum int 本轮累计回购股数 单位:股cumulative_percentage float 本轮累计占总股本比例 百分号前的值,如 12.34 表示 12.34%share_type str 股份类别 a_buy_back_list 字段(A股回购条目):
字段 类型 说明 change_reg_date int 工商变更登记日时间戳 Unix 时间戳(秒),对应市场时区change_reg_date_str str 工商变更登记日 格式 YYYY-MM-DD,对应市场时区change_date int 股份变动日时间戳 Unix 时间戳(秒),对应市场时区change_date_str str 股份变动日 格式 YYYY-MM-DD,对应市场时区event_proce_desc str 事件进程描述 advance_date int 预案公告日时间戳 Unix 时间戳(秒),对应市场时区advance_date_str str 预案公告日 格式 YYYY-MM-DD,对应市场时区meet_pass_date int 股东大会通过日时间戳 Unix 时间戳(秒),对应市场时区meet_pass_date_str str 股东大会通过日 格式 YYYY-MM-DD,对应市场时区start_date int 回购开始日时间戳 Unix 时间戳(秒),对应市场时区start_date_str str 回购开始日 格式 YYYY-MM-DD,对应市场时区end_date int 回购截止日时间戳 Unix 时间戳(秒),对应市场时区end_date_str str 回购截止日 格式 YYYY-MM-DD,对应市场时区pay_date int 支付日时间戳 Unix 时间戳(秒),对应市场时区pay_date_str str 支付日 格式 YYYY-MM-DD,对应市场时区seller str 出售方 股份被回购方buy_back_mode str 回购方式 share_type str 股份类别 buy_back_sum int 回购股数 单位:股buy_back_money float 回购金额 percentage float 占总股本比例 百分号前的值,如 12.34 表示 12.34%value_floor float 拟回购资金总额下限 value_ceiling float 拟回购资金总额上限 price_floor float 回购价格下限 price_ceiling float 回购价格上限 volume_floor float 拟回购股数下限 volume_ceiling float 拟回购股数上限
Example
from futu import *
import pandas as pd
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_corporate_actions_buybacks("HK.00700", num=3)
if ret == RET_OK:
df = pd.DataFrame(data.get('hk_buy_back_list', []))
print(df.to_string(index=False))
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
- Output
publ_date publ_date_str end_date end_date_str buy_back_money buy_back_sum percentage high_price low_price cumulative_sum cumulative_percentage share_type
1775664000 2026-04-09 1775664000 2026-04-09 1000880717.6 1964000 0.021373 514.5 503.0 119812000 1.30386 普通股
1775577600 2026-04-08 1775577600 2026-04-08 1000761103.7 1979000 0.021537 510.0 501.0 117848000 1.28249 普通股
1775059200 2026-04-02 1775059200 2026-04-02 300715258.5 615000 0.006693 496.0 485.2 115869000 1.26095 普通股
2
3
4
# Qot_GetCorporateActionsBuybacks.proto
介绍
获取回购
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional string nextKey = 2; // 分页标识,首次不填,续拉时填上次返回的 nextKey;"-1" 表示无更多数据
optional int32 num = 3; // 每页返回数量,默认 10,范围 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- 股票结构参见 Security
- 返回
// 港股回购单条记录
message HKBuyBackItem
{
optional uint64 publDate = 1; // 公告日时间戳(秒)
optional string publDateStr = 2; // 公告日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 endDate = 3; // 回购截止日时间戳(秒)
optional string endDateStr = 4; // 回购截止日字符串,格式 YYYY-MM-DD,对应市场时区
optional double buyBackMoney = 5; // 回购金额
optional int64 buyBackSum = 6; // 回购股数(股)
optional double percentage = 7; // 占已发行股份百分比,百分号前的值,如 12.34 表示 12.34%
optional double highPrice = 8; // 最高回购价
optional double lowPrice = 9; // 最低回购价
optional int64 cumulativeSum = 10; // 本轮累计回购股数(股)
optional double cumulativePercentage = 11; // 本轮累计回购占总股本百分比,百分号前的值,如 12.34 表示 12.34%
optional string shareType = 12; // 股份类别
}
// A股回购单条记录
message ABuyBackItem
{
optional uint64 changeRegDate = 1; // 工商变更登记日时间戳(秒)
optional string changeRegDateStr = 2; // 工商变更登记日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 changeDate = 3; // 股份变动日时间戳(秒)
optional string changeDateStr = 4; // 股份变动日字符串,格式 YYYY-MM-DD,对应市场时区
optional string eventProceDesc = 5; // 事件进程描述
optional uint64 advanceDate = 6; // 预案公告日时间戳(秒)
optional string advanceDateStr = 7; // 预案公告日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 meetPassDate = 8; // 股东大会通过日时间戳(秒)
optional string meetPassDateStr = 9; // 股东大会通过日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 startDate = 10; // 回购开始日时间戳(秒)
optional string startDateStr = 11; // 回购开始日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 endDate = 12; // 回购截止日时间戳(秒)
optional string endDateStr = 13; // 回购截止日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 payDate = 14; // 支付日时间戳(秒)
optional string payDateStr = 15; // 支付日字符串,格式 YYYY-MM-DD,对应市场时区
optional string seller = 16; // 出售方(股份被回购方)
optional string buyBackMode = 17; // 回购方式
optional string shareType = 18; // 股份类别
optional int64 buyBackSum = 19; // 回购股数(股)
optional double buyBackMoney = 20; // 回购金额
optional double percentage = 21; // 占已发行股份百分比,百分号前的值,如 12.34 表示 12.34%
optional double valueFloor = 22; // 拟回购资金总额下限
optional double valueCeiling = 23; // 拟回购资金总额上限
optional double priceFloor = 24; // 回购价格下限
optional double priceCeiling = 25; // 回购价格上限
optional double volumeFloor = 26; // 拟回购股数下限
optional double volumeCeiling = 27; // 拟回购股数上限
}
message S2C
{
repeated HKBuyBackItem hkBuyBackList = 1; // 港股回购列表
repeated ABuyBackItem aBuyBackList = 2; // A股回购列表
optional string nextKey = 3; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // 返回结果,详见 Common.RetType
optional string retMsg = 2; // 返回结果描述
optional int32 errCode = 3; // 错误码
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
- 接口调用结果,结构参见 RetType
协议 ID
3235
uint GetCorporateActionsBuybacks(QotGetCorporateActionsBuybacks.Request req);
virtual void OnReply_GetCorporateActionsBuybacks(FTAPI_Conn client, uint nSerialNo, QotGetCorporateActionsBuybacks.Response rsp);
介绍
获取回购
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional string nextKey = 2; // 分页标识,首次不填,续拉时填上次返回的 nextKey;"-1" 表示无更多数据
optional int32 num = 3; // 每页返回数量,默认 10,范围 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- 股票结构参见 Security
- 返回
// 港股回购单条记录
message HKBuyBackItem
{
optional uint64 publDate = 1; // 公告日时间戳(秒)
optional string publDateStr = 2; // 公告日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 endDate = 3; // 回购截止日时间戳(秒)
optional string endDateStr = 4; // 回购截止日字符串,格式 YYYY-MM-DD,对应市场时区
optional double buyBackMoney = 5; // 回购金额
optional int64 buyBackSum = 6; // 回购股数(股)
optional double percentage = 7; // 占已发行股份百分比,百分号前的值,如 12.34 表示 12.34%
optional double highPrice = 8; // 最高回购价
optional double lowPrice = 9; // 最低回购价
optional int64 cumulativeSum = 10; // 本轮累计回购股数(股)
optional double cumulativePercentage = 11; // 本轮累计回购占总股本百分比,百分号前的值,如 12.34 表示 12.34%
optional string shareType = 12; // 股份类别
}
// A股回购单条记录
message ABuyBackItem
{
optional uint64 changeRegDate = 1; // 工商变更登记日时间戳(秒)
optional string changeRegDateStr = 2; // 工商变更登记日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 changeDate = 3; // 股份变动日时间戳(秒)
optional string changeDateStr = 4; // 股份变动日字符串,格式 YYYY-MM-DD,对应市场时区
optional string eventProceDesc = 5; // 事件进程描述
optional uint64 advanceDate = 6; // 预案公告日时间戳(秒)
optional string advanceDateStr = 7; // 预案公告日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 meetPassDate = 8; // 股东大会通过日时间戳(秒)
optional string meetPassDateStr = 9; // 股东大会通过日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 startDate = 10; // 回购开始日时间戳(秒)
optional string startDateStr = 11; // 回购开始日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 endDate = 12; // 回购截止日时间戳(秒)
optional string endDateStr = 13; // 回购截止日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 payDate = 14; // 支付日时间戳(秒)
optional string payDateStr = 15; // 支付日字符串,格式 YYYY-MM-DD,对应市场时区
optional string seller = 16; // 出售方(股份被回购方)
optional string buyBackMode = 17; // 回购方式
optional string shareType = 18; // 股份类别
optional int64 buyBackSum = 19; // 回购股数(股)
optional double buyBackMoney = 20; // 回购金额
optional double percentage = 21; // 占已发行股份百分比,百分号前的值,如 12.34 表示 12.34%
optional double valueFloor = 22; // 拟回购资金总额下限
optional double valueCeiling = 23; // 拟回购资金总额上限
optional double priceFloor = 24; // 回购价格下限
optional double priceCeiling = 25; // 回购价格上限
optional double volumeFloor = 26; // 拟回购股数下限
optional double volumeCeiling = 27; // 拟回购股数上限
}
message S2C
{
repeated HKBuyBackItem hkBuyBackList = 1; // 港股回购列表
repeated ABuyBackItem aBuyBackList = 2; // A股回购列表
optional string nextKey = 3; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // 返回结果,详见 Common.RetType
optional string retMsg = 2; // 返回结果描述
optional int32 errCode = 3; // 错误码
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
- 接口调用结果,结构参见 RetType
- Example
public class Program : FTSPI_Qot, FTSPI_Conn
{
FTAPI_Qot qot = new FTAPI_Qot();
public Program()
{
qot.SetClientInfo("csharp", 1);
qot.SetConnCallback(this);
qot.SetQotCallback(this);
}
public void Start()
{
qot.InitConnect("127.0.0.1", (ushort)11111, false);
}
public void OnInitConnect(FTAPI_Conn client, long errCode, String desc)
{
Console.Write("Qot onInitConnect: ret={0} desc={1} connID={2}\n", errCode, desc, client.GetConnectID());
if (errCode != 0)
return;
QotCommon.Security sec = QotCommon.Security.CreateBuilder()
.SetMarket((int)QotCommon.QotMarket.QotMarket_HK_Security)
.SetCode("00700")
.Build();
QotGetCorporateActionsBuybacks.C2S c2s = QotGetCorporateActionsBuybacks.C2S.CreateBuilder()
.SetSecurity(sec)
.Build();
QotGetCorporateActionsBuybacks.Request req = QotGetCorporateActionsBuybacks.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetCorporateActionsBuybacks(req);
Console.Write("Send QotGetCorporateActionsBuybacks: {0}\n", seqNo);
}
public void OnDisconnect(FTAPI_Conn client, long errCode)
{
Console.Write("Qot onDisConnect: {0}\n", errCode);
}
public void OnReply_GetCorporateActionsBuybacks(FTAPI_Conn client, uint nSerialNo, QotGetCorporateActionsBuybacks.Response rsp)
{
Console.Write("Reply: QotGetCorporateActionsBuybacks: {0} {1}\n", nSerialNo, rsp.ToString());
}
public static void Main(String[] args)
{
FTAPI.Init();
Program qot = new Program();
qot.Start();
while (true)
Thread.Sleep(1000 * 600);
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
- Output
sent seqNo=3
retType: 0
retMsg: ""
errCode: 0
s2c {
hkBuyBackList {
publDate: 1775664000
publDateStr: "2026-04-09"
endDate: 1775664000
endDateStr: "2026-04-09"
buyBackMoney: 1000880717.6
buyBackSum: 1964000
percentage: 0.021373
highPrice: 514.5
lowPrice: 503
cumulativeSum: 119812000
cumulativePercentage: 1.30386
shareType: "普通股"
}
hkBuyBackList {
//...
}
nextKey: "10"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
int getCorporateActionsBuybacks(QotGetCorporateActionsBuybacks.Request req);
void onReply_GetCorporateActionsBuybacks(FTAPI_Conn client, int nSerialNo, QotGetCorporateActionsBuybacks.Response rsp);
介绍
获取回购
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional string nextKey = 2; // 分页标识,首次不填,续拉时填上次返回的 nextKey;"-1" 表示无更多数据
optional int32 num = 3; // 每页返回数量,默认 10,范围 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- 股票结构参见 Security
- 返回
// 港股回购单条记录
message HKBuyBackItem
{
optional uint64 publDate = 1; // 公告日时间戳(秒)
optional string publDateStr = 2; // 公告日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 endDate = 3; // 回购截止日时间戳(秒)
optional string endDateStr = 4; // 回购截止日字符串,格式 YYYY-MM-DD,对应市场时区
optional double buyBackMoney = 5; // 回购金额
optional int64 buyBackSum = 6; // 回购股数(股)
optional double percentage = 7; // 占已发行股份百分比,百分号前的值,如 12.34 表示 12.34%
optional double highPrice = 8; // 最高回购价
optional double lowPrice = 9; // 最低回购价
optional int64 cumulativeSum = 10; // 本轮累计回购股数(股)
optional double cumulativePercentage = 11; // 本轮累计回购占总股本百分比,百分号前的值,如 12.34 表示 12.34%
optional string shareType = 12; // 股份类别
}
// A股回购单条记录
message ABuyBackItem
{
optional uint64 changeRegDate = 1; // 工商变更登记日时间戳(秒)
optional string changeRegDateStr = 2; // 工商变更登记日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 changeDate = 3; // 股份变动日时间戳(秒)
optional string changeDateStr = 4; // 股份变动日字符串,格式 YYYY-MM-DD,对应市场时区
optional string eventProceDesc = 5; // 事件进程描述
optional uint64 advanceDate = 6; // 预案公告日时间戳(秒)
optional string advanceDateStr = 7; // 预案公告日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 meetPassDate = 8; // 股东大会通过日时间戳(秒)
optional string meetPassDateStr = 9; // 股东大会通过日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 startDate = 10; // 回购开始日时间戳(秒)
optional string startDateStr = 11; // 回购开始日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 endDate = 12; // 回购截止日时间戳(秒)
optional string endDateStr = 13; // 回购截止日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 payDate = 14; // 支付日时间戳(秒)
optional string payDateStr = 15; // 支付日字符串,格式 YYYY-MM-DD,对应市场时区
optional string seller = 16; // 出售方(股份被回购方)
optional string buyBackMode = 17; // 回购方式
optional string shareType = 18; // 股份类别
optional int64 buyBackSum = 19; // 回购股数(股)
optional double buyBackMoney = 20; // 回购金额
optional double percentage = 21; // 占已发行股份百分比,百分号前的值,如 12.34 表示 12.34%
optional double valueFloor = 22; // 拟回购资金总额下限
optional double valueCeiling = 23; // 拟回购资金总额上限
optional double priceFloor = 24; // 回购价格下限
optional double priceCeiling = 25; // 回购价格上限
optional double volumeFloor = 26; // 拟回购股数下限
optional double volumeCeiling = 27; // 拟回购股数上限
}
message S2C
{
repeated HKBuyBackItem hkBuyBackList = 1; // 港股回购列表
repeated ABuyBackItem aBuyBackList = 2; // A股回购列表
optional string nextKey = 3; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // 返回结果,详见 Common.RetType
optional string retMsg = 2; // 返回结果描述
optional int32 errCode = 3; // 错误码
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
- 接口调用结果,结构参见 RetType
- Example
public class QotDemo implements FTSPI_Qot, FTSPI_Conn {
FTAPI_Conn_Qot qot = new FTAPI_Conn_Qot();
public QotDemo() {
qot.setClientInfo("javaclient", 1);
qot.setConnSpi(this);
qot.setQotSpi(this);
}
public void start() {
qot.initConnect("127.0.0.1", (short)11111, false);
}
@Override
public void onInitConnect(FTAPI_Conn client, long errCode, String desc)
{
System.out.printf("Qot onInitConnect: ret=%b desc=%s connID=%d\n", errCode, desc, client.getConnectID());
if (errCode != 0)
return;
QotCommon.Security sec = QotCommon.Security.newBuilder()
.setMarket(QotCommon.QotMarket.QotMarket_HK_Security_VALUE)
.setCode("00700")
.build();
QotGetCorporateActionsBuybacks.C2S c2s = QotGetCorporateActionsBuybacks.C2S.newBuilder()
.setSecurity(sec)
.build();
QotGetCorporateActionsBuybacks.Request req = QotGetCorporateActionsBuybacks.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getCorporateActionsBuybacks(req);
System.out.printf("Send QotGetCorporateActionsBuybacks: %d\n", seqNo);
}
@Override
public void onDisconnect(FTAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d\n", errCode);
}
@Override
public void onReply_GetCorporateActionsBuybacks(FTAPI_Conn client, int nSerialNo, QotGetCorporateActionsBuybacks.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetCorporateActionsBuybacks failed: %s\n", rsp.getRetMsg());
}
else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetCorporateActionsBuybacks: %s\n", json);
} catch (InvalidProtocolBufferException e) {
e.printStackTrace();
}
}
}
public static void main(String[] args) {
FTAPI.init();
QotDemo qot = new QotDemo();
qot.start();
while (true) {
try {
Thread.sleep(1000 * 600);
} catch (InterruptedException exc) {
}
}
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
- Output
Qot onInitConnect: ret=0 desc= connID=7459213565725268172
Send Qot_GetCorporateActionsBuybacks: 2
Receive Qot_GetCorporateActionsBuybacks: retType: 0
retMsg: ""
errCode: 0
s2c {
hkBuyBackList {
publDate: 1775664000
publDateStr: "2026-04-09"
endDate: 1775664000
endDateStr: "2026-04-09"
buyBackMoney: 1.0008807176E9
buyBackSum: 1964000
percentage: 0.021373
highPrice: 514.5
lowPrice: 503.0
cumulativeSum: 119812000
cumulativePercentage: 1.30386
shareType: "普通股"
}
hkBuyBackList {
//...
}
nextKey: "10"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Futu::u32_t GetCorporateActionsBuybacks(const Qot_GetCorporateActionsBuybacks::Request &stReq);
virtual void OnReply_GetCorporateActionsBuybacks(Futu::u32_t nSerialNo, const Qot_GetCorporateActionsBuybacks::Response &stRsp) = 0;
介绍
获取回购
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional string nextKey = 2; // 分页标识,首次不填,续拉时填上次返回的 nextKey;"-1" 表示无更多数据
optional int32 num = 3; // 每页返回数量,默认 10,范围 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- 股票结构参见 Security
- 返回
// 港股回购单条记录
message HKBuyBackItem
{
optional uint64 publDate = 1; // 公告日时间戳(秒)
optional string publDateStr = 2; // 公告日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 endDate = 3; // 回购截止日时间戳(秒)
optional string endDateStr = 4; // 回购截止日字符串,格式 YYYY-MM-DD,对应市场时区
optional double buyBackMoney = 5; // 回购金额
optional int64 buyBackSum = 6; // 回购股数(股)
optional double percentage = 7; // 占已发行股份百分比,百分号前的值,如 12.34 表示 12.34%
optional double highPrice = 8; // 最高回购价
optional double lowPrice = 9; // 最低回购价
optional int64 cumulativeSum = 10; // 本轮累计回购股数(股)
optional double cumulativePercentage = 11; // 本轮累计回购占总股本百分比,百分号前的值,如 12.34 表示 12.34%
optional string shareType = 12; // 股份类别
}
// A股回购单条记录
message ABuyBackItem
{
optional uint64 changeRegDate = 1; // 工商变更登记日时间戳(秒)
optional string changeRegDateStr = 2; // 工商变更登记日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 changeDate = 3; // 股份变动日时间戳(秒)
optional string changeDateStr = 4; // 股份变动日字符串,格式 YYYY-MM-DD,对应市场时区
optional string eventProceDesc = 5; // 事件进程描述
optional uint64 advanceDate = 6; // 预案公告日时间戳(秒)
optional string advanceDateStr = 7; // 预案公告日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 meetPassDate = 8; // 股东大会通过日时间戳(秒)
optional string meetPassDateStr = 9; // 股东大会通过日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 startDate = 10; // 回购开始日时间戳(秒)
optional string startDateStr = 11; // 回购开始日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 endDate = 12; // 回购截止日时间戳(秒)
optional string endDateStr = 13; // 回购截止日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 payDate = 14; // 支付日时间戳(秒)
optional string payDateStr = 15; // 支付日字符串,格式 YYYY-MM-DD,对应市场时区
optional string seller = 16; // 出售方(股份被回购方)
optional string buyBackMode = 17; // 回购方式
optional string shareType = 18; // 股份类别
optional int64 buyBackSum = 19; // 回购股数(股)
optional double buyBackMoney = 20; // 回购金额
optional double percentage = 21; // 占已发行股份百分比,百分号前的值,如 12.34 表示 12.34%
optional double valueFloor = 22; // 拟回购资金总额下限
optional double valueCeiling = 23; // 拟回购资金总额上限
optional double priceFloor = 24; // 回购价格下限
optional double priceCeiling = 25; // 回购价格上限
optional double volumeFloor = 26; // 拟回购股数下限
optional double volumeCeiling = 27; // 拟回购股数上限
}
message S2C
{
repeated HKBuyBackItem hkBuyBackList = 1; // 港股回购列表
repeated ABuyBackItem aBuyBackList = 2; // A股回购列表
optional string nextKey = 3; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // 返回结果,详见 Common.RetType
optional string retMsg = 2; // 返回结果描述
optional int32 errCode = 3; // 错误码
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
- 接口调用结果,结构参见 RetType
- Example
class Program : public FTSPI_Qot, public FTSPI_Trd, public FTSPI_Conn
{
public:
Program() {
m_pQotApi = FTAPI::CreateQotApi();
m_pQotApi->RegisterQotSpi(this);
m_pQotApi->RegisterConnSpi(this);
}
~Program() {
if (m_pQotApi != nullptr)
{
m_pQotApi->UnregisterQotSpi();
m_pQotApi->UnregisterConnSpi();
FTAPI::ReleaseQotApi(m_pQotApi);
m_pQotApi = nullptr;
}
}
void Start() {
m_pQotApi->InitConnect("127.0.0.1", 11111, false);
}
virtual void OnInitConnect(FTAPI_Conn* pConn, Futu::i64_t nErrCode, const char* strDesc) {
cout << "connect" << endl;
// construct request message
Qot_GetCorporateActionsBuybacks::Request req;
Qot_GetCorporateActionsBuybacks::C2S *c2s = req.mutable_c2s();
Qot_Common::Security *sec = c2s->mutable_security();
sec->set_code("00700");
sec->set_market(Qot_Common::QotMarket::QotMarket_HK_Security);
m_pQotApi->GetCorporateActionsBuybacks(req);
cout << "GetCorporateActionsBuybacks" << endl;
}
virtual void OnReply_GetCorporateActionsBuybacks(Futu::u32_t nSerialNo, const Qot_GetCorporateActionsBuybacks::Response &stRsp){
cout << "OnReply_GetCorporateActionsBuybacks:" << endl;
// print response
// ProtoBufToBodyData and UTF8ToLocal refer to tool.h in Samples
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
FTAPI_Qot *m_pQotApi;
};
int32_t main(int32_t argc, char** argv)
{
FTAPI::Init();
{
Program program;
program.Start();
getchar();
}
protobuf::ShutdownProtobufLibrary();
FTAPI::UnInit();
return 0;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
- Output
onInitConnect: ret=0 desc=Succeed!
Send Qot_GetCorporateActionsBuybacks seqNo=3
retType: 0
retMsg: ""
errCode: 0
s2c {
hkBuyBackList {
publDate: 1775664000
publDateStr: "2026-04-09"
endDate: 1775664000
endDateStr: "2026-04-09"
buyBackMoney: 1000880717.6
buyBackSum: 1964000
percentage: 0.021373
highPrice: 514.5
lowPrice: 503
cumulativeSum: 119812000
cumulativePercentage: 1.30386
shareType: "普通股"
}
hkBuyBackList {
//...
}
nextKey: "10"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
GetCorporateActionsBuybacks(req);
介绍
获取回购
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional string nextKey = 2; // 分页标识,首次不填,续拉时填上次返回的 nextKey;"-1" 表示无更多数据
optional int32 num = 3; // 每页返回数量,默认 10,范围 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- 股票结构参见 Security
- 返回
// 港股回购单条记录
message HKBuyBackItem
{
optional uint64 publDate = 1; // 公告日时间戳(秒)
optional string publDateStr = 2; // 公告日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 endDate = 3; // 回购截止日时间戳(秒)
optional string endDateStr = 4; // 回购截止日字符串,格式 YYYY-MM-DD,对应市场时区
optional double buyBackMoney = 5; // 回购金额
optional int64 buyBackSum = 6; // 回购股数(股)
optional double percentage = 7; // 占已发行股份百分比,百分号前的值,如 12.34 表示 12.34%
optional double highPrice = 8; // 最高回购价
optional double lowPrice = 9; // 最低回购价
optional int64 cumulativeSum = 10; // 本轮累计回购股数(股)
optional double cumulativePercentage = 11; // 本轮累计回购占总股本百分比,百分号前的值,如 12.34 表示 12.34%
optional string shareType = 12; // 股份类别
}
// A股回购单条记录
message ABuyBackItem
{
optional uint64 changeRegDate = 1; // 工商变更登记日时间戳(秒)
optional string changeRegDateStr = 2; // 工商变更登记日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 changeDate = 3; // 股份变动日时间戳(秒)
optional string changeDateStr = 4; // 股份变动日字符串,格式 YYYY-MM-DD,对应市场时区
optional string eventProceDesc = 5; // 事件进程描述
optional uint64 advanceDate = 6; // 预案公告日时间戳(秒)
optional string advanceDateStr = 7; // 预案公告日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 meetPassDate = 8; // 股东大会通过日时间戳(秒)
optional string meetPassDateStr = 9; // 股东大会通过日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 startDate = 10; // 回购开始日时间戳(秒)
optional string startDateStr = 11; // 回购开始日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 endDate = 12; // 回购截止日时间戳(秒)
optional string endDateStr = 13; // 回购截止日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 payDate = 14; // 支付日时间戳(秒)
optional string payDateStr = 15; // 支付日字符串,格式 YYYY-MM-DD,对应市场时区
optional string seller = 16; // 出售方(股份被回购方)
optional string buyBackMode = 17; // 回购方式
optional string shareType = 18; // 股份类别
optional int64 buyBackSum = 19; // 回购股数(股)
optional double buyBackMoney = 20; // 回购金额
optional double percentage = 21; // 占已发行股份百分比,百分号前的值,如 12.34 表示 12.34%
optional double valueFloor = 22; // 拟回购资金总额下限
optional double valueCeiling = 23; // 拟回购资金总额上限
optional double priceFloor = 24; // 回购价格下限
optional double priceCeiling = 25; // 回购价格上限
optional double volumeFloor = 26; // 拟回购股数下限
optional double volumeCeiling = 27; // 拟回购股数上限
}
message S2C
{
repeated HKBuyBackItem hkBuyBackList = 1; // 港股回购列表
repeated ABuyBackItem aBuyBackList = 2; // A股回购列表
optional string nextKey = 3; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // 返回结果,详见 Common.RetType
optional string retMsg = 2; // 返回结果描述
optional int32 errCode = 3; // 错误码
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
- 接口调用结果,结构参见 RetType
- Example
import ftWebsocket from "futu-api";
import { Common, Qot_Common } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetCorporateActionsBuybacks(){
const { RetType } = Common
const { QotMarket } = Qot_Common
let [addr, port, enable_ssl, key] = ["127.0.0.1", 33333, false, '7522027ccf5a06b1'];
let websocket = new ftWebsocket();
websocket.onlogin = (ret, msg)=>{
if (ret) {
const req = {
c2s: {
security: {
market: QotMarket.QotMarket_HK_Security,
code: "00700",
},
},
};
websocket.GetCorporateActionsBuybacks(req)
.then((res) => {
let { errCode, retMsg, retType,s2c } = res
console.log("GetCorporateActionsBuybacks: errCode %d, retMsg %s, retType %d", errCode, retMsg, retType);
if(retType == RetType.RetType_Succeed){
let data = beautify(JSON.stringify(s2c), {
indent_size: 2,
space_in_empty_paren: true,
});
console.log(data);
}
})
.catch((error) => {
console.log("error:", error);
});
} else {
console.log("error", msg);
}
};
websocket.start(addr, port, enable_ssl, key);
setTimeout(()=>{
websocket.stop();
console.log("stop");
}, 5000);
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
- Output
GetCorporateActionsBuybacks: errCode 0, retMsg , retType 0
{
"hkBuyBackList": [{
"publDate": "1775664000",
"publDateStr": "2026-04-09",
"endDate": "1775664000",
"endDateStr": "2026-04-09",
"buyBackMoney": 1000880717.6,
"buyBackSum": "1964000",
"percentage": 0.021373,
"highPrice": 514.5,
"lowPrice": 503,
"cumulativeSum": "119812000",
"cumulativePercentage": 1.30386,
"shareType": "普通股"
//...
}],
"nextKey": "10"
}
stop
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
接口限制
- 每 30 秒内最多请求 30 次。
- 支持港股、A股正股及基金。
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_corporate_actions_buybacks(code, next_key=None, num=None)
介绍
获取股票的回购记录(港股 / A 股,支持分页)
参数
参数 类型 说明 code str 股票代码 如 HK.00700;支持港股、A股正股及基金next_key str 分页标识 首次不填,续拉时填上次返回的 next_key;"-1" 表示无更多数据num int 每页数量 每页返回数量,默认 10,范围 1~50返回
参数 类型 说明 ret RET_CODE 接口调用结果 data dict 当 ret == RET_OK,返回回购数据字典 str 当 ret != RET_OK,返回错误描述 返回字典包含以下字段:
字段 类型 说明 next_key str 分页标识 "-1" 表示无更多数据;续拉时将此值传入请求参数 next_keyhk_buy_back_list pd.DataFrame 港股回购列表 每项见 hk_buy_back_list 字段表;A股标的此列表为空a_buy_back_list pd.DataFrame A股回购列表 每项见 a_buy_back_list 字段表;港股标的此列表为空hk_buy_back_list 字段(港股回购条目):
字段 类型 说明 publ_date int 公告日时间戳 Unix 时间戳(秒),对应市场时区publ_date_str str 公告日 格式 YYYY-MM-DD,对应市场时区end_date int 回购截止日时间戳 Unix 时间戳(秒),对应市场时区end_date_str str 回购截止日 格式 YYYY-MM-DD,对应市场时区buy_back_money float 回购金额 buy_back_sum int 回购股数 单位:股percentage float 占总股本比例 百分号前的值,如 12.34 表示 12.34%high_price float 最高回购价 low_price float 最低回购价 cumulative_sum int 本轮累计回购股数 单位:股cumulative_percentage float 本轮累计占总股本比例 百分号前的值,如 12.34 表示 12.34%share_type str 股份类别 a_buy_back_list 字段(A股回购条目):
字段 类型 说明 change_reg_date int 工商变更登记日时间戳 Unix 时间戳(秒),对应市场时区change_reg_date_str str 工商变更登记日 格式 YYYY-MM-DD,对应市场时区change_date int 股份变动日时间戳 Unix 时间戳(秒),对应市场时区change_date_str str 股份变动日 格式 YYYY-MM-DD,对应市场时区event_proce_desc str 事件进程描述 advance_date int 预案公告日时间戳 Unix 时间戳(秒),对应市场时区advance_date_str str 预案公告日 格式 YYYY-MM-DD,对应市场时区meet_pass_date int 股东大会通过日时间戳 Unix 时间戳(秒),对应市场时区meet_pass_date_str str 股东大会通过日 格式 YYYY-MM-DD,对应市场时区start_date int 回购开始日时间戳 Unix 时间戳(秒),对应市场时区start_date_str str 回购开始日 格式 YYYY-MM-DD,对应市场时区end_date int 回购截止日时间戳 Unix 时间戳(秒),对应市场时区end_date_str str 回购截止日 格式 YYYY-MM-DD,对应市场时区pay_date int 支付日时间戳 Unix 时间戳(秒),对应市场时区pay_date_str str 支付日 格式 YYYY-MM-DD,对应市场时区seller str 出售方 股份被回购方buy_back_mode str 回购方式 share_type str 股份类别 buy_back_sum int 回购股数 单位:股buy_back_money float 回购金额 percentage float 占总股本比例 百分号前的值,如 12.34 表示 12.34%value_floor float 拟回购资金总额下限 value_ceiling float 拟回购资金总额上限 price_floor float 回购价格下限 price_ceiling float 回购价格上限 volume_floor float 拟回购股数下限 volume_ceiling float 拟回购股数上限
Example
from moomoo import *
import pandas as pd
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_corporate_actions_buybacks("HK.00700", num=3)
if ret == RET_OK:
df = pd.DataFrame(data.get('hk_buy_back_list', []))
print(df.to_string(index=False))
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
- Output
publ_date publ_date_str end_date end_date_str buy_back_money buy_back_sum percentage high_price low_price cumulative_sum cumulative_percentage share_type
1775664000 2026-04-09 1775664000 2026-04-09 1000880717.6 1964000 0.021373 514.5 503.0 119812000 1.30386 普通股
1775577600 2026-04-08 1775577600 2026-04-08 1000761103.7 1979000 0.021537 510.0 501.0 117848000 1.28249 普通股
1775059200 2026-04-02 1775059200 2026-04-02 300715258.5 615000 0.006693 496.0 485.2 115869000 1.26095 普通股
2
3
4
# Qot_GetCorporateActionsBuybacks.proto
介绍
获取回购
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional string nextKey = 2; // 分页标识,首次不填,续拉时填上次返回的 nextKey;"-1" 表示无更多数据
optional int32 num = 3; // 每页返回数量,默认 10,范围 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- 股票结构参见 Security
- 返回
// 港股回购单条记录
message HKBuyBackItem
{
optional uint64 publDate = 1; // 公告日时间戳(秒)
optional string publDateStr = 2; // 公告日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 endDate = 3; // 回购截止日时间戳(秒)
optional string endDateStr = 4; // 回购截止日字符串,格式 YYYY-MM-DD,对应市场时区
optional double buyBackMoney = 5; // 回购金额
optional int64 buyBackSum = 6; // 回购股数(股)
optional double percentage = 7; // 占已发行股份百分比,百分号前的值,如 12.34 表示 12.34%
optional double highPrice = 8; // 最高回购价
optional double lowPrice = 9; // 最低回购价
optional int64 cumulativeSum = 10; // 本轮累计回购股数(股)
optional double cumulativePercentage = 11; // 本轮累计回购占总股本百分比,百分号前的值,如 12.34 表示 12.34%
optional string shareType = 12; // 股份类别
}
// A股回购单条记录
message ABuyBackItem
{
optional uint64 changeRegDate = 1; // 工商变更登记日时间戳(秒)
optional string changeRegDateStr = 2; // 工商变更登记日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 changeDate = 3; // 股份变动日时间戳(秒)
optional string changeDateStr = 4; // 股份变动日字符串,格式 YYYY-MM-DD,对应市场时区
optional string eventProceDesc = 5; // 事件进程描述
optional uint64 advanceDate = 6; // 预案公告日时间戳(秒)
optional string advanceDateStr = 7; // 预案公告日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 meetPassDate = 8; // 股东大会通过日时间戳(秒)
optional string meetPassDateStr = 9; // 股东大会通过日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 startDate = 10; // 回购开始日时间戳(秒)
optional string startDateStr = 11; // 回购开始日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 endDate = 12; // 回购截止日时间戳(秒)
optional string endDateStr = 13; // 回购截止日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 payDate = 14; // 支付日时间戳(秒)
optional string payDateStr = 15; // 支付日字符串,格式 YYYY-MM-DD,对应市场时区
optional string seller = 16; // 出售方(股份被回购方)
optional string buyBackMode = 17; // 回购方式
optional string shareType = 18; // 股份类别
optional int64 buyBackSum = 19; // 回购股数(股)
optional double buyBackMoney = 20; // 回购金额
optional double percentage = 21; // 占已发行股份百分比,百分号前的值,如 12.34 表示 12.34%
optional double valueFloor = 22; // 拟回购资金总额下限
optional double valueCeiling = 23; // 拟回购资金总额上限
optional double priceFloor = 24; // 回购价格下限
optional double priceCeiling = 25; // 回购价格上限
optional double volumeFloor = 26; // 拟回购股数下限
optional double volumeCeiling = 27; // 拟回购股数上限
}
message S2C
{
repeated HKBuyBackItem hkBuyBackList = 1; // 港股回购列表
repeated ABuyBackItem aBuyBackList = 2; // A股回购列表
optional string nextKey = 3; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // 返回结果,详见 Common.RetType
optional string retMsg = 2; // 返回结果描述
optional int32 errCode = 3; // 错误码
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
- 接口调用结果,结构参见 RetType
协议 ID
3235
uint GetCorporateActionsBuybacks(QotGetCorporateActionsBuybacks.Request req);
virtual void OnReply_GetCorporateActionsBuybacks(MMAPI_Conn client, uint nSerialNo, QotGetCorporateActionsBuybacks.Response rsp);
介绍
获取回购
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional string nextKey = 2; // 分页标识,首次不填,续拉时填上次返回的 nextKey;"-1" 表示无更多数据
optional int32 num = 3; // 每页返回数量,默认 10,范围 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- 股票结构参见 Security
- 返回
// 港股回购单条记录
message HKBuyBackItem
{
optional uint64 publDate = 1; // 公告日时间戳(秒)
optional string publDateStr = 2; // 公告日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 endDate = 3; // 回购截止日时间戳(秒)
optional string endDateStr = 4; // 回购截止日字符串,格式 YYYY-MM-DD,对应市场时区
optional double buyBackMoney = 5; // 回购金额
optional int64 buyBackSum = 6; // 回购股数(股)
optional double percentage = 7; // 占已发行股份百分比,百分号前的值,如 12.34 表示 12.34%
optional double highPrice = 8; // 最高回购价
optional double lowPrice = 9; // 最低回购价
optional int64 cumulativeSum = 10; // 本轮累计回购股数(股)
optional double cumulativePercentage = 11; // 本轮累计回购占总股本百分比,百分号前的值,如 12.34 表示 12.34%
optional string shareType = 12; // 股份类别
}
// A股回购单条记录
message ABuyBackItem
{
optional uint64 changeRegDate = 1; // 工商变更登记日时间戳(秒)
optional string changeRegDateStr = 2; // 工商变更登记日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 changeDate = 3; // 股份变动日时间戳(秒)
optional string changeDateStr = 4; // 股份变动日字符串,格式 YYYY-MM-DD,对应市场时区
optional string eventProceDesc = 5; // 事件进程描述
optional uint64 advanceDate = 6; // 预案公告日时间戳(秒)
optional string advanceDateStr = 7; // 预案公告日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 meetPassDate = 8; // 股东大会通过日时间戳(秒)
optional string meetPassDateStr = 9; // 股东大会通过日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 startDate = 10; // 回购开始日时间戳(秒)
optional string startDateStr = 11; // 回购开始日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 endDate = 12; // 回购截止日时间戳(秒)
optional string endDateStr = 13; // 回购截止日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 payDate = 14; // 支付日时间戳(秒)
optional string payDateStr = 15; // 支付日字符串,格式 YYYY-MM-DD,对应市场时区
optional string seller = 16; // 出售方(股份被回购方)
optional string buyBackMode = 17; // 回购方式
optional string shareType = 18; // 股份类别
optional int64 buyBackSum = 19; // 回购股数(股)
optional double buyBackMoney = 20; // 回购金额
optional double percentage = 21; // 占已发行股份百分比,百分号前的值,如 12.34 表示 12.34%
optional double valueFloor = 22; // 拟回购资金总额下限
optional double valueCeiling = 23; // 拟回购资金总额上限
optional double priceFloor = 24; // 回购价格下限
optional double priceCeiling = 25; // 回购价格上限
optional double volumeFloor = 26; // 拟回购股数下限
optional double volumeCeiling = 27; // 拟回购股数上限
}
message S2C
{
repeated HKBuyBackItem hkBuyBackList = 1; // 港股回购列表
repeated ABuyBackItem aBuyBackList = 2; // A股回购列表
optional string nextKey = 3; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // 返回结果,详见 Common.RetType
optional string retMsg = 2; // 返回结果描述
optional int32 errCode = 3; // 错误码
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
- 接口调用结果,结构参见 RetType
- Example
public class Program : MMSPI_Qot, MMSPI_Conn
{
MMAPI_Qot qot = new MMAPI_Qot();
public Program()
{
qot.SetClientInfo("csharp", 1);
qot.SetConnCallback(this);
qot.SetQotCallback(this);
}
public void Start()
{
qot.InitConnect("127.0.0.1", (ushort)11111, false);
}
public void OnInitConnect(MMAPI_Conn client, long errCode, String desc)
{
Console.Write("Qot onInitConnect: ret={0} desc={1} connID={2}\n", errCode, desc, client.GetConnectID());
if (errCode != 0)
return;
QotCommon.Security sec = QotCommon.Security.CreateBuilder()
.SetMarket((int)QotCommon.QotMarket.QotMarket_HK_Security)
.SetCode("00700")
.Build();
QotGetCorporateActionsBuybacks.C2S c2s = QotGetCorporateActionsBuybacks.C2S.CreateBuilder()
.SetSecurity(sec)
.Build();
QotGetCorporateActionsBuybacks.Request req = QotGetCorporateActionsBuybacks.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetCorporateActionsBuybacks(req);
Console.Write("Send QotGetCorporateActionsBuybacks: {0}\n", seqNo);
}
public void OnDisconnect(MMAPI_Conn client, long errCode)
{
Console.Write("Qot onDisConnect: {0}\n", errCode);
}
public void OnReply_GetCorporateActionsBuybacks(MMAPI_Conn client, uint nSerialNo, QotGetCorporateActionsBuybacks.Response rsp)
{
Console.Write("Reply: QotGetCorporateActionsBuybacks: {0} {1}\n", nSerialNo, rsp.ToString());
}
public static void Main(String[] args)
{
MMAPI.Init();
Program qot = new Program();
qot.Start();
while (true)
Thread.Sleep(1000 * 600);
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
- Output
sent seqNo=3
retType: 0
retMsg: ""
errCode: 0
s2c {
hkBuyBackList {
publDate: 1775664000
publDateStr: "2026-04-09"
endDate: 1775664000
endDateStr: "2026-04-09"
buyBackMoney: 1000880717.6
buyBackSum: 1964000
percentage: 0.021373
highPrice: 514.5
lowPrice: 503
cumulativeSum: 119812000
cumulativePercentage: 1.30386
shareType: "普通股"
}
hkBuyBackList {
//...
}
nextKey: "10"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
int getCorporateActionsBuybacks(QotGetCorporateActionsBuybacks.Request req);
void onReply_GetCorporateActionsBuybacks(MMAPI_Conn client, int nSerialNo, QotGetCorporateActionsBuybacks.Response rsp);
介绍
获取回购
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional string nextKey = 2; // 分页标识,首次不填,续拉时填上次返回的 nextKey;"-1" 表示无更多数据
optional int32 num = 3; // 每页返回数量,默认 10,范围 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- 股票结构参见 Security
- 返回
// 港股回购单条记录
message HKBuyBackItem
{
optional uint64 publDate = 1; // 公告日时间戳(秒)
optional string publDateStr = 2; // 公告日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 endDate = 3; // 回购截止日时间戳(秒)
optional string endDateStr = 4; // 回购截止日字符串,格式 YYYY-MM-DD,对应市场时区
optional double buyBackMoney = 5; // 回购金额
optional int64 buyBackSum = 6; // 回购股数(股)
optional double percentage = 7; // 占已发行股份百分比,百分号前的值,如 12.34 表示 12.34%
optional double highPrice = 8; // 最高回购价
optional double lowPrice = 9; // 最低回购价
optional int64 cumulativeSum = 10; // 本轮累计回购股数(股)
optional double cumulativePercentage = 11; // 本轮累计回购占总股本百分比,百分号前的值,如 12.34 表示 12.34%
optional string shareType = 12; // 股份类别
}
// A股回购单条记录
message ABuyBackItem
{
optional uint64 changeRegDate = 1; // 工商变更登记日时间戳(秒)
optional string changeRegDateStr = 2; // 工商变更登记日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 changeDate = 3; // 股份变动日时间戳(秒)
optional string changeDateStr = 4; // 股份变动日字符串,格式 YYYY-MM-DD,对应市场时区
optional string eventProceDesc = 5; // 事件进程描述
optional uint64 advanceDate = 6; // 预案公告日时间戳(秒)
optional string advanceDateStr = 7; // 预案公告日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 meetPassDate = 8; // 股东大会通过日时间戳(秒)
optional string meetPassDateStr = 9; // 股东大会通过日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 startDate = 10; // 回购开始日时间戳(秒)
optional string startDateStr = 11; // 回购开始日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 endDate = 12; // 回购截止日时间戳(秒)
optional string endDateStr = 13; // 回购截止日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 payDate = 14; // 支付日时间戳(秒)
optional string payDateStr = 15; // 支付日字符串,格式 YYYY-MM-DD,对应市场时区
optional string seller = 16; // 出售方(股份被回购方)
optional string buyBackMode = 17; // 回购方式
optional string shareType = 18; // 股份类别
optional int64 buyBackSum = 19; // 回购股数(股)
optional double buyBackMoney = 20; // 回购金额
optional double percentage = 21; // 占已发行股份百分比,百分号前的值,如 12.34 表示 12.34%
optional double valueFloor = 22; // 拟回购资金总额下限
optional double valueCeiling = 23; // 拟回购资金总额上限
optional double priceFloor = 24; // 回购价格下限
optional double priceCeiling = 25; // 回购价格上限
optional double volumeFloor = 26; // 拟回购股数下限
optional double volumeCeiling = 27; // 拟回购股数上限
}
message S2C
{
repeated HKBuyBackItem hkBuyBackList = 1; // 港股回购列表
repeated ABuyBackItem aBuyBackList = 2; // A股回购列表
optional string nextKey = 3; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // 返回结果,详见 Common.RetType
optional string retMsg = 2; // 返回结果描述
optional int32 errCode = 3; // 错误码
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
- 接口调用结果,结构参见 RetType
- Example
public class QotDemo implements MMSPI_Qot, MMSPI_Conn {
MMAPI_Conn_Qot qot = new MMAPI_Conn_Qot();
public QotDemo() {
qot.setClientInfo("javaclient", 1);
qot.setConnSpi(this);
qot.setQotSpi(this);
}
public void start() {
qot.initConnect("127.0.0.1", (short)11111, false);
}
@Override
public void onInitConnect(MMAPI_Conn client, long errCode, String desc)
{
System.out.printf("Qot onInitConnect: ret=%b desc=%s connID=%d\n", errCode, desc, client.getConnectID());
if (errCode != 0)
return;
QotCommon.Security sec = QotCommon.Security.newBuilder()
.setMarket(QotCommon.QotMarket.QotMarket_HK_Security_VALUE)
.setCode("00700")
.build();
QotGetCorporateActionsBuybacks.C2S c2s = QotGetCorporateActionsBuybacks.C2S.newBuilder()
.setSecurity(sec)
.build();
QotGetCorporateActionsBuybacks.Request req = QotGetCorporateActionsBuybacks.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getCorporateActionsBuybacks(req);
System.out.printf("Send QotGetCorporateActionsBuybacks: %d\n", seqNo);
}
@Override
public void onDisconnect(MMAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d\n", errCode);
}
@Override
public void onReply_GetCorporateActionsBuybacks(MMAPI_Conn client, int nSerialNo, QotGetCorporateActionsBuybacks.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetCorporateActionsBuybacks failed: %s\n", rsp.getRetMsg());
}
else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetCorporateActionsBuybacks: %s\n", json);
} catch (InvalidProtocolBufferException e) {
e.printStackTrace();
}
}
}
public static void main(String[] args) {
MMAPI.init();
QotDemo qot = new QotDemo();
qot.start();
while (true) {
try {
Thread.sleep(1000 * 600);
} catch (InterruptedException exc) {
}
}
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
- Output
Qot onInitConnect: ret=0 desc= connID=7459213565725268172
Send Qot_GetCorporateActionsBuybacks: 2
Receive Qot_GetCorporateActionsBuybacks: retType: 0
retMsg: ""
errCode: 0
s2c {
hkBuyBackList {
publDate: 1775664000
publDateStr: "2026-04-09"
endDate: 1775664000
endDateStr: "2026-04-09"
buyBackMoney: 1.0008807176E9
buyBackSum: 1964000
percentage: 0.021373
highPrice: 514.5
lowPrice: 503.0
cumulativeSum: 119812000
cumulativePercentage: 1.30386
shareType: "普通股"
}
hkBuyBackList {
//...
}
nextKey: "10"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
moomoo::u32_t GetCorporateActionsBuybacks(const Qot_GetCorporateActionsBuybacks::Request &stReq);
virtual void OnReply_GetCorporateActionsBuybacks(moomoo::u32_t nSerialNo, const Qot_GetCorporateActionsBuybacks::Response &stRsp) = 0;
介绍
获取回购
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional string nextKey = 2; // 分页标识,首次不填,续拉时填上次返回的 nextKey;"-1" 表示无更多数据
optional int32 num = 3; // 每页返回数量,默认 10,范围 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- 股票结构参见 Security
- 返回
// 港股回购单条记录
message HKBuyBackItem
{
optional uint64 publDate = 1; // 公告日时间戳(秒)
optional string publDateStr = 2; // 公告日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 endDate = 3; // 回购截止日时间戳(秒)
optional string endDateStr = 4; // 回购截止日字符串,格式 YYYY-MM-DD,对应市场时区
optional double buyBackMoney = 5; // 回购金额
optional int64 buyBackSum = 6; // 回购股数(股)
optional double percentage = 7; // 占已发行股份百分比,百分号前的值,如 12.34 表示 12.34%
optional double highPrice = 8; // 最高回购价
optional double lowPrice = 9; // 最低回购价
optional int64 cumulativeSum = 10; // 本轮累计回购股数(股)
optional double cumulativePercentage = 11; // 本轮累计回购占总股本百分比,百分号前的值,如 12.34 表示 12.34%
optional string shareType = 12; // 股份类别
}
// A股回购单条记录
message ABuyBackItem
{
optional uint64 changeRegDate = 1; // 工商变更登记日时间戳(秒)
optional string changeRegDateStr = 2; // 工商变更登记日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 changeDate = 3; // 股份变动日时间戳(秒)
optional string changeDateStr = 4; // 股份变动日字符串,格式 YYYY-MM-DD,对应市场时区
optional string eventProceDesc = 5; // 事件进程描述
optional uint64 advanceDate = 6; // 预案公告日时间戳(秒)
optional string advanceDateStr = 7; // 预案公告日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 meetPassDate = 8; // 股东大会通过日时间戳(秒)
optional string meetPassDateStr = 9; // 股东大会通过日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 startDate = 10; // 回购开始日时间戳(秒)
optional string startDateStr = 11; // 回购开始日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 endDate = 12; // 回购截止日时间戳(秒)
optional string endDateStr = 13; // 回购截止日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 payDate = 14; // 支付日时间戳(秒)
optional string payDateStr = 15; // 支付日字符串,格式 YYYY-MM-DD,对应市场时区
optional string seller = 16; // 出售方(股份被回购方)
optional string buyBackMode = 17; // 回购方式
optional string shareType = 18; // 股份类别
optional int64 buyBackSum = 19; // 回购股数(股)
optional double buyBackMoney = 20; // 回购金额
optional double percentage = 21; // 占已发行股份百分比,百分号前的值,如 12.34 表示 12.34%
optional double valueFloor = 22; // 拟回购资金总额下限
optional double valueCeiling = 23; // 拟回购资金总额上限
optional double priceFloor = 24; // 回购价格下限
optional double priceCeiling = 25; // 回购价格上限
optional double volumeFloor = 26; // 拟回购股数下限
optional double volumeCeiling = 27; // 拟回购股数上限
}
message S2C
{
repeated HKBuyBackItem hkBuyBackList = 1; // 港股回购列表
repeated ABuyBackItem aBuyBackList = 2; // A股回购列表
optional string nextKey = 3; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // 返回结果,详见 Common.RetType
optional string retMsg = 2; // 返回结果描述
optional int32 errCode = 3; // 错误码
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
- 接口调用结果,结构参见 RetType
- Example
class Program : public MMSPI_Qot, public MMSPI_Trd, public MMSPI_Conn
{
public:
Program() {
m_pQotApi = MMAPI::CreateQotApi();
m_pQotApi->RegisterQotSpi(this);
m_pQotApi->RegisterConnSpi(this);
}
~Program() {
if (m_pQotApi != nullptr)
{
m_pQotApi->UnregisterQotSpi();
m_pQotApi->UnregisterConnSpi();
MMAPI::ReleaseQotApi(m_pQotApi);
m_pQotApi = nullptr;
}
}
void Start() {
m_pQotApi->InitConnect("127.0.0.1", 11111, false);
}
virtual void OnInitConnect(MMAPI_Conn* pConn, moomoo::i64_t nErrCode, const char* strDesc) {
cout << "connect" << endl;
// construct request message
Qot_GetCorporateActionsBuybacks::Request req;
Qot_GetCorporateActionsBuybacks::C2S *c2s = req.mutable_c2s();
Qot_Common::Security *sec = c2s->mutable_security();
sec->set_code("00700");
sec->set_market(Qot_Common::QotMarket::QotMarket_HK_Security);
m_pQotApi->GetCorporateActionsBuybacks(req);
cout << "GetCorporateActionsBuybacks" << endl;
}
virtual void OnReply_GetCorporateActionsBuybacks(moomoo::u32_t nSerialNo, const Qot_GetCorporateActionsBuybacks::Response &stRsp){
cout << "OnReply_GetCorporateActionsBuybacks:" << endl;
// print response
// ProtoBufToBodyData and UTF8ToLocal refer to tool.h in Samples
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
MMAPI_Qot *m_pQotApi;
};
int32_t main(int32_t argc, char** argv)
{
MMAPI::Init();
{
Program program;
program.Start();
getchar();
}
protobuf::ShutdownProtobufLibrary();
MMAPI::UnInit();
return 0;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
- Output
onInitConnect: ret=0 desc=Succeed!
Send Qot_GetCorporateActionsBuybacks seqNo=3
retType: 0
retMsg: ""
errCode: 0
s2c {
hkBuyBackList {
publDate: 1775664000
publDateStr: "2026-04-09"
endDate: 1775664000
endDateStr: "2026-04-09"
buyBackMoney: 1000880717.6
buyBackSum: 1964000
percentage: 0.021373
highPrice: 514.5
lowPrice: 503
cumulativeSum: 119812000
cumulativePercentage: 1.30386
shareType: "普通股"
}
hkBuyBackList {
//...
}
nextKey: "10"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
GetCorporateActionsBuybacks(req);
介绍
获取回购
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional string nextKey = 2; // 分页标识,首次不填,续拉时填上次返回的 nextKey;"-1" 表示无更多数据
optional int32 num = 3; // 每页返回数量,默认 10,范围 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- 股票结构参见 Security
- 返回
// 港股回购单条记录
message HKBuyBackItem
{
optional uint64 publDate = 1; // 公告日时间戳(秒)
optional string publDateStr = 2; // 公告日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 endDate = 3; // 回购截止日时间戳(秒)
optional string endDateStr = 4; // 回购截止日字符串,格式 YYYY-MM-DD,对应市场时区
optional double buyBackMoney = 5; // 回购金额
optional int64 buyBackSum = 6; // 回购股数(股)
optional double percentage = 7; // 占已发行股份百分比,百分号前的值,如 12.34 表示 12.34%
optional double highPrice = 8; // 最高回购价
optional double lowPrice = 9; // 最低回购价
optional int64 cumulativeSum = 10; // 本轮累计回购股数(股)
optional double cumulativePercentage = 11; // 本轮累计回购占总股本百分比,百分号前的值,如 12.34 表示 12.34%
optional string shareType = 12; // 股份类别
}
// A股回购单条记录
message ABuyBackItem
{
optional uint64 changeRegDate = 1; // 工商变更登记日时间戳(秒)
optional string changeRegDateStr = 2; // 工商变更登记日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 changeDate = 3; // 股份变动日时间戳(秒)
optional string changeDateStr = 4; // 股份变动日字符串,格式 YYYY-MM-DD,对应市场时区
optional string eventProceDesc = 5; // 事件进程描述
optional uint64 advanceDate = 6; // 预案公告日时间戳(秒)
optional string advanceDateStr = 7; // 预案公告日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 meetPassDate = 8; // 股东大会通过日时间戳(秒)
optional string meetPassDateStr = 9; // 股东大会通过日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 startDate = 10; // 回购开始日时间戳(秒)
optional string startDateStr = 11; // 回购开始日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 endDate = 12; // 回购截止日时间戳(秒)
optional string endDateStr = 13; // 回购截止日字符串,格式 YYYY-MM-DD,对应市场时区
optional uint64 payDate = 14; // 支付日时间戳(秒)
optional string payDateStr = 15; // 支付日字符串,格式 YYYY-MM-DD,对应市场时区
optional string seller = 16; // 出售方(股份被回购方)
optional string buyBackMode = 17; // 回购方式
optional string shareType = 18; // 股份类别
optional int64 buyBackSum = 19; // 回购股数(股)
optional double buyBackMoney = 20; // 回购金额
optional double percentage = 21; // 占已发行股份百分比,百分号前的值,如 12.34 表示 12.34%
optional double valueFloor = 22; // 拟回购资金总额下限
optional double valueCeiling = 23; // 拟回购资金总额上限
optional double priceFloor = 24; // 回购价格下限
optional double priceCeiling = 25; // 回购价格上限
optional double volumeFloor = 26; // 拟回购股数下限
optional double volumeCeiling = 27; // 拟回购股数上限
}
message S2C
{
repeated HKBuyBackItem hkBuyBackList = 1; // 港股回购列表
repeated ABuyBackItem aBuyBackList = 2; // A股回购列表
optional string nextKey = 3; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // 返回结果,详见 Common.RetType
optional string retMsg = 2; // 返回结果描述
optional int32 errCode = 3; // 错误码
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
- 接口调用结果,结构参见 RetType
- Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_Common } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetCorporateActionsBuybacks(){
const { RetType } = Common
const { QotMarket } = Qot_Common
let [addr, port, enable_ssl, key] = ["127.0.0.1", 33333, false, '7522027ccf5a06b1'];
let websocket = new mmWebsocket();
websocket.onlogin = (ret, msg)=>{
if (ret) {
const req = {
c2s: {
security: {
market: QotMarket.QotMarket_HK_Security,
code: "00700",
},
},
};
websocket.GetCorporateActionsBuybacks(req)
.then((res) => {
let { errCode, retMsg, retType,s2c } = res
console.log("GetCorporateActionsBuybacks: errCode %d, retMsg %s, retType %d", errCode, retMsg, retType);
if(retType == RetType.RetType_Succeed){
let data = beautify(JSON.stringify(s2c), {
indent_size: 2,
space_in_empty_paren: true,
});
console.log(data);
}
})
.catch((error) => {
console.log("error:", error);
});
} else {
console.log("error", msg);
}
};
websocket.start(addr, port, enable_ssl, key);
setTimeout(()=>{
websocket.stop();
console.log("stop");
}, 5000);
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
- Output
GetCorporateActionsBuybacks: errCode 0, retMsg , retType 0
{
"hkBuyBackList": [{
"publDate": "1775664000",
"publDateStr": "2026-04-09",
"endDate": "1775664000",
"endDateStr": "2026-04-09",
"buyBackMoney": 1000880717.6,
"buyBackSum": "1964000",
"percentage": 0.021373,
"highPrice": 514.5,
"lowPrice": 503,
"cumulativeSum": "119812000",
"cumulativePercentage": 1.30386,
"shareType": "普通股"
//...
}],
"nextKey": "10"
}
stop
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
接口限制
- 每 30 秒内最多请求 30 次。
- 支持港股、A股正股及基金。