# 獲取派息日曆
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_dividend_calendar(market, date, data_from=None, count=None)
介紹
獲取派息日曆,返回指定市場中某一天的派息數據列表,包含除淨日、股權登記日、派息日等信息。
參數
參數 類型 說明 market Market 市場類型(支持 HK/US/MY/SG/JP)(必填) date str 查詢日期,格式 "YYYY-MM-DD"(必填)data_from int 分頁偏移量,默認 0 count int 返回數量,默認不限 輸入限制
date:僅支持查詢單天數據,格式"YYYY-MM-DD"。
返回
參數 類型 說明 ret RET_CODE 接口調用結果 data pd.DataFrame 當 ret == RET_OK,返回 (all_count, DataFrame) 元組 str 當 ret != RET_OK,返回錯誤描述 - 數據格式如下:
字段 類型 說明 security str 股票代碼(如 'HK.00005')name str 股票名稱 statement str 方案說明 record_date str 股權登記日( "YYYY-MM-DD")ex_date str 除淨日( "YYYY-MM-DD")dividend_payable_date str 派息日( "YYYY-MM-DD")
- 數據格式如下:
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_dividend_calendar(market=Market.US, date='2026-06-24', count=2)
if ret == RET_OK:
all_count, df = data
print(f'總數據量: {all_count}')
print(df)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
- Output
總數據量: 225
security name statement record_date ex_date dividend_payable_date
0 US.STX 希捷科技 1股派息0.74USD 2026-06-24 2026-06-24 2026-07-07
1 US.VGT 資訊科技ETF-Vanguard 1股派息0.1384USD 2026-06-24 2026-06-24 2026-06-26
2
3
4
# Qot_GetDividendCalendar.proto
介紹
獲取派息日曆,返回指定市場中某一天的派息數據列表,包含除淨日、股權登記日、派息日等信息。
參數
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (支持 HK=1, US=11, MY=61, SG=31, JP=41)
required string date = 2; // 查詢日期, 格式"YYYY-MM-DD"
optional int32 dataFrom = 3; // 分頁偏移量, 默認0
optional int32 count = 4; // 返回數量, 默認不限
}
// 派息日曆單條記錄
message DividendCalendarItem {
required Qot_Common.Security security = 1; // 股票
optional string name = 2; // 股票名稱
optional string statement = 3; // 方案說明
optional string recordDate = 4; // 股權登記日 ("YYYY-MM-DD")
optional string exDate = 5; // 除淨日 ("YYYY-MM-DD")
optional string dividendPayableDate = 6; // 派息日 ("YYYY-MM-DD")
}
message S2C {
repeated DividendCalendarItem itemList = 1; // 派息列表
optional int32 allCount = 2; // 該日期下的總數量
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // 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
協議 ID
3408
uint GetDividendCalendar(Qot_GetDividendCalendar.Request req);
virtual void OnReply_GetDividendCalendar(FTAPI_Conn client, uint nSerialNo, Qot_GetDividendCalendar.Response rsp);
介紹
獲取派息日曆,返回指定市場中某一天的派息數據列表,包含除淨日、股權登記日、派息日等信息。
參數
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (支持 HK=1, US=11, MY=61, SG=31, JP=41)
required string date = 2; // 查詢日期, 格式"YYYY-MM-DD"
optional int32 dataFrom = 3; // 分頁偏移量, 默認0
optional int32 count = 4; // 返回數量, 默認不限
}
// 派息日曆單條記錄
message DividendCalendarItem {
required Qot_Common.Security security = 1; // 股票
optional string name = 2; // 股票名稱
optional string statement = 3; // 方案說明
optional string recordDate = 4; // 股權登記日 ("YYYY-MM-DD")
optional string exDate = 5; // 除淨日 ("YYYY-MM-DD")
optional string dividendPayableDate = 6; // 派息日 ("YYYY-MM-DD")
}
message S2C {
repeated DividendCalendarItem itemList = 1; // 派息列表
optional int32 allCount = 2; // 該日期下的總數量
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // 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
- 接口調用結果,結構參見 RetType
協議 ID
3408
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}
", errCode, desc, client.GetConnectID());
if (errCode != 0)
return;
QotGetDividendCalendar.C2S c2s = QotGetDividendCalendar.C2S.CreateBuilder()
.SetDate("2026-06-23")
.SetMarket(11)
.SetCount(3)
.Build();
QotGetDividendCalendar.Request req = QotGetDividendCalendar.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetDividendCalendar(req);
Console.Write("Send QotGetDividendCalendar: {0}
", seqNo);
}
public void OnDisconnect(FTAPI_Conn client, long errCode) {
Console.Write("Qot onDisConnect: {0}
", errCode);
}
public void OnReply_GetDividendCalendar(FTAPI_Conn client, uint nSerialNo, QotGetDividendCalendar.Response rsp)
{
Console.Write("Reply: QotGetDividendCalendar: {0}
", nSerialNo);
if (rsp.RetType == 0 && rsp.HasS2C)
Console.Write("{0}
", rsp.ToString());
}
public static void Main(String[] args) {
FTAPI.Init();
Program program = new Program();
program.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
- Output
Send QotGetDividendCalendar: 3
Reply: QotGetDividendCalendar: 3
GetDividendCalendar: errCode 0, retMsg , retType 0
{
"allCount": 85,
"itemList": [
{ "security": { "market": 11, "code": "APH" }, "name": "安費諾", "statement": "1股派息0.25USD", "exDate": "2026-06-23" },
{ "security": { "market": 11, "code": "SATA" }, "name": "STRIVE INC PERP PFD SER A VAR RATE", "statement": "1股派息0.0542USD", "exDate": "2026-06-23" },
{ "security": { "market": 11, "code": "CNQ" }, "name": "加拿大自然資源", "statement": "1股派息0.46618USD", "exDate": "2026-06-23" }
]
}
2
3
4
5
6
7
8
9
10
11
int getDividendCalendar(Qot_GetDividendCalendar.Request req);
onReply_GetDividendCalendar(FTAPI_Conn client, int nSerialNo, Qot_GetDividendCalendar.Response rsp)
介紹
獲取派息日曆,返回指定市場中某一天的派息數據列表,包含除淨日、股權登記日、派息日等信息。
參數
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (支持 HK=1, US=11, MY=61, SG=31, JP=41)
required string date = 2; // 查詢日期, 格式"YYYY-MM-DD"
optional int32 dataFrom = 3; // 分頁偏移量, 默認0
optional int32 count = 4; // 返回數量, 默認不限
}
// 派息日曆單條記錄
message DividendCalendarItem {
required Qot_Common.Security security = 1; // 股票
optional string name = 2; // 股票名稱
optional string statement = 3; // 方案說明
optional string recordDate = 4; // 股權登記日 ("YYYY-MM-DD")
optional string exDate = 5; // 除淨日 ("YYYY-MM-DD")
optional string dividendPayableDate = 6; // 派息日 ("YYYY-MM-DD")
}
message S2C {
repeated DividendCalendarItem itemList = 1; // 派息列表
optional int32 allCount = 2; // 該日期下的總數量
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // 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
- 接口調用結果,結構參見 RetType
協議 ID
3408
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=%d desc=%s connID=%d
", errCode, desc, client.getConnectID());
if (errCode != 0)
return;
QotGetDividendCalendar.C2S c2s = QotGetDividendCalendar.C2S.newBuilder()
.setDate("2026-06-23")
.setMarket(11)
.setCount(3)
.build();
QotGetDividendCalendar.Request req = QotGetDividendCalendar.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getDividendCalendar(req);
System.out.printf("Send QotGetDividendCalendar: %d
", seqNo);
}
@Override
public void onDisconnect(FTAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d
", errCode);
}
@Override
public void onReply_GetDividendCalendar(FTAPI_Conn client, int nSerialNo, QotGetDividendCalendar.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetDividendCalendar failed: %s
", rsp.getRetMsg());
} else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetDividendCalendar: %s
", 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
67
68
- Output
Send QotGetDividendCalendar: 3
Receive QotGetDividendCalendar: {
"allCount": 85,
"itemList": [
{ "security": { "market": 11, "code": "APH" }, "name": "安費諾", "statement": "1股派息0.25USD", "exDate": "2026-06-23" },
{ "security": { "market": 11, "code": "SATA" }, "name": "STRIVE INC PERP PFD SER A VAR RATE", "statement": "1股派息0.0542USD", "exDate": "2026-06-23" },
{ "security": { "market": 11, "code": "CNQ" }, "name": "加拿大自然資源", "statement": "1股派息0.46618USD", "exDate": "2026-06-23" }
]
}
2
3
4
5
6
7
8
9
Futu::u32_t GetDividendCalendar(const Qot_GetDividendCalendar::Request &stReq); virtual void OnReply_GetDividendCalendar(Futu::u32_t nSerialNo, const Qot_GetDividendCalendar::Response &stRsp) = 0;
介紹
協議請求及回應定義
參數
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (支持 HK=1, US=11, MY=61, SG=31, JP=41)
required string date = 2; // 查詢日期, 格式"YYYY-MM-DD"
optional int32 dataFrom = 3; // 分頁偏移量, 默認0
optional int32 count = 4; // 返回數量, 默認不限
}
// 派息日曆單條記錄
message DividendCalendarItem {
required Qot_Common.Security security = 1; // 股票
optional string name = 2; // 股票名稱
optional string statement = 3; // 方案說明
optional string recordDate = 4; // 股權登記日 ("YYYY-MM-DD")
optional string exDate = 5; // 除淨日 ("YYYY-MM-DD")
optional string dividendPayableDate = 6; // 派息日 ("YYYY-MM-DD")
}
message S2C {
repeated DividendCalendarItem itemList = 1; // 派息列表
optional int32 allCount = 2; // 該日期下的總數量
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // 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
- 介面呼叫結果,結構參見 RetType
協議 ID
3408
Example
class Program : public FTSPI_Qot, 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) {
Qot_GetDividendCalendar::Request req;
Qot_GetDividendCalendar::C2S *c2s = req.mutable_c2s();
c2s->set_market(Qot_Common::QotMarket::QotMarket_US_Security);
c2s->set_date("2024-06-01");
m_GetDividendCalendarSerialNo = m_pQotApi->GetDividendCalendar(req);
}
virtual void OnReply_GetDividendCalendar(Futu::u32_t nSerialNo, const Qot_GetDividendCalendar::Response &stRsp) {
if (nSerialNo != m_GetDividendCalendarSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
FTAPI_Qot *m_pQotApi;
Futu::u32_t m_GetDividendCalendarSerialNo = 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
- Output
{
"retType": 0,
"retMsg": "",
"errCode": 0,
"s2c": {
"itemList": [
{
"security": {
"market": 11,
"code": "AAPL"
},
"name": "Apple",
"exDate": "2024-06-14",
"dividendPayableDate": "2024-06-27"
}
],
"allCount": 120
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
getDividendCalendar(qotGetDividendCalendar)
介紹
獲取派息日曆,返回指定市場中某一天的派息數據列表,包含除淨日、股權登記日、派息日等信息。
參數
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (支持 HK=1, US=11, MY=61, SG=31, JP=41)
required string date = 2; // 查詢日期, 格式"YYYY-MM-DD"
optional int32 dataFrom = 3; // 分頁偏移量, 默認0
optional int32 count = 4; // 返回數量, 默認不限
}
// 派息日曆單條記錄
message DividendCalendarItem {
required Qot_Common.Security security = 1; // 股票
optional string name = 2; // 股票名稱
optional string statement = 3; // 方案說明
optional string recordDate = 4; // 股權登記日 ("YYYY-MM-DD")
optional string exDate = 5; // 除淨日 ("YYYY-MM-DD")
optional string dividendPayableDate = 6; // 派息日 ("YYYY-MM-DD")
}
message S2C {
repeated DividendCalendarItem itemList = 1; // 派息列表
optional int32 allCount = 2; // 該日期下的總數量
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // 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
- 接口調用結果,結構參見 RetType
協議 ID
3408
Example
import ftWebsocket from "futu-api";
import { Common, Qot_Common } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetDividendCalendar(){
const { RetType } = Common
let [addr, port, enable_ssl, key] = ["127.0.0.1", 11111, false, "xxxxxx"];
let websocket = new ftWebsocket();
websocket.onlogin = (ret, msg)=>{
if (ret) {
const req = {
c2s: {
market: 11, // Qot_Common.QotMarket_US
date: "2026-06-23",
count: 3,
},
};
websocket.GetDividendCalendar(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetDividendCalendar: 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("start error", msg);
}
};
websocket.start(addr, port, enable_ssl, key);
setTimeout(()=>{ websocket.stop(); process.exit(); }, 5000);
}
QotGetDividendCalendar()
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
- Output
GetDividendCalendar: errCode 0, retMsg , retType 0
{
"allCount": 85,
"itemList": [
{ "security": { "market": 11, "code": "APH" }, "name": "安費諾", "statement": "1股派息0.25USD", "exDate": "2026-06-23" },
{ "security": { "market": 11, "code": "SATA" }, "name": "STRIVE INC PERP PFD SER A VAR RATE", "statement": "1股派息0.0542USD", "exDate": "2026-06-23" },
{ "security": { "market": 11, "code": "CNQ" }, "name": "加拿大自然資源", "statement": "1股派息0.46618USD", "exDate": "2026-06-23" }
]
}
2
3
4
5
6
7
8
9
接口限制
- 30 秒內最多 60 次請求
- 分頁請求僅首頁計入限頻統計
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_dividend_calendar(market, date, data_from=None, count=None)
介紹
獲取派息日曆,返回指定市場中某一天的派息數據列表,包含除淨日、股權登記日、派息日等信息。
參數
參數 類型 說明 market Market 市場類型(支持 HK/US/MY/SG/JP)(必填) date str 查詢日期,格式 "YYYY-MM-DD"(必填)data_from int 分頁偏移量,默認 0 count int 返回數量,默認不限 輸入限制
date:僅支持查詢單天數據,格式"YYYY-MM-DD"。
返回
參數 類型 說明 ret RET_CODE 接口調用結果 data pd.DataFrame 當 ret == RET_OK,返回 (all_count, DataFrame) 元組 str 當 ret != RET_OK,返回錯誤描述 - 數據格式如下:
字段 類型 說明 security str 股票代碼(如 'HK.00005')name str 股票名稱 statement str 方案說明 record_date str 股權登記日( "YYYY-MM-DD")ex_date str 除淨日( "YYYY-MM-DD")dividend_payable_date str 派息日( "YYYY-MM-DD")
- 數據格式如下:
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_dividend_calendar(market=Market.US, date='2026-06-24', count=2)
if ret == RET_OK:
all_count, df = data
print(f'總數據量: {all_count}')
print(df)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
- Output
總數據量: 225
security name statement record_date ex_date dividend_payable_date
0 US.STX 希捷科技 1股派息0.74USD 2026-06-24 2026-06-24 2026-07-07
1 US.VGT 資訊科技ETF-Vanguard 1股派息0.1384USD 2026-06-24 2026-06-24 2026-06-26
2
3
4
# Qot_GetDividendCalendar.proto
介紹
獲取派息日曆,返回指定市場中某一天的派息數據列表,包含除淨日、股權登記日、派息日等信息。
參數
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (支持 HK=1, US=11, MY=61, SG=31, JP=41)
required string date = 2; // 查詢日期, 格式"YYYY-MM-DD"
optional int32 dataFrom = 3; // 分頁偏移量, 默認0
optional int32 count = 4; // 返回數量, 默認不限
}
// 派息日曆單條記錄
message DividendCalendarItem {
required Qot_Common.Security security = 1; // 股票
optional string name = 2; // 股票名稱
optional string statement = 3; // 方案說明
optional string recordDate = 4; // 股權登記日 ("YYYY-MM-DD")
optional string exDate = 5; // 除淨日 ("YYYY-MM-DD")
optional string dividendPayableDate = 6; // 派息日 ("YYYY-MM-DD")
}
message S2C {
repeated DividendCalendarItem itemList = 1; // 派息列表
optional int32 allCount = 2; // 該日期下的總數量
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // 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
協議 ID
3408
uint GetDividendCalendar(Qot_GetDividendCalendar.Request req);
virtual void OnReply_GetDividendCalendar(FTAPI_Conn client, uint nSerialNo, Qot_GetDividendCalendar.Response rsp);
介紹
獲取派息日曆,返回指定市場中某一天的派息數據列表,包含除淨日、股權登記日、派息日等信息。
參數
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (支持 HK=1, US=11, MY=61, SG=31, JP=41)
required string date = 2; // 查詢日期, 格式"YYYY-MM-DD"
optional int32 dataFrom = 3; // 分頁偏移量, 默認0
optional int32 count = 4; // 返回數量, 默認不限
}
// 派息日曆單條記錄
message DividendCalendarItem {
required Qot_Common.Security security = 1; // 股票
optional string name = 2; // 股票名稱
optional string statement = 3; // 方案說明
optional string recordDate = 4; // 股權登記日 ("YYYY-MM-DD")
optional string exDate = 5; // 除淨日 ("YYYY-MM-DD")
optional string dividendPayableDate = 6; // 派息日 ("YYYY-MM-DD")
}
message S2C {
repeated DividendCalendarItem itemList = 1; // 派息列表
optional int32 allCount = 2; // 該日期下的總數量
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // 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
- 接口調用結果,結構參見 RetType
協議 ID
3408
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}
", errCode, desc, client.GetConnectID());
if (errCode != 0)
return;
QotGetDividendCalendar.C2S c2s = QotGetDividendCalendar.C2S.CreateBuilder()
.SetDate("2026-06-23")
.SetMarket(11)
.SetCount(3)
.Build();
QotGetDividendCalendar.Request req = QotGetDividendCalendar.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetDividendCalendar(req);
Console.Write("Send QotGetDividendCalendar: {0}
", seqNo);
}
public void OnDisconnect(MMAPI_Conn client, long errCode) {
Console.Write("Qot onDisConnect: {0}
", errCode);
}
public void OnReply_GetDividendCalendar(MMAPI_Conn client, uint nSerialNo, QotGetDividendCalendar.Response rsp)
{
Console.Write("Reply: QotGetDividendCalendar: {0}
", nSerialNo);
if (rsp.RetType == 0 && rsp.HasS2C)
Console.Write("{0}
", rsp.ToString());
}
public static void Main(String[] args) {
MMAPI.Init();
Program program = new Program();
program.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
- Output
Send QotGetDividendCalendar: 3
Reply: QotGetDividendCalendar: 3
GetDividendCalendar: errCode 0, retMsg , retType 0
{
"allCount": 85,
"itemList": [
{ "security": { "market": 11, "code": "APH" }, "name": "安費諾", "statement": "1股派息0.25USD", "exDate": "2026-06-23" },
{ "security": { "market": 11, "code": "SATA" }, "name": "STRIVE INC PERP PFD SER A VAR RATE", "statement": "1股派息0.0542USD", "exDate": "2026-06-23" },
{ "security": { "market": 11, "code": "CNQ" }, "name": "加拿大自然資源", "statement": "1股派息0.46618USD", "exDate": "2026-06-23" }
]
}
2
3
4
5
6
7
8
9
10
11
int getDividendCalendar(Qot_GetDividendCalendar.Request req);
onReply_GetDividendCalendar(FTAPI_Conn client, int nSerialNo, Qot_GetDividendCalendar.Response rsp)
介紹
獲取派息日曆,返回指定市場中某一天的派息數據列表,包含除淨日、股權登記日、派息日等信息。
參數
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (支持 HK=1, US=11, MY=61, SG=31, JP=41)
required string date = 2; // 查詢日期, 格式"YYYY-MM-DD"
optional int32 dataFrom = 3; // 分頁偏移量, 默認0
optional int32 count = 4; // 返回數量, 默認不限
}
// 派息日曆單條記錄
message DividendCalendarItem {
required Qot_Common.Security security = 1; // 股票
optional string name = 2; // 股票名稱
optional string statement = 3; // 方案說明
optional string recordDate = 4; // 股權登記日 ("YYYY-MM-DD")
optional string exDate = 5; // 除淨日 ("YYYY-MM-DD")
optional string dividendPayableDate = 6; // 派息日 ("YYYY-MM-DD")
}
message S2C {
repeated DividendCalendarItem itemList = 1; // 派息列表
optional int32 allCount = 2; // 該日期下的總數量
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // 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
- 接口調用結果,結構參見 RetType
協議 ID
3408
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=%d desc=%s connID=%d
", errCode, desc, client.getConnectID());
if (errCode != 0)
return;
QotGetDividendCalendar.C2S c2s = QotGetDividendCalendar.C2S.newBuilder()
.setDate("2026-06-23")
.setMarket(11)
.setCount(3)
.build();
QotGetDividendCalendar.Request req = QotGetDividendCalendar.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getDividendCalendar(req);
System.out.printf("Send QotGetDividendCalendar: %d
", seqNo);
}
@Override
public void onDisconnect(MMAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d
", errCode);
}
@Override
public void onReply_GetDividendCalendar(MMAPI_Conn client, int nSerialNo, QotGetDividendCalendar.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetDividendCalendar failed: %s
", rsp.getRetMsg());
} else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetDividendCalendar: %s
", 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
67
68
- Output
Send QotGetDividendCalendar: 3
Receive QotGetDividendCalendar: {
"allCount": 85,
"itemList": [
{ "security": { "market": 11, "code": "APH" }, "name": "安費諾", "statement": "1股派息0.25USD", "exDate": "2026-06-23" },
{ "security": { "market": 11, "code": "SATA" }, "name": "STRIVE INC PERP PFD SER A VAR RATE", "statement": "1股派息0.0542USD", "exDate": "2026-06-23" },
{ "security": { "market": 11, "code": "CNQ" }, "name": "加拿大自然資源", "statement": "1股派息0.46618USD", "exDate": "2026-06-23" }
]
}
2
3
4
5
6
7
8
9
moomoo::u32_t GetDividendCalendar(const Qot_GetDividendCalendar::Request &stReq); virtual void OnReply_GetDividendCalendar(moomoo::u32_t nSerialNo, const Qot_GetDividendCalendar::Response &stRsp) = 0;
介紹
協議請求及回應定義
參數
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (支持 HK=1, US=11, MY=61, SG=31, JP=41)
required string date = 2; // 查詢日期, 格式"YYYY-MM-DD"
optional int32 dataFrom = 3; // 分頁偏移量, 默認0
optional int32 count = 4; // 返回數量, 默認不限
}
// 派息日曆單條記錄
message DividendCalendarItem {
required Qot_Common.Security security = 1; // 股票
optional string name = 2; // 股票名稱
optional string statement = 3; // 方案說明
optional string recordDate = 4; // 股權登記日 ("YYYY-MM-DD")
optional string exDate = 5; // 除淨日 ("YYYY-MM-DD")
optional string dividendPayableDate = 6; // 派息日 ("YYYY-MM-DD")
}
message S2C {
repeated DividendCalendarItem itemList = 1; // 派息列表
optional int32 allCount = 2; // 該日期下的總數量
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // 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
- 介面呼叫結果,結構參見 RetType
協議 ID
3408
Example
class Program : public MMSPI_Qot, 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) {
Qot_GetDividendCalendar::Request req;
Qot_GetDividendCalendar::C2S *c2s = req.mutable_c2s();
c2s->set_market(Qot_Common::QotMarket::QotMarket_US_Security);
c2s->set_date("2024-06-01");
m_GetDividendCalendarSerialNo = m_pQotApi->GetDividendCalendar(req);
}
virtual void OnReply_GetDividendCalendar(moomoo::u32_t nSerialNo, const Qot_GetDividendCalendar::Response &stRsp) {
if (nSerialNo != m_GetDividendCalendarSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
MMAPI_Qot *m_pQotApi;
moomoo::u32_t m_GetDividendCalendarSerialNo = 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
- Output
{
"retType": 0,
"retMsg": "",
"errCode": 0,
"s2c": {
"itemList": [
{
"security": {
"market": 11,
"code": "AAPL"
},
"name": "Apple",
"exDate": "2024-06-14",
"dividendPayableDate": "2024-06-27"
}
],
"allCount": 120
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
getDividendCalendar(qotGetDividendCalendar)
介紹
獲取派息日曆,返回指定市場中某一天的派息數據列表,包含除淨日、股權登記日、派息日等信息。
參數
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (支持 HK=1, US=11, MY=61, SG=31, JP=41)
required string date = 2; // 查詢日期, 格式"YYYY-MM-DD"
optional int32 dataFrom = 3; // 分頁偏移量, 默認0
optional int32 count = 4; // 返回數量, 默認不限
}
// 派息日曆單條記錄
message DividendCalendarItem {
required Qot_Common.Security security = 1; // 股票
optional string name = 2; // 股票名稱
optional string statement = 3; // 方案說明
optional string recordDate = 4; // 股權登記日 ("YYYY-MM-DD")
optional string exDate = 5; // 除淨日 ("YYYY-MM-DD")
optional string dividendPayableDate = 6; // 派息日 ("YYYY-MM-DD")
}
message S2C {
repeated DividendCalendarItem itemList = 1; // 派息列表
optional int32 allCount = 2; // 該日期下的總數量
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // 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
- 接口調用結果,結構參見 RetType
協議 ID
3408
Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_Common } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetDividendCalendar(){
const { RetType } = Common
let [addr, port, enable_ssl, key] = ["127.0.0.1", 11111, false, "xxxxxx"];
let websocket = new mmWebsocket();
websocket.onlogin = (ret, msg)=>{
if (ret) {
const req = {
c2s: {
market: 11, // Qot_Common.QotMarket_US
date: "2026-06-23",
count: 3,
},
};
websocket.GetDividendCalendar(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetDividendCalendar: 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("start error", msg);
}
};
websocket.start(addr, port, enable_ssl, key);
setTimeout(()=>{ websocket.stop(); process.exit(); }, 5000);
}
QotGetDividendCalendar()
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
- Output
GetDividendCalendar: errCode 0, retMsg , retType 0
{
"allCount": 85,
"itemList": [
{ "security": { "market": 11, "code": "APH" }, "name": "安費諾", "statement": "1股派息0.25USD", "exDate": "2026-06-23" },
{ "security": { "market": 11, "code": "SATA" }, "name": "STRIVE INC PERP PFD SER A VAR RATE", "statement": "1股派息0.0542USD", "exDate": "2026-06-23" },
{ "security": { "market": 11, "code": "CNQ" }, "name": "加拿大自然資源", "statement": "1股派息0.46618USD", "exDate": "2026-06-23" }
]
}
2
3
4
5
6
7
8
9
接口限制
- 30 秒內最多 60 次請求
- 分頁請求僅首頁計入限頻統計