# 自社株買い情報の取得
- 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 ページサイズ 1ページあたりの件数、デフォルト10、範囲1~50戻り値
パラメータ 型 説明 ret RET_CODE API呼び出し結果 data dict ret == RET_OK の場合、自社株買いデータの辞書を返します str ret != RET_OK の場合、エラーの説明を返します 返される辞書には以下のフィールドが含まれます:
フィールド 型 説明 next_key str ページングキー "-1" はデータなし;次のリクエストの next_key に渡すと続きを取得hk_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; // 1ページあたりの件数、デフォルト10、範囲1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security 構造については 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
- API呼び出し結果: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; // 1ページあたりの件数、デフォルト10、範囲1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security 構造については 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
- API呼び出し結果: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; // 1ページあたりの件数、デフォルト10、範囲1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security 構造については 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
- API呼び出し結果: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; // 1ページあたりの件数、デフォルト10、範囲1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security 構造については 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
- API呼び出し結果: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; // 1ページあたりの件数、デフォルト10、範囲1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security 構造については 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
- API呼び出し結果: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制限
- 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 ページサイズ 1ページあたりの件数、デフォルト10、範囲1~50戻り値
パラメータ 型 説明 ret RET_CODE API呼び出し結果 data dict ret == RET_OK の場合、自社株買いデータの辞書を返します str ret != RET_OK の場合、エラーの説明を返します 返される辞書には以下のフィールドが含まれます:
フィールド 型 説明 next_key str ページングキー "-1" はデータなし;次のリクエストの next_key に渡すと続きを取得hk_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; // 1ページあたりの件数、デフォルト10、範囲1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security 構造については 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
- API呼び出し結果: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; // 1ページあたりの件数、デフォルト10、範囲1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security 構造については 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
- API呼び出し結果: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; // 1ページあたりの件数、デフォルト10、範囲1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security 構造については 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
- API呼び出し結果: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; // 1ページあたりの件数、デフォルト10、範囲1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security 構造については 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
- API呼び出し結果: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; // 1ページあたりの件数、デフォルト10、範囲1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security 構造については 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
- API呼び出し結果: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制限
- 30秒以内に最大30回リクエスト可能。
- 香港株、A株の正株およびファンドに対応。