# 獲取回購
- 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 Ordinary shares
1775577600 2026-04-08 1775577600 2026-04-08 1000761103.7 1979000 0.021537 510.0 501.0 117848000 1.28249 Ordinary shares
1775059200 2026-04-02 1775059200 2026-04-02 300715258.5 615000 0.006693 496.0 485.2 115869000 1.26095 Ordinary shares
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: "Ordinary shares"
}
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=7459212617758638869
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: "Ordinary shares"
}
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: "Ordinary shares"
}
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": "Ordinary shares"
//...
}],
"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 Ordinary shares
1775577600 2026-04-08 1775577600 2026-04-08 1000761103.7 1979000 0.021537 510.0 501.0 117848000 1.28249 Ordinary shares
1775059200 2026-04-02 1775059200 2026-04-02 300715258.5 615000 0.006693 496.0 485.2 115869000 1.26095 Ordinary shares
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: "Ordinary shares"
}
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=7459212617758638869
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: "Ordinary shares"
}
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: "Ordinary shares"
}
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": "Ordinary shares"
//...
}],
"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股正股及基金。