# Get Dividend Rank
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_dividend_rank(market, rank_type, count=None, filter_list=None, sort_field=None)
Description
Get dividend rank, returning a list of stocks in a specified market ranked by high dividend yield or consecutive dividend growth, including dividend yield, distribution frequency, consecutive growth years, and other dimensional data.
Parameters
Parameter Type Description market Market Market type (supports HK/US/MY/SG/JP) (required) rank_type DividendRankType Rank type (required) count int Return count [1, 300], default 10 filter_list list[ DividendRankFilter]Filter condition list (multiple conditions are AND-combined, supports range and enum types) sort_field DividendRankSortField Sort field (fixed descending), default determined by rankType Input Limits
filter_listFilter Conditions(DividendRankFilter):Construct filter conditions via
DividendRankFilter, supporting both range and enum filters:Constructor Parameter Description indicator_typeFilter indicator type ( DividendRankIndicatorType, required)value_listEnum value list (for enum-type filters, such as dividend frequency) interval_minRange minimum (closed interval, for range filter) interval_maxRange maximum (closed interval, for range filter) Note: At least one of
value_listorinterval_min/interval_maxmust be provided.
Return
Parameter Type Description ret RET_CODE API call result data pd.DataFrame When ret == RET_OK, returns data str When ret != RET_OK, returns error description - Data format:
Field Type Description security str Stock code (e.g. 'HK.00005')name str Stock name industry str Industry cur_price float Latest price change_rate float Today's change rate (%) change_amount float Today's change amount market_cap float Market cap dividend_yield_ttm float Dividend yield TTM (%) avg_dividend_yield_5y float 5-year average dividend yield (%) distribution_frequency str Distribution frequency (ANNUAL/SEMI_ANNUAL/QUARTERLY/MONTHLY), not supported for HK market dividend_grow_year int Consecutive dividend growth years dividends_ttm float Dividends TTM (amount) payout_ratio_lfy float Dividend payout ratio LFY (%) next_payable_date str Next dividend date (e.g. '2025-09-15')
- Data format:
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_dividend_rank(market=Market.HK, rank_type=DividendRankType.HIGH_YIELD, count=2)
if ret == RET_OK:
print(data)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
- Output
security name industry cur_price change_rate change_amount market_cap dividend_yield_ttm avg_dividend_yield_5y distribution_frequency dividend_grow_year dividends_ttm payout_ratio_lfy next_payable_date
0 HK.00288 万洲国际 包装食品 8.54 -0.582 -0.05 1.095701e+11 10.655 10.855 SEMI_ANNUAL 2 0.910 116.44 N/A
1 HK.01919 中远海控 航运及港口 13.20 -1.123 -0.15 2.021314e+11 8.522 38.168 SEMI_ANNUAL 0 1.125 49.67 N/A
2
3
# Qot_GetDividendRank.proto
Description
Get dividend rank, returning a list of stocks in a specified market ranked by high dividend yield or consecutive dividend growth, including dividend yield, distribution frequency, consecutive growth years, and other dimensional data.
Parameters
// Dividend ranking type
enum DividendRankType {
DividendRankType_Unknown = 0;
DividendRankType_HighYield = 1; // High dividend yield
DividendRankType_DividendGrowth = 2; // Dividend growth
}
// Filter condition type
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_DividendYieldTTM = 1; //[Range] Dividend yield TTM (%)
IndicatorType_AvgDividendYield5Y = 2; //[Range] 5-year avg dividend yield (%)
IndicatorType_DistributionFrequency = 3; //[Enum] Dividend frequency (1:annual, 2:semi-annual, 3:quarterly, 4:monthly)
IndicatorType_DividendGrowYear = 4; //[Range] Consecutive dividend growth years
IndicatorType_DividendsTTM = 5; //[Range] Dividend TTM (amount)
IndicatorType_PayoutRatioLFY = 6; //[Range] Dividend payout ratio LFY (%)
IndicatorType_NextPayableDate = 7; //[Range] Next dividend date (relative days)
IndicatorType_Price = 8; //[Range] Last price
IndicatorType_MarketCap = 9; //[Range] Market cap
}
// Sort field (fixed descending)
enum SortField {
SortField_Unknown = 0; // Default: HighYield→dividend yield TTM, DividendGrowth→consecutive growth years
SortField_DividendYieldTTM = 1; // Dividend yield TTM
SortField_AvgDividendYield5Y = 2; // 5-year avg dividend yield
SortField_DistributionFrequency = 3; // Dividend frequency
SortField_DividendGrowYear = 4; // Consecutive dividend growth years
SortField_DividendsTTM = 5; // Dividend TTM
SortField_PayoutRatioLFY = 6; // Dividend payout ratio LFY
SortField_Price = 7; // Price
SortField_MarketCap = 8; // Market cap
SortField_ChangeRate = 9; // Today's change
SortField_ChangeAmount = 10; // Today's price change amount
}
// Filter conditions
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2; // Filter value (use valueList for enum, valueInterval for range)
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (supports HK=1, US=11, MY=61, SG=31, JP=41 only)
required int32 rankType = 2; // DividendRankType
optional int32 count = 3; // Return count [1,300], default 10
repeated Indicator filterList = 4; // Optional filter conditions (AND relationship)
optional int32 sortField = 5; // SortField, sort field (fixed descending), default determined by rankType
}
// Dividend ranking data item
message DividendRankItem {
required Qot_Common.Security security = 1; // Stock
optional string name = 2; // Name
optional string industry = 3; // Industry
// Quote
optional double curPrice = 10; // Last price
optional double changeRate = 11; // Today's change (%)
optional double changeAmount = 12; // Today's price change amount
optional double marketCap = 13; // Market cap
// Dividend
optional double dividendYieldTTM = 20; // Dividend yield TTM (%)
optional double avgDividendYield5Y = 21; // 5-year avg dividend yield (%)
optional int32 distributionFrequency = 22; // Dividend frequency (1:annual, 2:semi-annual, 3:quarterly, 4:monthly), HK market not supported
optional int32 dividendGrowYear = 23; // Consecutive dividend growth years
optional double dividendsTTM = 24; // Dividend TTM (amount)
optional double payoutRatioLFY = 25; // Dividend payout ratio LFY (%)
optional string nextPayableDate = 26; // Next dividend date ("YYYY-MM-DD")
}
message S2C {
repeated DividendRankItem dataList = 1; // Data list
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType, return result
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
Protocol ID
3407
uint GetDividendRank(Qot_GetDividendRank.Request req);
virtual void OnReply_GetDividendRank(FTAPI_Conn client, uint nSerialNo, Qot_GetDividendRank.Response rsp);
Description
Get dividend rank, returning a list of stocks in a specified market ranked by high dividend yield or consecutive dividend growth, including dividend yield, distribution frequency, consecutive growth years, and other dimensional data.
Parameters
// Dividend ranking type
enum DividendRankType {
DividendRankType_Unknown = 0;
DividendRankType_HighYield = 1; // High dividend yield
DividendRankType_DividendGrowth = 2; // Dividend growth
}
// Filter condition type
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_DividendYieldTTM = 1; //[Range] Dividend yield TTM (%)
IndicatorType_AvgDividendYield5Y = 2; //[Range] 5-year avg dividend yield (%)
IndicatorType_DistributionFrequency = 3; //[Enum] Dividend frequency (1:annual, 2:semi-annual, 3:quarterly, 4:monthly)
IndicatorType_DividendGrowYear = 4; //[Range] Consecutive dividend growth years
IndicatorType_DividendsTTM = 5; //[Range] Dividend TTM (amount)
IndicatorType_PayoutRatioLFY = 6; //[Range] Dividend payout ratio LFY (%)
IndicatorType_NextPayableDate = 7; //[Range] Next dividend date (relative days)
IndicatorType_Price = 8; //[Range] Last price
IndicatorType_MarketCap = 9; //[Range] Market cap
}
// Sort field (fixed descending)
enum SortField {
SortField_Unknown = 0; // Default: HighYield→dividend yield TTM, DividendGrowth→consecutive growth years
SortField_DividendYieldTTM = 1; // Dividend yield TTM
SortField_AvgDividendYield5Y = 2; // 5-year avg dividend yield
SortField_DistributionFrequency = 3; // Dividend frequency
SortField_DividendGrowYear = 4; // Consecutive dividend growth years
SortField_DividendsTTM = 5; // Dividend TTM
SortField_PayoutRatioLFY = 6; // Dividend payout ratio LFY
SortField_Price = 7; // Price
SortField_MarketCap = 8; // Market cap
SortField_ChangeRate = 9; // Today's change
SortField_ChangeAmount = 10; // Today's price change amount
}
// Filter conditions
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2; // Filter value (use valueList for enum, valueInterval for range)
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (supports HK=1, US=11, MY=61, SG=31, JP=41 only)
required int32 rankType = 2; // DividendRankType
optional int32 count = 3; // Return count [1,300], default 10
repeated Indicator filterList = 4; // Optional filter conditions (AND relationship)
optional int32 sortField = 5; // SortField, sort field (fixed descending), default determined by rankType
}
// Dividend ranking data item
message DividendRankItem {
required Qot_Common.Security security = 1; // Stock
optional string name = 2; // Name
optional string industry = 3; // Industry
// Quote
optional double curPrice = 10; // Last price
optional double changeRate = 11; // Today's change (%)
optional double changeAmount = 12; // Today's price change amount
optional double marketCap = 13; // Market cap
// Dividend
optional double dividendYieldTTM = 20; // Dividend yield TTM (%)
optional double avgDividendYield5Y = 21; // 5-year avg dividend yield (%)
optional int32 distributionFrequency = 22; // Dividend frequency (1:annual, 2:semi-annual, 3:quarterly, 4:monthly), HK market not supported
optional int32 dividendGrowYear = 23; // Consecutive dividend growth years
optional double dividendsTTM = 24; // Dividend TTM (amount)
optional double payoutRatioLFY = 25; // Dividend payout ratio LFY (%)
optional string nextPayableDate = 26; // Next dividend date ("YYYY-MM-DD")
}
message S2C {
repeated DividendRankItem dataList = 1; // Data list
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType, return result
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
- For interface result, refer to RetType
Protocol ID
3407
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;
QotGetDividendRank.C2S c2s = QotGetDividendRank.C2S.CreateBuilder()
.SetMarket(1)
.SetRankType(1)
.SetCount(3)
.Build();
QotGetDividendRank.Request req = QotGetDividendRank.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetDividendRank(req);
Console.Write("Send QotGetDividendRank: {0}
", seqNo);
}
public void OnDisconnect(FTAPI_Conn client, long errCode) {
Console.Write("Qot onDisConnect: {0}
", errCode);
}
public void OnReply_GetDividendRank(FTAPI_Conn client, uint nSerialNo, QotGetDividendRank.Response rsp)
{
Console.Write("Reply: QotGetDividendRank: {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 QotGetDividendRank: 3
Reply: QotGetDividendRank: 3
GetDividendRank: errCode 0, retMsg , retType 0
{
"dataList": [
{ "security": { "market": 1, "code": "00288" }, "name": "万洲国际", "dividendYieldTtm": 10.569, "dividendsTtm": 0.910 },
{ "security": { "market": 1, "code": "01919" }, "name": "中远海控", "dividendYieldTtm": 8.302, "dividendsTtm": 1.125 },
{ "security": { "market": 1, "code": "01088" }, "name": "中国神华", "dividendYieldTtm": 7.578, "dividendsTtm": 3.227 }
]
}
2
3
4
5
6
7
8
9
10
int getDividendRank(Qot_GetDividendRank.Request req);
onReply_GetDividendRank(FTAPI_Conn client, int nSerialNo, Qot_GetDividendRank.Response rsp)
Description
Get dividend rank, returning a list of stocks in a specified market ranked by high dividend yield or consecutive dividend growth, including dividend yield, distribution frequency, consecutive growth years, and other dimensional data.
Parameters
// Dividend ranking type
enum DividendRankType {
DividendRankType_Unknown = 0;
DividendRankType_HighYield = 1; // High dividend yield
DividendRankType_DividendGrowth = 2; // Dividend growth
}
// Filter condition type
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_DividendYieldTTM = 1; //[Range] Dividend yield TTM (%)
IndicatorType_AvgDividendYield5Y = 2; //[Range] 5-year avg dividend yield (%)
IndicatorType_DistributionFrequency = 3; //[Enum] Dividend frequency (1:annual, 2:semi-annual, 3:quarterly, 4:monthly)
IndicatorType_DividendGrowYear = 4; //[Range] Consecutive dividend growth years
IndicatorType_DividendsTTM = 5; //[Range] Dividend TTM (amount)
IndicatorType_PayoutRatioLFY = 6; //[Range] Dividend payout ratio LFY (%)
IndicatorType_NextPayableDate = 7; //[Range] Next dividend date (relative days)
IndicatorType_Price = 8; //[Range] Last price
IndicatorType_MarketCap = 9; //[Range] Market cap
}
// Sort field (fixed descending)
enum SortField {
SortField_Unknown = 0; // Default: HighYield→dividend yield TTM, DividendGrowth→consecutive growth years
SortField_DividendYieldTTM = 1; // Dividend yield TTM
SortField_AvgDividendYield5Y = 2; // 5-year avg dividend yield
SortField_DistributionFrequency = 3; // Dividend frequency
SortField_DividendGrowYear = 4; // Consecutive dividend growth years
SortField_DividendsTTM = 5; // Dividend TTM
SortField_PayoutRatioLFY = 6; // Dividend payout ratio LFY
SortField_Price = 7; // Price
SortField_MarketCap = 8; // Market cap
SortField_ChangeRate = 9; // Today's change
SortField_ChangeAmount = 10; // Today's price change amount
}
// Filter conditions
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2; // Filter value (use valueList for enum, valueInterval for range)
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (supports HK=1, US=11, MY=61, SG=31, JP=41 only)
required int32 rankType = 2; // DividendRankType
optional int32 count = 3; // Return count [1,300], default 10
repeated Indicator filterList = 4; // Optional filter conditions (AND relationship)
optional int32 sortField = 5; // SortField, sort field (fixed descending), default determined by rankType
}
// Dividend ranking data item
message DividendRankItem {
required Qot_Common.Security security = 1; // Stock
optional string name = 2; // Name
optional string industry = 3; // Industry
// Quote
optional double curPrice = 10; // Last price
optional double changeRate = 11; // Today's change (%)
optional double changeAmount = 12; // Today's price change amount
optional double marketCap = 13; // Market cap
// Dividend
optional double dividendYieldTTM = 20; // Dividend yield TTM (%)
optional double avgDividendYield5Y = 21; // 5-year avg dividend yield (%)
optional int32 distributionFrequency = 22; // Dividend frequency (1:annual, 2:semi-annual, 3:quarterly, 4:monthly), HK market not supported
optional int32 dividendGrowYear = 23; // Consecutive dividend growth years
optional double dividendsTTM = 24; // Dividend TTM (amount)
optional double payoutRatioLFY = 25; // Dividend payout ratio LFY (%)
optional string nextPayableDate = 26; // Next dividend date ("YYYY-MM-DD")
}
message S2C {
repeated DividendRankItem dataList = 1; // Data list
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType, return result
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
- For interface result, refer to RetType
Protocol ID
3407
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;
QotGetDividendRank.C2S c2s = QotGetDividendRank.C2S.newBuilder()
.setMarket(1)
.setRankType(1)
.setCount(3)
.build();
QotGetDividendRank.Request req = QotGetDividendRank.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getDividendRank(req);
System.out.printf("Send QotGetDividendRank: %d
", seqNo);
}
@Override
public void onDisconnect(FTAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d
", errCode);
}
@Override
public void onReply_GetDividendRank(FTAPI_Conn client, int nSerialNo, QotGetDividendRank.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetDividendRank failed: %s
", rsp.getRetMsg());
} else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetDividendRank: %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 QotGetDividendRank: 3
Receive QotGetDividendRank: {
"dataList": [
{ "security": { "market": 1, "code": "00288" }, "name": "万洲国际", "dividendYieldTtm": 10.569, "dividendsTtm": 0.910 },
{ "security": { "market": 1, "code": "01919" }, "name": "中远海控", "dividendYieldTtm": 8.302, "dividendsTtm": 1.125 },
{ "security": { "market": 1, "code": "01088" }, "name": "中国神华", "dividendYieldTtm": 7.578, "dividendsTtm": 3.227 }
]
}
2
3
4
5
6
7
8
Futu::u32_t GetDividendRank(const Qot_GetDividendRank::Request &stReq);
virtual void OnReply_GetDividendRank(Futu::u32_t nSerialNo, const Qot_GetDividendRank::Response &stRsp) = 0;
Description
Protocol request and response definition
Parameters
// Dividend ranking type
enum DividendRankType {
DividendRankType_Unknown = 0;
DividendRankType_HighYield = 1; // High dividend yield
DividendRankType_DividendGrowth = 2; // Dividend growth
}
// Filter condition type
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_DividendYieldTTM = 1; //[Range] Dividend yield TTM (%)
IndicatorType_AvgDividendYield5Y = 2; //[Range] 5-year avg dividend yield (%)
IndicatorType_DistributionFrequency = 3; //[Enum] Dividend frequency (1:annual, 2:semi-annual, 3:quarterly, 4:monthly)
IndicatorType_DividendGrowYear = 4; //[Range] Consecutive dividend growth years
IndicatorType_DividendsTTM = 5; //[Range] Dividend TTM (amount)
IndicatorType_PayoutRatioLFY = 6; //[Range] Dividend payout ratio LFY (%)
IndicatorType_NextPayableDate = 7; //[Range] Next dividend date (relative days)
IndicatorType_Price = 8; //[Range] Last price
IndicatorType_MarketCap = 9; //[Range] Market cap
}
// Sort field (fixed descending)
enum SortField {
SortField_Unknown = 0; // Default: HighYield→dividend yield TTM, DividendGrowth→consecutive growth years
SortField_DividendYieldTTM = 1; // Dividend yield TTM
SortField_AvgDividendYield5Y = 2; // 5-year avg dividend yield
SortField_DistributionFrequency = 3; // Dividend frequency
SortField_DividendGrowYear = 4; // Consecutive dividend growth years
SortField_DividendsTTM = 5; // Dividend TTM
SortField_PayoutRatioLFY = 6; // Dividend payout ratio LFY
SortField_Price = 7; // Price
SortField_MarketCap = 8; // Market cap
SortField_ChangeRate = 9; // Today's change
SortField_ChangeAmount = 10; // Today's price change amount
}
// Filter conditions
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2; // Filter value (use valueList for enum, valueInterval for range)
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (supports HK=1, US=11, MY=61, SG=31, JP=41 only)
required int32 rankType = 2; // DividendRankType
optional int32 count = 3; // Return count [1,300], default 10
repeated Indicator filterList = 4; // Optional filter conditions (AND relationship)
optional int32 sortField = 5; // SortField, sort field (fixed descending), default determined by rankType
}
// Dividend ranking data item
message DividendRankItem {
required Qot_Common.Security security = 1; // Stock
optional string name = 2; // Name
optional string industry = 3; // Industry
// Quote
optional double curPrice = 10; // Last price
optional double changeRate = 11; // Today's change (%)
optional double changeAmount = 12; // Today's price change amount
optional double marketCap = 13; // Market cap
// Dividend
optional double dividendYieldTTM = 20; // Dividend yield TTM (%)
optional double avgDividendYield5Y = 21; // 5-year avg dividend yield (%)
optional int32 distributionFrequency = 22; // Dividend frequency (1:annual, 2:semi-annual, 3:quarterly, 4:monthly), HK market not supported
optional int32 dividendGrowYear = 23; // Consecutive dividend growth years
optional double dividendsTTM = 24; // Dividend TTM (amount)
optional double payoutRatioLFY = 25; // Dividend payout ratio LFY (%)
optional string nextPayableDate = 26; // Next dividend date ("YYYY-MM-DD")
}
message S2C {
repeated DividendRankItem dataList = 1; // Data list
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType, return result
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
- For interface result, refer to RetType
Protocol ID
3407
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_GetDividendRank::Request req;
Qot_GetDividendRank::C2S *c2s = req.mutable_c2s();
c2s->set_market(Qot_Common::QotMarket::QotMarket_US_Security);
c2s->set_ranktype(1); // DividendRankType_HighYield
c2s->set_count(10);
m_GetDividendRankSerialNo = m_pQotApi->GetDividendRank(req);
}
virtual void OnReply_GetDividendRank(Futu::u32_t nSerialNo, const Qot_GetDividendRank::Response &stRsp) {
if (nSerialNo != m_GetDividendRankSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
FTAPI_Qot *m_pQotApi;
Futu::u32_t m_GetDividendRankSerialNo = 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
- Output
{
"retType": 0,
"retMsg": "",
"errCode": 0,
"s2c": {
"dataList": [
{
"security": {
"market": 11,
"code": "T"
},
"name": "AT&T",
"industry": "Communication",
"curPrice": 18.5,
"changeRate": 0.54,
"marketCap": 132500000000.0,
"dividendYieldTTM": 6.8
}
]
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
getDividendRank(qotGetDividendRank)
Description
Get dividend rank, returning a list of stocks in a specified market ranked by high dividend yield or consecutive dividend growth, including dividend yield, distribution frequency, consecutive growth years, and other dimensional data.
Parameters
// Dividend ranking type
enum DividendRankType {
DividendRankType_Unknown = 0;
DividendRankType_HighYield = 1; // High dividend yield
DividendRankType_DividendGrowth = 2; // Dividend growth
}
// Filter condition type
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_DividendYieldTTM = 1; //[Range] Dividend yield TTM (%)
IndicatorType_AvgDividendYield5Y = 2; //[Range] 5-year avg dividend yield (%)
IndicatorType_DistributionFrequency = 3; //[Enum] Dividend frequency (1:annual, 2:semi-annual, 3:quarterly, 4:monthly)
IndicatorType_DividendGrowYear = 4; //[Range] Consecutive dividend growth years
IndicatorType_DividendsTTM = 5; //[Range] Dividend TTM (amount)
IndicatorType_PayoutRatioLFY = 6; //[Range] Dividend payout ratio LFY (%)
IndicatorType_NextPayableDate = 7; //[Range] Next dividend date (relative days)
IndicatorType_Price = 8; //[Range] Last price
IndicatorType_MarketCap = 9; //[Range] Market cap
}
// Sort field (fixed descending)
enum SortField {
SortField_Unknown = 0; // Default: HighYield→dividend yield TTM, DividendGrowth→consecutive growth years
SortField_DividendYieldTTM = 1; // Dividend yield TTM
SortField_AvgDividendYield5Y = 2; // 5-year avg dividend yield
SortField_DistributionFrequency = 3; // Dividend frequency
SortField_DividendGrowYear = 4; // Consecutive dividend growth years
SortField_DividendsTTM = 5; // Dividend TTM
SortField_PayoutRatioLFY = 6; // Dividend payout ratio LFY
SortField_Price = 7; // Price
SortField_MarketCap = 8; // Market cap
SortField_ChangeRate = 9; // Today's change
SortField_ChangeAmount = 10; // Today's price change amount
}
// Filter conditions
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2; // Filter value (use valueList for enum, valueInterval for range)
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (supports HK=1, US=11, MY=61, SG=31, JP=41 only)
required int32 rankType = 2; // DividendRankType
optional int32 count = 3; // Return count [1,300], default 10
repeated Indicator filterList = 4; // Optional filter conditions (AND relationship)
optional int32 sortField = 5; // SortField, sort field (fixed descending), default determined by rankType
}
// Dividend ranking data item
message DividendRankItem {
required Qot_Common.Security security = 1; // Stock
optional string name = 2; // Name
optional string industry = 3; // Industry
// Quote
optional double curPrice = 10; // Last price
optional double changeRate = 11; // Today's change (%)
optional double changeAmount = 12; // Today's price change amount
optional double marketCap = 13; // Market cap
// Dividend
optional double dividendYieldTTM = 20; // Dividend yield TTM (%)
optional double avgDividendYield5Y = 21; // 5-year avg dividend yield (%)
optional int32 distributionFrequency = 22; // Dividend frequency (1:annual, 2:semi-annual, 3:quarterly, 4:monthly), HK market not supported
optional int32 dividendGrowYear = 23; // Consecutive dividend growth years
optional double dividendsTTM = 24; // Dividend TTM (amount)
optional double payoutRatioLFY = 25; // Dividend payout ratio LFY (%)
optional string nextPayableDate = 26; // Next dividend date ("YYYY-MM-DD")
}
message S2C {
repeated DividendRankItem dataList = 1; // Data list
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType, return result
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
- For interface result, refer to RetType
Protocol ID
3407
Example
import ftWebsocket from "futu-api";
import { Common, Qot_Common } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetDividendRank(){
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: 1, rankType: 1, count: 3 },
};
websocket.GetDividendRank(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetDividendRank: 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);
}
QotGetDividendRank()
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
- Output
GetDividendRank: errCode 0, retMsg , retType 0
{
"dataList": [
{ "security": { "market": 1, "code": "00288" }, "name": "万洲国际", "dividendYieldTtm": 10.569, "dividendsTtm": 0.910 },
{ "security": { "market": 1, "code": "01919" }, "name": "中远海控", "dividendYieldTtm": 8.302, "dividendsTtm": 1.125 },
{ "security": { "market": 1, "code": "01088" }, "name": "中国神华", "dividendYieldTtm": 7.578, "dividendsTtm": 3.227 }
]
}
2
3
4
5
6
7
8
API Limits
- Maximum 60 requests within 30 seconds
- Only the first page of paginated requests counts toward rate limiting
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_dividend_rank(market, rank_type, count=None, filter_list=None, sort_field=None)
Description
Get dividend rank, returning a list of stocks in a specified market ranked by high dividend yield or consecutive dividend growth, including dividend yield, distribution frequency, consecutive growth years, and other dimensional data.
Parameters
Parameter Type Description market Market Market type (supports HK/US/MY/SG/JP) (required) rank_type DividendRankType Rank type (required) count int Return count [1, 300], default 10 filter_list list[ DividendRankFilter]Filter condition list (multiple conditions are AND-combined, supports range and enum types) sort_field DividendRankSortField Sort field (fixed descending), default determined by rankType Input Limits
filter_listFilter Conditions(DividendRankFilter):Construct filter conditions via
DividendRankFilter, supporting both range and enum filters:Constructor Parameter Description indicator_typeFilter indicator type ( DividendRankIndicatorType, required)value_listEnum value list (for enum-type filters, such as dividend frequency) interval_minRange minimum (closed interval, for range filter) interval_maxRange maximum (closed interval, for range filter) Note: At least one of
value_listorinterval_min/interval_maxmust be provided.
Return
Parameter Type Description ret RET_CODE API call result data pd.DataFrame When ret == RET_OK, returns data str When ret != RET_OK, returns error description - Data format:
Field Type Description security str Stock code (e.g. 'HK.00005')name str Stock name industry str Industry cur_price float Latest price change_rate float Today's change rate (%) change_amount float Today's change amount market_cap float Market cap dividend_yield_ttm float Dividend yield TTM (%) avg_dividend_yield_5y float 5-year average dividend yield (%) distribution_frequency str Distribution frequency (ANNUAL/SEMI_ANNUAL/QUARTERLY/MONTHLY), not supported for HK market dividend_grow_year int Consecutive dividend growth years dividends_ttm float Dividends TTM (amount) payout_ratio_lfy float Dividend payout ratio LFY (%) next_payable_date str Next dividend date (e.g. '2025-09-15')
- Data format:
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_dividend_rank(market=Market.HK, rank_type=DividendRankType.HIGH_YIELD, count=2)
if ret == RET_OK:
print(data)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
- Output
security name industry cur_price change_rate change_amount market_cap dividend_yield_ttm avg_dividend_yield_5y distribution_frequency dividend_grow_year dividends_ttm payout_ratio_lfy next_payable_date
0 HK.00288 万洲国际 包装食品 8.54 -0.582 -0.05 1.095701e+11 10.655 10.855 SEMI_ANNUAL 2 0.910 116.44 N/A
1 HK.01919 中远海控 航运及港口 13.20 -1.123 -0.15 2.021314e+11 8.522 38.168 SEMI_ANNUAL 0 1.125 49.67 N/A
2
3
# Qot_GetDividendRank.proto
Description
Get dividend rank, returning a list of stocks in a specified market ranked by high dividend yield or consecutive dividend growth, including dividend yield, distribution frequency, consecutive growth years, and other dimensional data.
Parameters
// Dividend ranking type
enum DividendRankType {
DividendRankType_Unknown = 0;
DividendRankType_HighYield = 1; // High dividend yield
DividendRankType_DividendGrowth = 2; // Dividend growth
}
// Filter condition type
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_DividendYieldTTM = 1; //[Range] Dividend yield TTM (%)
IndicatorType_AvgDividendYield5Y = 2; //[Range] 5-year avg dividend yield (%)
IndicatorType_DistributionFrequency = 3; //[Enum] Dividend frequency (1:annual, 2:semi-annual, 3:quarterly, 4:monthly)
IndicatorType_DividendGrowYear = 4; //[Range] Consecutive dividend growth years
IndicatorType_DividendsTTM = 5; //[Range] Dividend TTM (amount)
IndicatorType_PayoutRatioLFY = 6; //[Range] Dividend payout ratio LFY (%)
IndicatorType_NextPayableDate = 7; //[Range] Next dividend date (relative days)
IndicatorType_Price = 8; //[Range] Last price
IndicatorType_MarketCap = 9; //[Range] Market cap
}
// Sort field (fixed descending)
enum SortField {
SortField_Unknown = 0; // Default: HighYield→dividend yield TTM, DividendGrowth→consecutive growth years
SortField_DividendYieldTTM = 1; // Dividend yield TTM
SortField_AvgDividendYield5Y = 2; // 5-year avg dividend yield
SortField_DistributionFrequency = 3; // Dividend frequency
SortField_DividendGrowYear = 4; // Consecutive dividend growth years
SortField_DividendsTTM = 5; // Dividend TTM
SortField_PayoutRatioLFY = 6; // Dividend payout ratio LFY
SortField_Price = 7; // Price
SortField_MarketCap = 8; // Market cap
SortField_ChangeRate = 9; // Today's change
SortField_ChangeAmount = 10; // Today's price change amount
}
// Filter conditions
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2; // Filter value (use valueList for enum, valueInterval for range)
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (supports HK=1, US=11, MY=61, SG=31, JP=41 only)
required int32 rankType = 2; // DividendRankType
optional int32 count = 3; // Return count [1,300], default 10
repeated Indicator filterList = 4; // Optional filter conditions (AND relationship)
optional int32 sortField = 5; // SortField, sort field (fixed descending), default determined by rankType
}
// Dividend ranking data item
message DividendRankItem {
required Qot_Common.Security security = 1; // Stock
optional string name = 2; // Name
optional string industry = 3; // Industry
// Quote
optional double curPrice = 10; // Last price
optional double changeRate = 11; // Today's change (%)
optional double changeAmount = 12; // Today's price change amount
optional double marketCap = 13; // Market cap
// Dividend
optional double dividendYieldTTM = 20; // Dividend yield TTM (%)
optional double avgDividendYield5Y = 21; // 5-year avg dividend yield (%)
optional int32 distributionFrequency = 22; // Dividend frequency (1:annual, 2:semi-annual, 3:quarterly, 4:monthly), HK market not supported
optional int32 dividendGrowYear = 23; // Consecutive dividend growth years
optional double dividendsTTM = 24; // Dividend TTM (amount)
optional double payoutRatioLFY = 25; // Dividend payout ratio LFY (%)
optional string nextPayableDate = 26; // Next dividend date ("YYYY-MM-DD")
}
message S2C {
repeated DividendRankItem dataList = 1; // Data list
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType, return result
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
Protocol ID
3407
uint GetDividendRank(Qot_GetDividendRank.Request req);
virtual void OnReply_GetDividendRank(FTAPI_Conn client, uint nSerialNo, Qot_GetDividendRank.Response rsp);
Description
Get dividend rank, returning a list of stocks in a specified market ranked by high dividend yield or consecutive dividend growth, including dividend yield, distribution frequency, consecutive growth years, and other dimensional data.
Parameters
// Dividend ranking type
enum DividendRankType {
DividendRankType_Unknown = 0;
DividendRankType_HighYield = 1; // High dividend yield
DividendRankType_DividendGrowth = 2; // Dividend growth
}
// Filter condition type
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_DividendYieldTTM = 1; //[Range] Dividend yield TTM (%)
IndicatorType_AvgDividendYield5Y = 2; //[Range] 5-year avg dividend yield (%)
IndicatorType_DistributionFrequency = 3; //[Enum] Dividend frequency (1:annual, 2:semi-annual, 3:quarterly, 4:monthly)
IndicatorType_DividendGrowYear = 4; //[Range] Consecutive dividend growth years
IndicatorType_DividendsTTM = 5; //[Range] Dividend TTM (amount)
IndicatorType_PayoutRatioLFY = 6; //[Range] Dividend payout ratio LFY (%)
IndicatorType_NextPayableDate = 7; //[Range] Next dividend date (relative days)
IndicatorType_Price = 8; //[Range] Last price
IndicatorType_MarketCap = 9; //[Range] Market cap
}
// Sort field (fixed descending)
enum SortField {
SortField_Unknown = 0; // Default: HighYield→dividend yield TTM, DividendGrowth→consecutive growth years
SortField_DividendYieldTTM = 1; // Dividend yield TTM
SortField_AvgDividendYield5Y = 2; // 5-year avg dividend yield
SortField_DistributionFrequency = 3; // Dividend frequency
SortField_DividendGrowYear = 4; // Consecutive dividend growth years
SortField_DividendsTTM = 5; // Dividend TTM
SortField_PayoutRatioLFY = 6; // Dividend payout ratio LFY
SortField_Price = 7; // Price
SortField_MarketCap = 8; // Market cap
SortField_ChangeRate = 9; // Today's change
SortField_ChangeAmount = 10; // Today's price change amount
}
// Filter conditions
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2; // Filter value (use valueList for enum, valueInterval for range)
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (supports HK=1, US=11, MY=61, SG=31, JP=41 only)
required int32 rankType = 2; // DividendRankType
optional int32 count = 3; // Return count [1,300], default 10
repeated Indicator filterList = 4; // Optional filter conditions (AND relationship)
optional int32 sortField = 5; // SortField, sort field (fixed descending), default determined by rankType
}
// Dividend ranking data item
message DividendRankItem {
required Qot_Common.Security security = 1; // Stock
optional string name = 2; // Name
optional string industry = 3; // Industry
// Quote
optional double curPrice = 10; // Last price
optional double changeRate = 11; // Today's change (%)
optional double changeAmount = 12; // Today's price change amount
optional double marketCap = 13; // Market cap
// Dividend
optional double dividendYieldTTM = 20; // Dividend yield TTM (%)
optional double avgDividendYield5Y = 21; // 5-year avg dividend yield (%)
optional int32 distributionFrequency = 22; // Dividend frequency (1:annual, 2:semi-annual, 3:quarterly, 4:monthly), HK market not supported
optional int32 dividendGrowYear = 23; // Consecutive dividend growth years
optional double dividendsTTM = 24; // Dividend TTM (amount)
optional double payoutRatioLFY = 25; // Dividend payout ratio LFY (%)
optional string nextPayableDate = 26; // Next dividend date ("YYYY-MM-DD")
}
message S2C {
repeated DividendRankItem dataList = 1; // Data list
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType, return result
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
- For interface result, refer to RetType
Protocol ID
3407
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;
QotGetDividendRank.C2S c2s = QotGetDividendRank.C2S.CreateBuilder()
.SetMarket(1)
.SetRankType(1)
.SetCount(3)
.Build();
QotGetDividendRank.Request req = QotGetDividendRank.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetDividendRank(req);
Console.Write("Send QotGetDividendRank: {0}
", seqNo);
}
public void OnDisconnect(MMAPI_Conn client, long errCode) {
Console.Write("Qot onDisConnect: {0}
", errCode);
}
public void OnReply_GetDividendRank(MMAPI_Conn client, uint nSerialNo, QotGetDividendRank.Response rsp)
{
Console.Write("Reply: QotGetDividendRank: {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 QotGetDividendRank: 3
Reply: QotGetDividendRank: 3
GetDividendRank: errCode 0, retMsg , retType 0
{
"dataList": [
{ "security": { "market": 1, "code": "00288" }, "name": "万洲国际", "dividendYieldTtm": 10.569, "dividendsTtm": 0.910 },
{ "security": { "market": 1, "code": "01919" }, "name": "中远海控", "dividendYieldTtm": 8.302, "dividendsTtm": 1.125 },
{ "security": { "market": 1, "code": "01088" }, "name": "中国神华", "dividendYieldTtm": 7.578, "dividendsTtm": 3.227 }
]
}
2
3
4
5
6
7
8
9
10
int getDividendRank(Qot_GetDividendRank.Request req);
onReply_GetDividendRank(FTAPI_Conn client, int nSerialNo, Qot_GetDividendRank.Response rsp)
Description
Get dividend rank, returning a list of stocks in a specified market ranked by high dividend yield or consecutive dividend growth, including dividend yield, distribution frequency, consecutive growth years, and other dimensional data.
Parameters
// Dividend ranking type
enum DividendRankType {
DividendRankType_Unknown = 0;
DividendRankType_HighYield = 1; // High dividend yield
DividendRankType_DividendGrowth = 2; // Dividend growth
}
// Filter condition type
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_DividendYieldTTM = 1; //[Range] Dividend yield TTM (%)
IndicatorType_AvgDividendYield5Y = 2; //[Range] 5-year avg dividend yield (%)
IndicatorType_DistributionFrequency = 3; //[Enum] Dividend frequency (1:annual, 2:semi-annual, 3:quarterly, 4:monthly)
IndicatorType_DividendGrowYear = 4; //[Range] Consecutive dividend growth years
IndicatorType_DividendsTTM = 5; //[Range] Dividend TTM (amount)
IndicatorType_PayoutRatioLFY = 6; //[Range] Dividend payout ratio LFY (%)
IndicatorType_NextPayableDate = 7; //[Range] Next dividend date (relative days)
IndicatorType_Price = 8; //[Range] Last price
IndicatorType_MarketCap = 9; //[Range] Market cap
}
// Sort field (fixed descending)
enum SortField {
SortField_Unknown = 0; // Default: HighYield→dividend yield TTM, DividendGrowth→consecutive growth years
SortField_DividendYieldTTM = 1; // Dividend yield TTM
SortField_AvgDividendYield5Y = 2; // 5-year avg dividend yield
SortField_DistributionFrequency = 3; // Dividend frequency
SortField_DividendGrowYear = 4; // Consecutive dividend growth years
SortField_DividendsTTM = 5; // Dividend TTM
SortField_PayoutRatioLFY = 6; // Dividend payout ratio LFY
SortField_Price = 7; // Price
SortField_MarketCap = 8; // Market cap
SortField_ChangeRate = 9; // Today's change
SortField_ChangeAmount = 10; // Today's price change amount
}
// Filter conditions
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2; // Filter value (use valueList for enum, valueInterval for range)
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (supports HK=1, US=11, MY=61, SG=31, JP=41 only)
required int32 rankType = 2; // DividendRankType
optional int32 count = 3; // Return count [1,300], default 10
repeated Indicator filterList = 4; // Optional filter conditions (AND relationship)
optional int32 sortField = 5; // SortField, sort field (fixed descending), default determined by rankType
}
// Dividend ranking data item
message DividendRankItem {
required Qot_Common.Security security = 1; // Stock
optional string name = 2; // Name
optional string industry = 3; // Industry
// Quote
optional double curPrice = 10; // Last price
optional double changeRate = 11; // Today's change (%)
optional double changeAmount = 12; // Today's price change amount
optional double marketCap = 13; // Market cap
// Dividend
optional double dividendYieldTTM = 20; // Dividend yield TTM (%)
optional double avgDividendYield5Y = 21; // 5-year avg dividend yield (%)
optional int32 distributionFrequency = 22; // Dividend frequency (1:annual, 2:semi-annual, 3:quarterly, 4:monthly), HK market not supported
optional int32 dividendGrowYear = 23; // Consecutive dividend growth years
optional double dividendsTTM = 24; // Dividend TTM (amount)
optional double payoutRatioLFY = 25; // Dividend payout ratio LFY (%)
optional string nextPayableDate = 26; // Next dividend date ("YYYY-MM-DD")
}
message S2C {
repeated DividendRankItem dataList = 1; // Data list
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType, return result
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
- For interface result, refer to RetType
Protocol ID
3407
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;
QotGetDividendRank.C2S c2s = QotGetDividendRank.C2S.newBuilder()
.setMarket(1)
.setRankType(1)
.setCount(3)
.build();
QotGetDividendRank.Request req = QotGetDividendRank.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getDividendRank(req);
System.out.printf("Send QotGetDividendRank: %d
", seqNo);
}
@Override
public void onDisconnect(MMAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d
", errCode);
}
@Override
public void onReply_GetDividendRank(MMAPI_Conn client, int nSerialNo, QotGetDividendRank.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetDividendRank failed: %s
", rsp.getRetMsg());
} else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetDividendRank: %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 QotGetDividendRank: 3
Receive QotGetDividendRank: {
"dataList": [
{ "security": { "market": 1, "code": "00288" }, "name": "万洲国际", "dividendYieldTtm": 10.569, "dividendsTtm": 0.910 },
{ "security": { "market": 1, "code": "01919" }, "name": "中远海控", "dividendYieldTtm": 8.302, "dividendsTtm": 1.125 },
{ "security": { "market": 1, "code": "01088" }, "name": "中国神华", "dividendYieldTtm": 7.578, "dividendsTtm": 3.227 }
]
}
2
3
4
5
6
7
8
moomoo::u32_t GetDividendRank(const Qot_GetDividendRank::Request &stReq);
virtual void OnReply_GetDividendRank(moomoo::u32_t nSerialNo, const Qot_GetDividendRank::Response &stRsp) = 0;
Description
Protocol request and response definition
Parameters
// Dividend ranking type
enum DividendRankType {
DividendRankType_Unknown = 0;
DividendRankType_HighYield = 1; // High dividend yield
DividendRankType_DividendGrowth = 2; // Dividend growth
}
// Filter condition type
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_DividendYieldTTM = 1; //[Range] Dividend yield TTM (%)
IndicatorType_AvgDividendYield5Y = 2; //[Range] 5-year avg dividend yield (%)
IndicatorType_DistributionFrequency = 3; //[Enum] Dividend frequency (1:annual, 2:semi-annual, 3:quarterly, 4:monthly)
IndicatorType_DividendGrowYear = 4; //[Range] Consecutive dividend growth years
IndicatorType_DividendsTTM = 5; //[Range] Dividend TTM (amount)
IndicatorType_PayoutRatioLFY = 6; //[Range] Dividend payout ratio LFY (%)
IndicatorType_NextPayableDate = 7; //[Range] Next dividend date (relative days)
IndicatorType_Price = 8; //[Range] Last price
IndicatorType_MarketCap = 9; //[Range] Market cap
}
// Sort field (fixed descending)
enum SortField {
SortField_Unknown = 0; // Default: HighYield→dividend yield TTM, DividendGrowth→consecutive growth years
SortField_DividendYieldTTM = 1; // Dividend yield TTM
SortField_AvgDividendYield5Y = 2; // 5-year avg dividend yield
SortField_DistributionFrequency = 3; // Dividend frequency
SortField_DividendGrowYear = 4; // Consecutive dividend growth years
SortField_DividendsTTM = 5; // Dividend TTM
SortField_PayoutRatioLFY = 6; // Dividend payout ratio LFY
SortField_Price = 7; // Price
SortField_MarketCap = 8; // Market cap
SortField_ChangeRate = 9; // Today's change
SortField_ChangeAmount = 10; // Today's price change amount
}
// Filter conditions
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2; // Filter value (use valueList for enum, valueInterval for range)
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (supports HK=1, US=11, MY=61, SG=31, JP=41 only)
required int32 rankType = 2; // DividendRankType
optional int32 count = 3; // Return count [1,300], default 10
repeated Indicator filterList = 4; // Optional filter conditions (AND relationship)
optional int32 sortField = 5; // SortField, sort field (fixed descending), default determined by rankType
}
// Dividend ranking data item
message DividendRankItem {
required Qot_Common.Security security = 1; // Stock
optional string name = 2; // Name
optional string industry = 3; // Industry
// Quote
optional double curPrice = 10; // Last price
optional double changeRate = 11; // Today's change (%)
optional double changeAmount = 12; // Today's price change amount
optional double marketCap = 13; // Market cap
// Dividend
optional double dividendYieldTTM = 20; // Dividend yield TTM (%)
optional double avgDividendYield5Y = 21; // 5-year avg dividend yield (%)
optional int32 distributionFrequency = 22; // Dividend frequency (1:annual, 2:semi-annual, 3:quarterly, 4:monthly), HK market not supported
optional int32 dividendGrowYear = 23; // Consecutive dividend growth years
optional double dividendsTTM = 24; // Dividend TTM (amount)
optional double payoutRatioLFY = 25; // Dividend payout ratio LFY (%)
optional string nextPayableDate = 26; // Next dividend date ("YYYY-MM-DD")
}
message S2C {
repeated DividendRankItem dataList = 1; // Data list
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType, return result
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
- For interface result, refer to RetType
Protocol ID
3407
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_GetDividendRank::Request req;
Qot_GetDividendRank::C2S *c2s = req.mutable_c2s();
c2s->set_market(Qot_Common::QotMarket::QotMarket_US_Security);
c2s->set_ranktype(1); // DividendRankType_HighYield
c2s->set_count(10);
m_GetDividendRankSerialNo = m_pQotApi->GetDividendRank(req);
}
virtual void OnReply_GetDividendRank(moomoo::u32_t nSerialNo, const Qot_GetDividendRank::Response &stRsp) {
if (nSerialNo != m_GetDividendRankSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
MMAPI_Qot *m_pQotApi;
moomoo::u32_t m_GetDividendRankSerialNo = 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
- Output
{
"retType": 0,
"retMsg": "",
"errCode": 0,
"s2c": {
"dataList": [
{
"security": {
"market": 11,
"code": "T"
},
"name": "AT&T",
"industry": "Communication",
"curPrice": 18.5,
"changeRate": 0.54,
"marketCap": 132500000000.0,
"dividendYieldTTM": 6.8
}
]
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
getDividendRank(qotGetDividendRank)
Description
Get dividend rank, returning a list of stocks in a specified market ranked by high dividend yield or consecutive dividend growth, including dividend yield, distribution frequency, consecutive growth years, and other dimensional data.
Parameters
// Dividend ranking type
enum DividendRankType {
DividendRankType_Unknown = 0;
DividendRankType_HighYield = 1; // High dividend yield
DividendRankType_DividendGrowth = 2; // Dividend growth
}
// Filter condition type
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_DividendYieldTTM = 1; //[Range] Dividend yield TTM (%)
IndicatorType_AvgDividendYield5Y = 2; //[Range] 5-year avg dividend yield (%)
IndicatorType_DistributionFrequency = 3; //[Enum] Dividend frequency (1:annual, 2:semi-annual, 3:quarterly, 4:monthly)
IndicatorType_DividendGrowYear = 4; //[Range] Consecutive dividend growth years
IndicatorType_DividendsTTM = 5; //[Range] Dividend TTM (amount)
IndicatorType_PayoutRatioLFY = 6; //[Range] Dividend payout ratio LFY (%)
IndicatorType_NextPayableDate = 7; //[Range] Next dividend date (relative days)
IndicatorType_Price = 8; //[Range] Last price
IndicatorType_MarketCap = 9; //[Range] Market cap
}
// Sort field (fixed descending)
enum SortField {
SortField_Unknown = 0; // Default: HighYield→dividend yield TTM, DividendGrowth→consecutive growth years
SortField_DividendYieldTTM = 1; // Dividend yield TTM
SortField_AvgDividendYield5Y = 2; // 5-year avg dividend yield
SortField_DistributionFrequency = 3; // Dividend frequency
SortField_DividendGrowYear = 4; // Consecutive dividend growth years
SortField_DividendsTTM = 5; // Dividend TTM
SortField_PayoutRatioLFY = 6; // Dividend payout ratio LFY
SortField_Price = 7; // Price
SortField_MarketCap = 8; // Market cap
SortField_ChangeRate = 9; // Today's change
SortField_ChangeAmount = 10; // Today's price change amount
}
// Filter conditions
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2; // Filter value (use valueList for enum, valueInterval for range)
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (supports HK=1, US=11, MY=61, SG=31, JP=41 only)
required int32 rankType = 2; // DividendRankType
optional int32 count = 3; // Return count [1,300], default 10
repeated Indicator filterList = 4; // Optional filter conditions (AND relationship)
optional int32 sortField = 5; // SortField, sort field (fixed descending), default determined by rankType
}
// Dividend ranking data item
message DividendRankItem {
required Qot_Common.Security security = 1; // Stock
optional string name = 2; // Name
optional string industry = 3; // Industry
// Quote
optional double curPrice = 10; // Last price
optional double changeRate = 11; // Today's change (%)
optional double changeAmount = 12; // Today's price change amount
optional double marketCap = 13; // Market cap
// Dividend
optional double dividendYieldTTM = 20; // Dividend yield TTM (%)
optional double avgDividendYield5Y = 21; // 5-year avg dividend yield (%)
optional int32 distributionFrequency = 22; // Dividend frequency (1:annual, 2:semi-annual, 3:quarterly, 4:monthly), HK market not supported
optional int32 dividendGrowYear = 23; // Consecutive dividend growth years
optional double dividendsTTM = 24; // Dividend TTM (amount)
optional double payoutRatioLFY = 25; // Dividend payout ratio LFY (%)
optional string nextPayableDate = 26; // Next dividend date ("YYYY-MM-DD")
}
message S2C {
repeated DividendRankItem dataList = 1; // Data list
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType, return result
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
- For interface result, refer to RetType
Protocol ID
3407
Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_Common } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetDividendRank(){
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: 1, rankType: 1, count: 3 },
};
websocket.GetDividendRank(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetDividendRank: 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);
}
QotGetDividendRank()
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
- Output
GetDividendRank: errCode 0, retMsg , retType 0
{
"dataList": [
{ "security": { "market": 1, "code": "00288" }, "name": "万洲国际", "dividendYieldTtm": 10.569, "dividendsTtm": 0.910 },
{ "security": { "market": 1, "code": "01919" }, "name": "中远海控", "dividendYieldTtm": 8.302, "dividendsTtm": 1.125 },
{ "security": { "market": 1, "code": "01088" }, "name": "中国神华", "dividendYieldTtm": 7.578, "dividendsTtm": 3.227 }
]
}
2
3
4
5
6
7
8
API Limits
- Maximum 60 requests within 30 seconds
- Only the first page of paginated requests counts toward rate limiting