# Get Corporate Actions - Buybacks
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_corporate_actions_buybacks(code, next_key=None, num=None)
Description
Get buyback records for a stock (HK stocks / A-shares, supports pagination)
Parameters
Parameter Type Description code str Stock code e.g. HK.00700; supports HK stocks, A-share stocks and fundsnext_key str Pagination key Leave empty for the first request; pass the next_key returned from the previous request to continue; "-1" means no more datanum int Page size Number of records per page, default 10, range 1~50Return
Parameter Type Description ret RET_CODE API call result data dict When ret == RET_OK, returns buyback data dictionary str When ret != RET_OK, returns error description The returned dictionary contains the following fields:
Field Type Description next_key str Pagination key "-1" means no more data; pass this value as next_key in the next request to continuehk_buy_back_list pd.DataFrame HK buyback list See hk_buy_back_list field table for each item; empty for A-share stocksa_buy_back_list pd.DataFrame A-share buyback list See a_buy_back_list field table for each item; empty for HK stockshk_buy_back_list fields (HK buyback entry):
Field Type Description publ_date int Announcement date timestamp Unix timestamp (seconds), in the market's timezonepubl_date_str str Announcement date Format YYYY-MM-DD, in the market's timezoneend_date int Buyback end date timestamp Unix timestamp (seconds), in the market's timezoneend_date_str str Buyback end date Format YYYY-MM-DD, in the market's timezonebuy_back_money float Buyback amount buy_back_sum int Buyback shares Unit: sharespercentage float Percentage of issued shares Value before the percent sign, e.g. 12.34 means 12.34%high_price float Highest buyback price low_price float Lowest buyback price cumulative_sum int Cumulative buyback shares this round Unit: sharescumulative_percentage float Cumulative percentage of total shares this round Value before the percent sign, e.g. 12.34 means 12.34%share_type str Share type a_buy_back_list fields (A-share buyback entry):
Field Type Description change_reg_date int Business registration change date timestamp Unix timestamp (seconds), in the market's timezonechange_reg_date_str str Business registration change date Format YYYY-MM-DD, in the market's timezonechange_date int Share change date timestamp Unix timestamp (seconds), in the market's timezonechange_date_str str Share change date Format YYYY-MM-DD, in the market's timezoneevent_proce_desc str Event process description advance_date int Proposal announcement date timestamp Unix timestamp (seconds), in the market's timezoneadvance_date_str str Proposal announcement date Format YYYY-MM-DD, in the market's timezonemeet_pass_date int Shareholder meeting approval date timestamp Unix timestamp (seconds), in the market's timezonemeet_pass_date_str str Shareholder meeting approval date Format YYYY-MM-DD, in the market's timezonestart_date int Buyback start date timestamp Unix timestamp (seconds), in the market's timezonestart_date_str str Buyback start date Format YYYY-MM-DD, in the market's timezoneend_date int Buyback end date timestamp Unix timestamp (seconds), in the market's timezoneend_date_str str Buyback end date Format YYYY-MM-DD, in the market's timezonepay_date int Payment date timestamp Unix timestamp (seconds), in the market's timezonepay_date_str str Payment date Format YYYY-MM-DD, in the market's timezoneseller str Seller The party whose shares are being bought backbuy_back_mode str Buyback method share_type str Share type buy_back_sum int Buyback shares Unit: sharesbuy_back_money float Buyback amount percentage float Percentage of issued shares Value before the percent sign, e.g. 12.34 means 12.34%value_floor float Minimum planned buyback amount value_ceiling float Maximum planned buyback amount price_floor float Minimum buyback price price_ceiling float Maximum buyback price volume_floor float Minimum planned buyback shares volume_ceiling float Maximum planned buyback shares
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
Description
Get buybacks
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional string nextKey = 2; // Pagination key; leave empty for first request; pass the nextKey from the last response to continue; "-1" means no more data
optional int32 num = 3; // Number of records per page, default 10, range 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security structure, see Security
- Return
// Single HK buyback record
message HKBuyBackItem
{
optional uint64 publDate = 1; // Announcement date timestamp (seconds)
optional string publDateStr = 2; // Announcement date string, format YYYY-MM-DD, in the market's timezone
optional uint64 endDate = 3; // Buyback end date timestamp (seconds)
optional string endDateStr = 4; // Buyback end date string, format YYYY-MM-DD, in the market's timezone
optional double buyBackMoney = 5; // Buyback amount
optional int64 buyBackSum = 6; // Buyback shares (shares)
optional double percentage = 7; // Percentage of issued shares; value before percent sign, e.g. 12.34 means 12.34%
optional double highPrice = 8; // Highest buyback price
optional double lowPrice = 9; // Lowest buyback price
optional int64 cumulativeSum = 10; // Cumulative buyback shares this round (shares)
optional double cumulativePercentage = 11; // Cumulative buyback as percentage of total shares this round; value before percent sign, e.g. 12.34 means 12.34%
optional string shareType = 12; // Share type
}
// Single A-share buyback record
message ABuyBackItem
{
optional uint64 changeRegDate = 1; // Business registration change date timestamp (seconds)
optional string changeRegDateStr = 2; // Business registration change date string, format YYYY-MM-DD, in the market's timezone
optional uint64 changeDate = 3; // Share change date timestamp (seconds)
optional string changeDateStr = 4; // Share change date string, format YYYY-MM-DD, in the market's timezone
optional string eventProceDesc = 5; // Event process description
optional uint64 advanceDate = 6; // Proposal announcement date timestamp (seconds)
optional string advanceDateStr = 7; // Proposal announcement date string, format YYYY-MM-DD, in the market's timezone
optional uint64 meetPassDate = 8; // Shareholder meeting approval date timestamp (seconds)
optional string meetPassDateStr = 9; // Shareholder meeting approval date string, format YYYY-MM-DD, in the market's timezone
optional uint64 startDate = 10; // Buyback start date timestamp (seconds)
optional string startDateStr = 11; // Buyback start date string, format YYYY-MM-DD, in the market's timezone
optional uint64 endDate = 12; // Buyback end date timestamp (seconds)
optional string endDateStr = 13; // Buyback end date string, format YYYY-MM-DD, in the market's timezone
optional uint64 payDate = 14; // Payment date timestamp (seconds)
optional string payDateStr = 15; // Payment date string, format YYYY-MM-DD, in the market's timezone
optional string seller = 16; // Seller (the party whose shares are bought back)
optional string buyBackMode = 17; // Buyback method
optional string shareType = 18; // Share type
optional int64 buyBackSum = 19; // Buyback shares (shares)
optional double buyBackMoney = 20; // Buyback amount
optional double percentage = 21; // Percentage of issued shares; value before percent sign, e.g. 12.34 means 12.34%
optional double valueFloor = 22; // Minimum planned buyback amount
optional double valueCeiling = 23; // Maximum planned buyback amount
optional double priceFloor = 24; // Minimum buyback price
optional double priceCeiling = 25; // Maximum buyback price
optional double volumeFloor = 26; // Minimum planned buyback shares
optional double volumeCeiling = 27; // Maximum planned buyback shares
}
message S2C
{
repeated HKBuyBackItem hkBuyBackList = 1; // HK buyback list
repeated ABuyBackItem aBuyBackList = 2; // A-share buyback list
optional string nextKey = 3; // Pagination key; "-1" means no more data
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return result description
optional int32 errCode = 3; // Error code
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
- API call result, see RetType
Protocol ID
3235
uint GetCorporateActionsBuybacks(QotGetCorporateActionsBuybacks.Request req);
virtual void OnReply_GetCorporateActionsBuybacks(FTAPI_Conn client, uint nSerialNo, QotGetCorporateActionsBuybacks.Response rsp);
Description
Get buybacks
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional string nextKey = 2; // Pagination key; leave empty for first request; pass the nextKey from the last response to continue; "-1" means no more data
optional int32 num = 3; // Number of records per page, default 10, range 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security structure, see Security
- Return
// Single HK buyback record
message HKBuyBackItem
{
optional uint64 publDate = 1; // Announcement date timestamp (seconds)
optional string publDateStr = 2; // Announcement date string, format YYYY-MM-DD, in the market's timezone
optional uint64 endDate = 3; // Buyback end date timestamp (seconds)
optional string endDateStr = 4; // Buyback end date string, format YYYY-MM-DD, in the market's timezone
optional double buyBackMoney = 5; // Buyback amount
optional int64 buyBackSum = 6; // Buyback shares (shares)
optional double percentage = 7; // Percentage of issued shares; value before percent sign, e.g. 12.34 means 12.34%
optional double highPrice = 8; // Highest buyback price
optional double lowPrice = 9; // Lowest buyback price
optional int64 cumulativeSum = 10; // Cumulative buyback shares this round (shares)
optional double cumulativePercentage = 11; // Cumulative buyback as percentage of total shares this round; value before percent sign, e.g. 12.34 means 12.34%
optional string shareType = 12; // Share type
}
// Single A-share buyback record
message ABuyBackItem
{
optional uint64 changeRegDate = 1; // Business registration change date timestamp (seconds)
optional string changeRegDateStr = 2; // Business registration change date string, format YYYY-MM-DD, in the market's timezone
optional uint64 changeDate = 3; // Share change date timestamp (seconds)
optional string changeDateStr = 4; // Share change date string, format YYYY-MM-DD, in the market's timezone
optional string eventProceDesc = 5; // Event process description
optional uint64 advanceDate = 6; // Proposal announcement date timestamp (seconds)
optional string advanceDateStr = 7; // Proposal announcement date string, format YYYY-MM-DD, in the market's timezone
optional uint64 meetPassDate = 8; // Shareholder meeting approval date timestamp (seconds)
optional string meetPassDateStr = 9; // Shareholder meeting approval date string, format YYYY-MM-DD, in the market's timezone
optional uint64 startDate = 10; // Buyback start date timestamp (seconds)
optional string startDateStr = 11; // Buyback start date string, format YYYY-MM-DD, in the market's timezone
optional uint64 endDate = 12; // Buyback end date timestamp (seconds)
optional string endDateStr = 13; // Buyback end date string, format YYYY-MM-DD, in the market's timezone
optional uint64 payDate = 14; // Payment date timestamp (seconds)
optional string payDateStr = 15; // Payment date string, format YYYY-MM-DD, in the market's timezone
optional string seller = 16; // Seller (the party whose shares are bought back)
optional string buyBackMode = 17; // Buyback method
optional string shareType = 18; // Share type
optional int64 buyBackSum = 19; // Buyback shares (shares)
optional double buyBackMoney = 20; // Buyback amount
optional double percentage = 21; // Percentage of issued shares; value before percent sign, e.g. 12.34 means 12.34%
optional double valueFloor = 22; // Minimum planned buyback amount
optional double valueCeiling = 23; // Maximum planned buyback amount
optional double priceFloor = 24; // Minimum buyback price
optional double priceCeiling = 25; // Maximum buyback price
optional double volumeFloor = 26; // Minimum planned buyback shares
optional double volumeCeiling = 27; // Maximum planned buyback shares
}
message S2C
{
repeated HKBuyBackItem hkBuyBackList = 1; // HK buyback list
repeated ABuyBackItem aBuyBackList = 2; // A-share buyback list
optional string nextKey = 3; // Pagination key; "-1" means no more data
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return result description
optional int32 errCode = 3; // Error code
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
- API call result, see 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);
Description
Get buybacks
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional string nextKey = 2; // Pagination key; leave empty for first request; pass the nextKey from the last response to continue; "-1" means no more data
optional int32 num = 3; // Number of records per page, default 10, range 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security structure, see Security
- Return
// Single HK buyback record
message HKBuyBackItem
{
optional uint64 publDate = 1; // Announcement date timestamp (seconds)
optional string publDateStr = 2; // Announcement date string, format YYYY-MM-DD, in the market's timezone
optional uint64 endDate = 3; // Buyback end date timestamp (seconds)
optional string endDateStr = 4; // Buyback end date string, format YYYY-MM-DD, in the market's timezone
optional double buyBackMoney = 5; // Buyback amount
optional int64 buyBackSum = 6; // Buyback shares (shares)
optional double percentage = 7; // Percentage of issued shares; value before percent sign, e.g. 12.34 means 12.34%
optional double highPrice = 8; // Highest buyback price
optional double lowPrice = 9; // Lowest buyback price
optional int64 cumulativeSum = 10; // Cumulative buyback shares this round (shares)
optional double cumulativePercentage = 11; // Cumulative buyback as percentage of total shares this round; value before percent sign, e.g. 12.34 means 12.34%
optional string shareType = 12; // Share type
}
// Single A-share buyback record
message ABuyBackItem
{
optional uint64 changeRegDate = 1; // Business registration change date timestamp (seconds)
optional string changeRegDateStr = 2; // Business registration change date string, format YYYY-MM-DD, in the market's timezone
optional uint64 changeDate = 3; // Share change date timestamp (seconds)
optional string changeDateStr = 4; // Share change date string, format YYYY-MM-DD, in the market's timezone
optional string eventProceDesc = 5; // Event process description
optional uint64 advanceDate = 6; // Proposal announcement date timestamp (seconds)
optional string advanceDateStr = 7; // Proposal announcement date string, format YYYY-MM-DD, in the market's timezone
optional uint64 meetPassDate = 8; // Shareholder meeting approval date timestamp (seconds)
optional string meetPassDateStr = 9; // Shareholder meeting approval date string, format YYYY-MM-DD, in the market's timezone
optional uint64 startDate = 10; // Buyback start date timestamp (seconds)
optional string startDateStr = 11; // Buyback start date string, format YYYY-MM-DD, in the market's timezone
optional uint64 endDate = 12; // Buyback end date timestamp (seconds)
optional string endDateStr = 13; // Buyback end date string, format YYYY-MM-DD, in the market's timezone
optional uint64 payDate = 14; // Payment date timestamp (seconds)
optional string payDateStr = 15; // Payment date string, format YYYY-MM-DD, in the market's timezone
optional string seller = 16; // Seller (the party whose shares are bought back)
optional string buyBackMode = 17; // Buyback method
optional string shareType = 18; // Share type
optional int64 buyBackSum = 19; // Buyback shares (shares)
optional double buyBackMoney = 20; // Buyback amount
optional double percentage = 21; // Percentage of issued shares; value before percent sign, e.g. 12.34 means 12.34%
optional double valueFloor = 22; // Minimum planned buyback amount
optional double valueCeiling = 23; // Maximum planned buyback amount
optional double priceFloor = 24; // Minimum buyback price
optional double priceCeiling = 25; // Maximum buyback price
optional double volumeFloor = 26; // Minimum planned buyback shares
optional double volumeCeiling = 27; // Maximum planned buyback shares
}
message S2C
{
repeated HKBuyBackItem hkBuyBackList = 1; // HK buyback list
repeated ABuyBackItem aBuyBackList = 2; // A-share buyback list
optional string nextKey = 3; // Pagination key; "-1" means no more data
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return result description
optional int32 errCode = 3; // Error code
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
- API call result, see 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;
Description
Get buybacks
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional string nextKey = 2; // Pagination key; leave empty for first request; pass the nextKey from the last response to continue; "-1" means no more data
optional int32 num = 3; // Number of records per page, default 10, range 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security structure, see Security
- Return
// Single HK buyback record
message HKBuyBackItem
{
optional uint64 publDate = 1; // Announcement date timestamp (seconds)
optional string publDateStr = 2; // Announcement date string, format YYYY-MM-DD, in the market's timezone
optional uint64 endDate = 3; // Buyback end date timestamp (seconds)
optional string endDateStr = 4; // Buyback end date string, format YYYY-MM-DD, in the market's timezone
optional double buyBackMoney = 5; // Buyback amount
optional int64 buyBackSum = 6; // Buyback shares (shares)
optional double percentage = 7; // Percentage of issued shares; value before percent sign, e.g. 12.34 means 12.34%
optional double highPrice = 8; // Highest buyback price
optional double lowPrice = 9; // Lowest buyback price
optional int64 cumulativeSum = 10; // Cumulative buyback shares this round (shares)
optional double cumulativePercentage = 11; // Cumulative buyback as percentage of total shares this round; value before percent sign, e.g. 12.34 means 12.34%
optional string shareType = 12; // Share type
}
// Single A-share buyback record
message ABuyBackItem
{
optional uint64 changeRegDate = 1; // Business registration change date timestamp (seconds)
optional string changeRegDateStr = 2; // Business registration change date string, format YYYY-MM-DD, in the market's timezone
optional uint64 changeDate = 3; // Share change date timestamp (seconds)
optional string changeDateStr = 4; // Share change date string, format YYYY-MM-DD, in the market's timezone
optional string eventProceDesc = 5; // Event process description
optional uint64 advanceDate = 6; // Proposal announcement date timestamp (seconds)
optional string advanceDateStr = 7; // Proposal announcement date string, format YYYY-MM-DD, in the market's timezone
optional uint64 meetPassDate = 8; // Shareholder meeting approval date timestamp (seconds)
optional string meetPassDateStr = 9; // Shareholder meeting approval date string, format YYYY-MM-DD, in the market's timezone
optional uint64 startDate = 10; // Buyback start date timestamp (seconds)
optional string startDateStr = 11; // Buyback start date string, format YYYY-MM-DD, in the market's timezone
optional uint64 endDate = 12; // Buyback end date timestamp (seconds)
optional string endDateStr = 13; // Buyback end date string, format YYYY-MM-DD, in the market's timezone
optional uint64 payDate = 14; // Payment date timestamp (seconds)
optional string payDateStr = 15; // Payment date string, format YYYY-MM-DD, in the market's timezone
optional string seller = 16; // Seller (the party whose shares are bought back)
optional string buyBackMode = 17; // Buyback method
optional string shareType = 18; // Share type
optional int64 buyBackSum = 19; // Buyback shares (shares)
optional double buyBackMoney = 20; // Buyback amount
optional double percentage = 21; // Percentage of issued shares; value before percent sign, e.g. 12.34 means 12.34%
optional double valueFloor = 22; // Minimum planned buyback amount
optional double valueCeiling = 23; // Maximum planned buyback amount
optional double priceFloor = 24; // Minimum buyback price
optional double priceCeiling = 25; // Maximum buyback price
optional double volumeFloor = 26; // Minimum planned buyback shares
optional double volumeCeiling = 27; // Maximum planned buyback shares
}
message S2C
{
repeated HKBuyBackItem hkBuyBackList = 1; // HK buyback list
repeated ABuyBackItem aBuyBackList = 2; // A-share buyback list
optional string nextKey = 3; // Pagination key; "-1" means no more data
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return result description
optional int32 errCode = 3; // Error code
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
- API call result, see 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);
Description
Get buybacks
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional string nextKey = 2; // Pagination key; leave empty for first request; pass the nextKey from the last response to continue; "-1" means no more data
optional int32 num = 3; // Number of records per page, default 10, range 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security structure, see Security
- Return
// Single HK buyback record
message HKBuyBackItem
{
optional uint64 publDate = 1; // Announcement date timestamp (seconds)
optional string publDateStr = 2; // Announcement date string, format YYYY-MM-DD, in the market's timezone
optional uint64 endDate = 3; // Buyback end date timestamp (seconds)
optional string endDateStr = 4; // Buyback end date string, format YYYY-MM-DD, in the market's timezone
optional double buyBackMoney = 5; // Buyback amount
optional int64 buyBackSum = 6; // Buyback shares (shares)
optional double percentage = 7; // Percentage of issued shares; value before percent sign, e.g. 12.34 means 12.34%
optional double highPrice = 8; // Highest buyback price
optional double lowPrice = 9; // Lowest buyback price
optional int64 cumulativeSum = 10; // Cumulative buyback shares this round (shares)
optional double cumulativePercentage = 11; // Cumulative buyback as percentage of total shares this round; value before percent sign, e.g. 12.34 means 12.34%
optional string shareType = 12; // Share type
}
// Single A-share buyback record
message ABuyBackItem
{
optional uint64 changeRegDate = 1; // Business registration change date timestamp (seconds)
optional string changeRegDateStr = 2; // Business registration change date string, format YYYY-MM-DD, in the market's timezone
optional uint64 changeDate = 3; // Share change date timestamp (seconds)
optional string changeDateStr = 4; // Share change date string, format YYYY-MM-DD, in the market's timezone
optional string eventProceDesc = 5; // Event process description
optional uint64 advanceDate = 6; // Proposal announcement date timestamp (seconds)
optional string advanceDateStr = 7; // Proposal announcement date string, format YYYY-MM-DD, in the market's timezone
optional uint64 meetPassDate = 8; // Shareholder meeting approval date timestamp (seconds)
optional string meetPassDateStr = 9; // Shareholder meeting approval date string, format YYYY-MM-DD, in the market's timezone
optional uint64 startDate = 10; // Buyback start date timestamp (seconds)
optional string startDateStr = 11; // Buyback start date string, format YYYY-MM-DD, in the market's timezone
optional uint64 endDate = 12; // Buyback end date timestamp (seconds)
optional string endDateStr = 13; // Buyback end date string, format YYYY-MM-DD, in the market's timezone
optional uint64 payDate = 14; // Payment date timestamp (seconds)
optional string payDateStr = 15; // Payment date string, format YYYY-MM-DD, in the market's timezone
optional string seller = 16; // Seller (the party whose shares are bought back)
optional string buyBackMode = 17; // Buyback method
optional string shareType = 18; // Share type
optional int64 buyBackSum = 19; // Buyback shares (shares)
optional double buyBackMoney = 20; // Buyback amount
optional double percentage = 21; // Percentage of issued shares; value before percent sign, e.g. 12.34 means 12.34%
optional double valueFloor = 22; // Minimum planned buyback amount
optional double valueCeiling = 23; // Maximum planned buyback amount
optional double priceFloor = 24; // Minimum buyback price
optional double priceCeiling = 25; // Maximum buyback price
optional double volumeFloor = 26; // Minimum planned buyback shares
optional double volumeCeiling = 27; // Maximum planned buyback shares
}
message S2C
{
repeated HKBuyBackItem hkBuyBackList = 1; // HK buyback list
repeated ABuyBackItem aBuyBackList = 2; // A-share buyback list
optional string nextKey = 3; // Pagination key; "-1" means no more data
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return result description
optional int32 errCode = 3; // Error code
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
- API call result, see 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
API Restrictions
- Maximum 30 requests per 30 seconds.
- Supports HK stocks, A-share stocks and funds.
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_corporate_actions_buybacks(code, next_key=None, num=None)
Description
Get buyback records for a stock (HK stocks / A-shares, supports pagination)
Parameters
Parameter Type Description code str Stock code e.g. HK.00700; supports HK stocks, A-share stocks and fundsnext_key str Pagination key Leave empty for the first request; pass the next_key returned from the previous request to continue; "-1" means no more datanum int Page size Number of records per page, default 10, range 1~50Return
Parameter Type Description ret RET_CODE API call result data dict When ret == RET_OK, returns buyback data dictionary str When ret != RET_OK, returns error description The returned dictionary contains the following fields:
Field Type Description next_key str Pagination key "-1" means no more data; pass this value as next_key in the next request to continuehk_buy_back_list pd.DataFrame HK buyback list See hk_buy_back_list field table for each item; empty for A-share stocksa_buy_back_list pd.DataFrame A-share buyback list See a_buy_back_list field table for each item; empty for HK stockshk_buy_back_list fields (HK buyback entry):
Field Type Description publ_date int Announcement date timestamp Unix timestamp (seconds), in the market's timezonepubl_date_str str Announcement date Format YYYY-MM-DD, in the market's timezoneend_date int Buyback end date timestamp Unix timestamp (seconds), in the market's timezoneend_date_str str Buyback end date Format YYYY-MM-DD, in the market's timezonebuy_back_money float Buyback amount buy_back_sum int Buyback shares Unit: sharespercentage float Percentage of issued shares Value before the percent sign, e.g. 12.34 means 12.34%high_price float Highest buyback price low_price float Lowest buyback price cumulative_sum int Cumulative buyback shares this round Unit: sharescumulative_percentage float Cumulative percentage of total shares this round Value before the percent sign, e.g. 12.34 means 12.34%share_type str Share type a_buy_back_list fields (A-share buyback entry):
Field Type Description change_reg_date int Business registration change date timestamp Unix timestamp (seconds), in the market's timezonechange_reg_date_str str Business registration change date Format YYYY-MM-DD, in the market's timezonechange_date int Share change date timestamp Unix timestamp (seconds), in the market's timezonechange_date_str str Share change date Format YYYY-MM-DD, in the market's timezoneevent_proce_desc str Event process description advance_date int Proposal announcement date timestamp Unix timestamp (seconds), in the market's timezoneadvance_date_str str Proposal announcement date Format YYYY-MM-DD, in the market's timezonemeet_pass_date int Shareholder meeting approval date timestamp Unix timestamp (seconds), in the market's timezonemeet_pass_date_str str Shareholder meeting approval date Format YYYY-MM-DD, in the market's timezonestart_date int Buyback start date timestamp Unix timestamp (seconds), in the market's timezonestart_date_str str Buyback start date Format YYYY-MM-DD, in the market's timezoneend_date int Buyback end date timestamp Unix timestamp (seconds), in the market's timezoneend_date_str str Buyback end date Format YYYY-MM-DD, in the market's timezonepay_date int Payment date timestamp Unix timestamp (seconds), in the market's timezonepay_date_str str Payment date Format YYYY-MM-DD, in the market's timezoneseller str Seller The party whose shares are being bought backbuy_back_mode str Buyback method share_type str Share type buy_back_sum int Buyback shares Unit: sharesbuy_back_money float Buyback amount percentage float Percentage of issued shares Value before the percent sign, e.g. 12.34 means 12.34%value_floor float Minimum planned buyback amount value_ceiling float Maximum planned buyback amount price_floor float Minimum buyback price price_ceiling float Maximum buyback price volume_floor float Minimum planned buyback shares volume_ceiling float Maximum planned buyback shares
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
Description
Get buybacks
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional string nextKey = 2; // Pagination key; leave empty for first request; pass the nextKey from the last response to continue; "-1" means no more data
optional int32 num = 3; // Number of records per page, default 10, range 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security structure, see Security
- Return
// Single HK buyback record
message HKBuyBackItem
{
optional uint64 publDate = 1; // Announcement date timestamp (seconds)
optional string publDateStr = 2; // Announcement date string, format YYYY-MM-DD, in the market's timezone
optional uint64 endDate = 3; // Buyback end date timestamp (seconds)
optional string endDateStr = 4; // Buyback end date string, format YYYY-MM-DD, in the market's timezone
optional double buyBackMoney = 5; // Buyback amount
optional int64 buyBackSum = 6; // Buyback shares (shares)
optional double percentage = 7; // Percentage of issued shares; value before percent sign, e.g. 12.34 means 12.34%
optional double highPrice = 8; // Highest buyback price
optional double lowPrice = 9; // Lowest buyback price
optional int64 cumulativeSum = 10; // Cumulative buyback shares this round (shares)
optional double cumulativePercentage = 11; // Cumulative buyback as percentage of total shares this round; value before percent sign, e.g. 12.34 means 12.34%
optional string shareType = 12; // Share type
}
// Single A-share buyback record
message ABuyBackItem
{
optional uint64 changeRegDate = 1; // Business registration change date timestamp (seconds)
optional string changeRegDateStr = 2; // Business registration change date string, format YYYY-MM-DD, in the market's timezone
optional uint64 changeDate = 3; // Share change date timestamp (seconds)
optional string changeDateStr = 4; // Share change date string, format YYYY-MM-DD, in the market's timezone
optional string eventProceDesc = 5; // Event process description
optional uint64 advanceDate = 6; // Proposal announcement date timestamp (seconds)
optional string advanceDateStr = 7; // Proposal announcement date string, format YYYY-MM-DD, in the market's timezone
optional uint64 meetPassDate = 8; // Shareholder meeting approval date timestamp (seconds)
optional string meetPassDateStr = 9; // Shareholder meeting approval date string, format YYYY-MM-DD, in the market's timezone
optional uint64 startDate = 10; // Buyback start date timestamp (seconds)
optional string startDateStr = 11; // Buyback start date string, format YYYY-MM-DD, in the market's timezone
optional uint64 endDate = 12; // Buyback end date timestamp (seconds)
optional string endDateStr = 13; // Buyback end date string, format YYYY-MM-DD, in the market's timezone
optional uint64 payDate = 14; // Payment date timestamp (seconds)
optional string payDateStr = 15; // Payment date string, format YYYY-MM-DD, in the market's timezone
optional string seller = 16; // Seller (the party whose shares are bought back)
optional string buyBackMode = 17; // Buyback method
optional string shareType = 18; // Share type
optional int64 buyBackSum = 19; // Buyback shares (shares)
optional double buyBackMoney = 20; // Buyback amount
optional double percentage = 21; // Percentage of issued shares; value before percent sign, e.g. 12.34 means 12.34%
optional double valueFloor = 22; // Minimum planned buyback amount
optional double valueCeiling = 23; // Maximum planned buyback amount
optional double priceFloor = 24; // Minimum buyback price
optional double priceCeiling = 25; // Maximum buyback price
optional double volumeFloor = 26; // Minimum planned buyback shares
optional double volumeCeiling = 27; // Maximum planned buyback shares
}
message S2C
{
repeated HKBuyBackItem hkBuyBackList = 1; // HK buyback list
repeated ABuyBackItem aBuyBackList = 2; // A-share buyback list
optional string nextKey = 3; // Pagination key; "-1" means no more data
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return result description
optional int32 errCode = 3; // Error code
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
- API call result, see RetType
Protocol ID
3235
uint GetCorporateActionsBuybacks(QotGetCorporateActionsBuybacks.Request req);
virtual void OnReply_GetCorporateActionsBuybacks(MMAPI_Conn client, uint nSerialNo, QotGetCorporateActionsBuybacks.Response rsp);
Description
Get buybacks
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional string nextKey = 2; // Pagination key; leave empty for first request; pass the nextKey from the last response to continue; "-1" means no more data
optional int32 num = 3; // Number of records per page, default 10, range 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security structure, see Security
- Return
// Single HK buyback record
message HKBuyBackItem
{
optional uint64 publDate = 1; // Announcement date timestamp (seconds)
optional string publDateStr = 2; // Announcement date string, format YYYY-MM-DD, in the market's timezone
optional uint64 endDate = 3; // Buyback end date timestamp (seconds)
optional string endDateStr = 4; // Buyback end date string, format YYYY-MM-DD, in the market's timezone
optional double buyBackMoney = 5; // Buyback amount
optional int64 buyBackSum = 6; // Buyback shares (shares)
optional double percentage = 7; // Percentage of issued shares; value before percent sign, e.g. 12.34 means 12.34%
optional double highPrice = 8; // Highest buyback price
optional double lowPrice = 9; // Lowest buyback price
optional int64 cumulativeSum = 10; // Cumulative buyback shares this round (shares)
optional double cumulativePercentage = 11; // Cumulative buyback as percentage of total shares this round; value before percent sign, e.g. 12.34 means 12.34%
optional string shareType = 12; // Share type
}
// Single A-share buyback record
message ABuyBackItem
{
optional uint64 changeRegDate = 1; // Business registration change date timestamp (seconds)
optional string changeRegDateStr = 2; // Business registration change date string, format YYYY-MM-DD, in the market's timezone
optional uint64 changeDate = 3; // Share change date timestamp (seconds)
optional string changeDateStr = 4; // Share change date string, format YYYY-MM-DD, in the market's timezone
optional string eventProceDesc = 5; // Event process description
optional uint64 advanceDate = 6; // Proposal announcement date timestamp (seconds)
optional string advanceDateStr = 7; // Proposal announcement date string, format YYYY-MM-DD, in the market's timezone
optional uint64 meetPassDate = 8; // Shareholder meeting approval date timestamp (seconds)
optional string meetPassDateStr = 9; // Shareholder meeting approval date string, format YYYY-MM-DD, in the market's timezone
optional uint64 startDate = 10; // Buyback start date timestamp (seconds)
optional string startDateStr = 11; // Buyback start date string, format YYYY-MM-DD, in the market's timezone
optional uint64 endDate = 12; // Buyback end date timestamp (seconds)
optional string endDateStr = 13; // Buyback end date string, format YYYY-MM-DD, in the market's timezone
optional uint64 payDate = 14; // Payment date timestamp (seconds)
optional string payDateStr = 15; // Payment date string, format YYYY-MM-DD, in the market's timezone
optional string seller = 16; // Seller (the party whose shares are bought back)
optional string buyBackMode = 17; // Buyback method
optional string shareType = 18; // Share type
optional int64 buyBackSum = 19; // Buyback shares (shares)
optional double buyBackMoney = 20; // Buyback amount
optional double percentage = 21; // Percentage of issued shares; value before percent sign, e.g. 12.34 means 12.34%
optional double valueFloor = 22; // Minimum planned buyback amount
optional double valueCeiling = 23; // Maximum planned buyback amount
optional double priceFloor = 24; // Minimum buyback price
optional double priceCeiling = 25; // Maximum buyback price
optional double volumeFloor = 26; // Minimum planned buyback shares
optional double volumeCeiling = 27; // Maximum planned buyback shares
}
message S2C
{
repeated HKBuyBackItem hkBuyBackList = 1; // HK buyback list
repeated ABuyBackItem aBuyBackList = 2; // A-share buyback list
optional string nextKey = 3; // Pagination key; "-1" means no more data
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return result description
optional int32 errCode = 3; // Error code
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
- API call result, see 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);
Description
Get buybacks
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional string nextKey = 2; // Pagination key; leave empty for first request; pass the nextKey from the last response to continue; "-1" means no more data
optional int32 num = 3; // Number of records per page, default 10, range 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security structure, see Security
- Return
// Single HK buyback record
message HKBuyBackItem
{
optional uint64 publDate = 1; // Announcement date timestamp (seconds)
optional string publDateStr = 2; // Announcement date string, format YYYY-MM-DD, in the market's timezone
optional uint64 endDate = 3; // Buyback end date timestamp (seconds)
optional string endDateStr = 4; // Buyback end date string, format YYYY-MM-DD, in the market's timezone
optional double buyBackMoney = 5; // Buyback amount
optional int64 buyBackSum = 6; // Buyback shares (shares)
optional double percentage = 7; // Percentage of issued shares; value before percent sign, e.g. 12.34 means 12.34%
optional double highPrice = 8; // Highest buyback price
optional double lowPrice = 9; // Lowest buyback price
optional int64 cumulativeSum = 10; // Cumulative buyback shares this round (shares)
optional double cumulativePercentage = 11; // Cumulative buyback as percentage of total shares this round; value before percent sign, e.g. 12.34 means 12.34%
optional string shareType = 12; // Share type
}
// Single A-share buyback record
message ABuyBackItem
{
optional uint64 changeRegDate = 1; // Business registration change date timestamp (seconds)
optional string changeRegDateStr = 2; // Business registration change date string, format YYYY-MM-DD, in the market's timezone
optional uint64 changeDate = 3; // Share change date timestamp (seconds)
optional string changeDateStr = 4; // Share change date string, format YYYY-MM-DD, in the market's timezone
optional string eventProceDesc = 5; // Event process description
optional uint64 advanceDate = 6; // Proposal announcement date timestamp (seconds)
optional string advanceDateStr = 7; // Proposal announcement date string, format YYYY-MM-DD, in the market's timezone
optional uint64 meetPassDate = 8; // Shareholder meeting approval date timestamp (seconds)
optional string meetPassDateStr = 9; // Shareholder meeting approval date string, format YYYY-MM-DD, in the market's timezone
optional uint64 startDate = 10; // Buyback start date timestamp (seconds)
optional string startDateStr = 11; // Buyback start date string, format YYYY-MM-DD, in the market's timezone
optional uint64 endDate = 12; // Buyback end date timestamp (seconds)
optional string endDateStr = 13; // Buyback end date string, format YYYY-MM-DD, in the market's timezone
optional uint64 payDate = 14; // Payment date timestamp (seconds)
optional string payDateStr = 15; // Payment date string, format YYYY-MM-DD, in the market's timezone
optional string seller = 16; // Seller (the party whose shares are bought back)
optional string buyBackMode = 17; // Buyback method
optional string shareType = 18; // Share type
optional int64 buyBackSum = 19; // Buyback shares (shares)
optional double buyBackMoney = 20; // Buyback amount
optional double percentage = 21; // Percentage of issued shares; value before percent sign, e.g. 12.34 means 12.34%
optional double valueFloor = 22; // Minimum planned buyback amount
optional double valueCeiling = 23; // Maximum planned buyback amount
optional double priceFloor = 24; // Minimum buyback price
optional double priceCeiling = 25; // Maximum buyback price
optional double volumeFloor = 26; // Minimum planned buyback shares
optional double volumeCeiling = 27; // Maximum planned buyback shares
}
message S2C
{
repeated HKBuyBackItem hkBuyBackList = 1; // HK buyback list
repeated ABuyBackItem aBuyBackList = 2; // A-share buyback list
optional string nextKey = 3; // Pagination key; "-1" means no more data
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return result description
optional int32 errCode = 3; // Error code
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
- API call result, see 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;
Description
Get buybacks
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional string nextKey = 2; // Pagination key; leave empty for first request; pass the nextKey from the last response to continue; "-1" means no more data
optional int32 num = 3; // Number of records per page, default 10, range 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security structure, see Security
- Return
// Single HK buyback record
message HKBuyBackItem
{
optional uint64 publDate = 1; // Announcement date timestamp (seconds)
optional string publDateStr = 2; // Announcement date string, format YYYY-MM-DD, in the market's timezone
optional uint64 endDate = 3; // Buyback end date timestamp (seconds)
optional string endDateStr = 4; // Buyback end date string, format YYYY-MM-DD, in the market's timezone
optional double buyBackMoney = 5; // Buyback amount
optional int64 buyBackSum = 6; // Buyback shares (shares)
optional double percentage = 7; // Percentage of issued shares; value before percent sign, e.g. 12.34 means 12.34%
optional double highPrice = 8; // Highest buyback price
optional double lowPrice = 9; // Lowest buyback price
optional int64 cumulativeSum = 10; // Cumulative buyback shares this round (shares)
optional double cumulativePercentage = 11; // Cumulative buyback as percentage of total shares this round; value before percent sign, e.g. 12.34 means 12.34%
optional string shareType = 12; // Share type
}
// Single A-share buyback record
message ABuyBackItem
{
optional uint64 changeRegDate = 1; // Business registration change date timestamp (seconds)
optional string changeRegDateStr = 2; // Business registration change date string, format YYYY-MM-DD, in the market's timezone
optional uint64 changeDate = 3; // Share change date timestamp (seconds)
optional string changeDateStr = 4; // Share change date string, format YYYY-MM-DD, in the market's timezone
optional string eventProceDesc = 5; // Event process description
optional uint64 advanceDate = 6; // Proposal announcement date timestamp (seconds)
optional string advanceDateStr = 7; // Proposal announcement date string, format YYYY-MM-DD, in the market's timezone
optional uint64 meetPassDate = 8; // Shareholder meeting approval date timestamp (seconds)
optional string meetPassDateStr = 9; // Shareholder meeting approval date string, format YYYY-MM-DD, in the market's timezone
optional uint64 startDate = 10; // Buyback start date timestamp (seconds)
optional string startDateStr = 11; // Buyback start date string, format YYYY-MM-DD, in the market's timezone
optional uint64 endDate = 12; // Buyback end date timestamp (seconds)
optional string endDateStr = 13; // Buyback end date string, format YYYY-MM-DD, in the market's timezone
optional uint64 payDate = 14; // Payment date timestamp (seconds)
optional string payDateStr = 15; // Payment date string, format YYYY-MM-DD, in the market's timezone
optional string seller = 16; // Seller (the party whose shares are bought back)
optional string buyBackMode = 17; // Buyback method
optional string shareType = 18; // Share type
optional int64 buyBackSum = 19; // Buyback shares (shares)
optional double buyBackMoney = 20; // Buyback amount
optional double percentage = 21; // Percentage of issued shares; value before percent sign, e.g. 12.34 means 12.34%
optional double valueFloor = 22; // Minimum planned buyback amount
optional double valueCeiling = 23; // Maximum planned buyback amount
optional double priceFloor = 24; // Minimum buyback price
optional double priceCeiling = 25; // Maximum buyback price
optional double volumeFloor = 26; // Minimum planned buyback shares
optional double volumeCeiling = 27; // Maximum planned buyback shares
}
message S2C
{
repeated HKBuyBackItem hkBuyBackList = 1; // HK buyback list
repeated ABuyBackItem aBuyBackList = 2; // A-share buyback list
optional string nextKey = 3; // Pagination key; "-1" means no more data
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return result description
optional int32 errCode = 3; // Error code
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
- API call result, see 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);
Description
Get buybacks
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional string nextKey = 2; // Pagination key; leave empty for first request; pass the nextKey from the last response to continue; "-1" means no more data
optional int32 num = 3; // Number of records per page, default 10, range 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security structure, see Security
- Return
// Single HK buyback record
message HKBuyBackItem
{
optional uint64 publDate = 1; // Announcement date timestamp (seconds)
optional string publDateStr = 2; // Announcement date string, format YYYY-MM-DD, in the market's timezone
optional uint64 endDate = 3; // Buyback end date timestamp (seconds)
optional string endDateStr = 4; // Buyback end date string, format YYYY-MM-DD, in the market's timezone
optional double buyBackMoney = 5; // Buyback amount
optional int64 buyBackSum = 6; // Buyback shares (shares)
optional double percentage = 7; // Percentage of issued shares; value before percent sign, e.g. 12.34 means 12.34%
optional double highPrice = 8; // Highest buyback price
optional double lowPrice = 9; // Lowest buyback price
optional int64 cumulativeSum = 10; // Cumulative buyback shares this round (shares)
optional double cumulativePercentage = 11; // Cumulative buyback as percentage of total shares this round; value before percent sign, e.g. 12.34 means 12.34%
optional string shareType = 12; // Share type
}
// Single A-share buyback record
message ABuyBackItem
{
optional uint64 changeRegDate = 1; // Business registration change date timestamp (seconds)
optional string changeRegDateStr = 2; // Business registration change date string, format YYYY-MM-DD, in the market's timezone
optional uint64 changeDate = 3; // Share change date timestamp (seconds)
optional string changeDateStr = 4; // Share change date string, format YYYY-MM-DD, in the market's timezone
optional string eventProceDesc = 5; // Event process description
optional uint64 advanceDate = 6; // Proposal announcement date timestamp (seconds)
optional string advanceDateStr = 7; // Proposal announcement date string, format YYYY-MM-DD, in the market's timezone
optional uint64 meetPassDate = 8; // Shareholder meeting approval date timestamp (seconds)
optional string meetPassDateStr = 9; // Shareholder meeting approval date string, format YYYY-MM-DD, in the market's timezone
optional uint64 startDate = 10; // Buyback start date timestamp (seconds)
optional string startDateStr = 11; // Buyback start date string, format YYYY-MM-DD, in the market's timezone
optional uint64 endDate = 12; // Buyback end date timestamp (seconds)
optional string endDateStr = 13; // Buyback end date string, format YYYY-MM-DD, in the market's timezone
optional uint64 payDate = 14; // Payment date timestamp (seconds)
optional string payDateStr = 15; // Payment date string, format YYYY-MM-DD, in the market's timezone
optional string seller = 16; // Seller (the party whose shares are bought back)
optional string buyBackMode = 17; // Buyback method
optional string shareType = 18; // Share type
optional int64 buyBackSum = 19; // Buyback shares (shares)
optional double buyBackMoney = 20; // Buyback amount
optional double percentage = 21; // Percentage of issued shares; value before percent sign, e.g. 12.34 means 12.34%
optional double valueFloor = 22; // Minimum planned buyback amount
optional double valueCeiling = 23; // Maximum planned buyback amount
optional double priceFloor = 24; // Minimum buyback price
optional double priceCeiling = 25; // Maximum buyback price
optional double volumeFloor = 26; // Minimum planned buyback shares
optional double volumeCeiling = 27; // Maximum planned buyback shares
}
message S2C
{
repeated HKBuyBackItem hkBuyBackList = 1; // HK buyback list
repeated ABuyBackItem aBuyBackList = 2; // A-share buyback list
optional string nextKey = 3; // Pagination key; "-1" means no more data
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return result description
optional int32 errCode = 3; // Error code
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
- API call result, see 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
API Restrictions
- Maximum 30 requests per 30 seconds.
- Supports HK stocks, A-share stocks and funds.