# 配当ランキングの取得
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_dividend_rank(market, rank_type, count=None, filter_list=None, sort_field=None)
説明
配当ランキングを取得します。指定市場で高配当利回りまたは配当連続増加の銘柄ランキングリストを返します。配当利回り、配当頻度、連続増配年数等のデータを含みます。
パラメータ
パラメータ タイプ 説明 market Market 市場タイプ(HK/US/MY/SG/JP対応)(必須) rank_type DividendRankType ランキングタイプ(必須) count int 取得数量 [1, 300]、デフォルト 10 filter_list list[ DividendRankFilter]フィルター条件リスト(複数条件はAND関係、範囲型と列挙型をサポート) sort_field DividendRankSortField ソートフィールド(固定降順)、デフォルトは rankType により決定 入力制限
filter_listフィルター条件(DividendRankFilter):DividendRankFilterでフィルター条件を構築、範囲型と列挙型の2種類をサポート:コンストラクタパラメータ 説明 indicator_typeフィルター指標タイプ( DividendRankIndicatorType、必須)value_list列挙値リスト(列挙型フィルターに使用、例:配当頻度) interval_min範囲最小値(閉区間、範囲フィルターに使用) interval_max範囲最大値(閉区間、範囲フィルターに使用) 注意:
value_listとinterval_min/interval_maxのうち少なくとも1つを指定してください。
戻り値
パラメータ タイプ 説明 ret RET_CODE API呼び出し結果 data pd.DataFrame ret == RET_OK の場合、データを返す str ret != RET_OK の場合、エラー説明を返す - データフォーマット:
フィールド タイプ 説明 security str 銘柄コード(例: 'HK.00005')name str 銘柄名 industry str 所属業種 cur_price float 最新価格 change_rate float 本日騰落率(%) change_amount float 本日騰落額 market_cap float 時価総額 dividend_yield_ttm float 配当利回り TTM(%) avg_dividend_yield_5y float 5年平均配当利回り(%) distribution_frequency str 配当頻度(ANNUAL/SEMI_ANNUAL/QUARTERLY/MONTHLY)、HK市場非対応 dividend_grow_year int 配当連続増配年数 dividends_ttm float 配当 TTM(金額) payout_ratio_lfy float 配当支払率 LFY(%) next_payable_date str 次回配当日(例: '2025-09-15')
- データフォーマット:
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
説明
配当ランキングを取得します。指定市場における高配当利回りまたは配当連続増加の銘柄ランキングリストを返します。配当利回り、配当頻度、連続増加年数などの指標データを含みます。
パラメータ
// 配当ランキングタイプ
enum DividendRankType {
DividendRankType_Unknown = 0;
DividendRankType_HighYield = 1; // 高配当利回り
DividendRankType_DividendGrowth = 2; // 配当連続成長
}
// スクリーニング条件タイプ
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_DividendYieldTTM = 1; //【範囲】配当利回りTTM(%)
IndicatorType_AvgDividendYield5Y = 2; //【範囲】5年平均配当利回り(%)
IndicatorType_DistributionFrequency = 3; //【列挙】配当頻度(1:年間, 2:半年, 3:四半期, 4:月次)
IndicatorType_DividendGrowYear = 4; //【範囲】配当連続増配年数
IndicatorType_DividendsTTM = 5; //【範囲】配当TTM(金額)
IndicatorType_PayoutRatioLFY = 6; //【範囲】配当性向LFY(%)
IndicatorType_NextPayableDate = 7; //【範囲】次回配当日(相対日数)
IndicatorType_Price = 8; //【範囲】最新価格
IndicatorType_MarketCap = 9; //【範囲】時価総額
}
// ソート字段 (固定降順)
enum SortField {
SortField_Unknown = 0; // デフォルト: HighYield→股息率TTM, DividendGrowth→连续增长年数
SortField_DividendYieldTTM = 1; // 配当利回りTTM
SortField_AvgDividendYield5Y = 2; // 5年平均配当利回り
SortField_DistributionFrequency = 3; // 配当頻度
SortField_DividendGrowYear = 4; // 配当連続増配年数
SortField_DividendsTTM = 5; // 配当TTM
SortField_PayoutRatioLFY = 6; // 配当性向LFY
SortField_Price = 7; // 価格
SortField_MarketCap = 8; // 時価総額
SortField_ChangeRate = 9; // 今日騰落率
SortField_ChangeAmount = 10; // 本日騰落額
}
// スクリーニング条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2; // スクリーニング值(枚举型用valueList, 范围型用valueInterval)
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket(HK=1, US=11, MY=61, SG=31, JP=41のみ対応)
required int32 rankType = 2; // DividendRankType
optional int32 count = 3; // 戻り値数量 [1,300], デフォルト10
repeated Indicator filterList = 4; // 可选スクリーニング条件(AND关系)
optional int32 sortField = 5; // SortField, ソート字段(固定降順), デフォルト由rankType决定
}
// 配当ランキングデータ項目
message DividendRankItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional string industry = 3; // 業種
// 相場
optional double curPrice = 10; // 最新値
optional double changeRate = 11; // 今日騰落率 (%)
optional double changeAmount = 12; // 本日騰落額
optional double marketCap = 13; // 時価総額
// 配当
optional double dividendYieldTTM = 20; // 配当利回りTTM(%)
optional double avgDividendYield5Y = 21; // 5年平均配当利回り(%)
optional int32 distributionFrequency = 22; // 派息频率 (1:年派, 2:半年派, 3:季派, 4:月派),不支持HKマーケット
optional int32 dividendGrowYear = 23; // 配当連続増配年数
optional double dividendsTTM = 24; // 配当TTM(金額)
optional double payoutRatioLFY = 25; // 配当性向LFY(%)
optional string nextPayableDate = 26; // 次回配当日("YYYY-MM-DD")
}
message S2C {
repeated DividendRankItem dataList = 1; // データリスト
}
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
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
プロトコルID
3407
uint GetDividendRank(Qot_GetDividendRank.Request req);
virtual void OnReply_GetDividendRank(FTAPI_Conn client, uint nSerialNo, Qot_GetDividendRank.Response rsp);
説明
配当ランキングを取得します。指定市場における高配当利回りまたは配当連続増加の銘柄ランキングリストを返します。配当利回り、配当頻度、連続増加年数などの指標データを含みます。
パラメータ
// 配当ランキングタイプ
enum DividendRankType {
DividendRankType_Unknown = 0;
DividendRankType_HighYield = 1; // 高配当利回り
DividendRankType_DividendGrowth = 2; // 配当連続成長
}
// スクリーニング条件タイプ
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_DividendYieldTTM = 1; //【範囲】配当利回りTTM(%)
IndicatorType_AvgDividendYield5Y = 2; //【範囲】5年平均配当利回り(%)
IndicatorType_DistributionFrequency = 3; //【列挙】配当頻度(1:年間, 2:半年, 3:四半期, 4:月次)
IndicatorType_DividendGrowYear = 4; //【範囲】配当連続増配年数
IndicatorType_DividendsTTM = 5; //【範囲】配当TTM(金額)
IndicatorType_PayoutRatioLFY = 6; //【範囲】配当性向LFY(%)
IndicatorType_NextPayableDate = 7; //【範囲】次回配当日(相対日数)
IndicatorType_Price = 8; //【範囲】最新価格
IndicatorType_MarketCap = 9; //【範囲】時価総額
}
// ソート字段 (固定降順)
enum SortField {
SortField_Unknown = 0; // デフォルト: HighYield→股息率TTM, DividendGrowth→连续增长年数
SortField_DividendYieldTTM = 1; // 配当利回りTTM
SortField_AvgDividendYield5Y = 2; // 5年平均配当利回り
SortField_DistributionFrequency = 3; // 配当頻度
SortField_DividendGrowYear = 4; // 配当連続増配年数
SortField_DividendsTTM = 5; // 配当TTM
SortField_PayoutRatioLFY = 6; // 配当性向LFY
SortField_Price = 7; // 価格
SortField_MarketCap = 8; // 時価総額
SortField_ChangeRate = 9; // 今日騰落率
SortField_ChangeAmount = 10; // 本日騰落額
}
// スクリーニング条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2; // スクリーニング值(枚举型用valueList, 范围型用valueInterval)
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket(HK=1, US=11, MY=61, SG=31, JP=41のみ対応)
required int32 rankType = 2; // DividendRankType
optional int32 count = 3; // 戻り値数量 [1,300], デフォルト10
repeated Indicator filterList = 4; // 可选スクリーニング条件(AND关系)
optional int32 sortField = 5; // SortField, ソート字段(固定降順), デフォルト由rankType决定
}
// 配当ランキングデータ項目
message DividendRankItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional string industry = 3; // 業種
// 相場
optional double curPrice = 10; // 最新値
optional double changeRate = 11; // 今日騰落率 (%)
optional double changeAmount = 12; // 本日騰落額
optional double marketCap = 13; // 時価総額
// 配当
optional double dividendYieldTTM = 20; // 配当利回りTTM(%)
optional double avgDividendYield5Y = 21; // 5年平均配当利回り(%)
optional int32 distributionFrequency = 22; // 派息频率 (1:年派, 2:半年派, 3:季派, 4:月派),不支持HKマーケット
optional int32 dividendGrowYear = 23; // 配当連続増配年数
optional double dividendsTTM = 24; // 配当TTM(金額)
optional double payoutRatioLFY = 25; // 配当性向LFY(%)
optional string nextPayableDate = 26; // 次回配当日("YYYY-MM-DD")
}
message S2C {
repeated DividendRankItem dataList = 1; // データリスト
}
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
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
- API呼び出し結果、構造体については以下を参照 RetType
プロトコル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)
説明
配当ランキングを取得します。指定市場における高配当利回りまたは配当連続増加の銘柄ランキングリストを返します。配当利回り、配当頻度、連続増加年数などの指標データを含みます。
パラメータ
// 配当ランキングタイプ
enum DividendRankType {
DividendRankType_Unknown = 0;
DividendRankType_HighYield = 1; // 高配当利回り
DividendRankType_DividendGrowth = 2; // 配当連続成長
}
// スクリーニング条件タイプ
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_DividendYieldTTM = 1; //【範囲】配当利回りTTM(%)
IndicatorType_AvgDividendYield5Y = 2; //【範囲】5年平均配当利回り(%)
IndicatorType_DistributionFrequency = 3; //【列挙】配当頻度(1:年間, 2:半年, 3:四半期, 4:月次)
IndicatorType_DividendGrowYear = 4; //【範囲】配当連続増配年数
IndicatorType_DividendsTTM = 5; //【範囲】配当TTM(金額)
IndicatorType_PayoutRatioLFY = 6; //【範囲】配当性向LFY(%)
IndicatorType_NextPayableDate = 7; //【範囲】次回配当日(相対日数)
IndicatorType_Price = 8; //【範囲】最新価格
IndicatorType_MarketCap = 9; //【範囲】時価総額
}
// ソート字段 (固定降順)
enum SortField {
SortField_Unknown = 0; // デフォルト: HighYield→股息率TTM, DividendGrowth→连续增长年数
SortField_DividendYieldTTM = 1; // 配当利回りTTM
SortField_AvgDividendYield5Y = 2; // 5年平均配当利回り
SortField_DistributionFrequency = 3; // 配当頻度
SortField_DividendGrowYear = 4; // 配当連続増配年数
SortField_DividendsTTM = 5; // 配当TTM
SortField_PayoutRatioLFY = 6; // 配当性向LFY
SortField_Price = 7; // 価格
SortField_MarketCap = 8; // 時価総額
SortField_ChangeRate = 9; // 今日騰落率
SortField_ChangeAmount = 10; // 本日騰落額
}
// スクリーニング条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2; // スクリーニング值(枚举型用valueList, 范围型用valueInterval)
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket(HK=1, US=11, MY=61, SG=31, JP=41のみ対応)
required int32 rankType = 2; // DividendRankType
optional int32 count = 3; // 戻り値数量 [1,300], デフォルト10
repeated Indicator filterList = 4; // 可选スクリーニング条件(AND关系)
optional int32 sortField = 5; // SortField, ソート字段(固定降順), デフォルト由rankType决定
}
// 配当ランキングデータ項目
message DividendRankItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional string industry = 3; // 業種
// 相場
optional double curPrice = 10; // 最新値
optional double changeRate = 11; // 今日騰落率 (%)
optional double changeAmount = 12; // 本日騰落額
optional double marketCap = 13; // 時価総額
// 配当
optional double dividendYieldTTM = 20; // 配当利回りTTM(%)
optional double avgDividendYield5Y = 21; // 5年平均配当利回り(%)
optional int32 distributionFrequency = 22; // 派息频率 (1:年派, 2:半年派, 3:季派, 4:月派),不支持HKマーケット
optional int32 dividendGrowYear = 23; // 配当連続増配年数
optional double dividendsTTM = 24; // 配当TTM(金額)
optional double payoutRatioLFY = 25; // 配当性向LFY(%)
optional string nextPayableDate = 26; // 次回配当日("YYYY-MM-DD")
}
message S2C {
repeated DividendRankItem dataList = 1; // データリスト
}
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
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
- API呼び出し結果、構造体については以下を参照 RetType
プロトコル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;
概要
プロトコルリクエストとレスポンスの定義
パラメータ
// 配当ランキングタイプ
enum DividendRankType {
DividendRankType_Unknown = 0;
DividendRankType_HighYield = 1; // 高配当利回り
DividendRankType_DividendGrowth = 2; // 配当連続成長
}
// スクリーニング条件タイプ
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_DividendYieldTTM = 1; //【範囲】配当利回りTTM(%)
IndicatorType_AvgDividendYield5Y = 2; //【範囲】5年平均配当利回り(%)
IndicatorType_DistributionFrequency = 3; //【列挙】配当頻度(1:年間, 2:半年, 3:四半期, 4:月次)
IndicatorType_DividendGrowYear = 4; //【範囲】配当連続増配年数
IndicatorType_DividendsTTM = 5; //【範囲】配当TTM(金額)
IndicatorType_PayoutRatioLFY = 6; //【範囲】配当性向LFY(%)
IndicatorType_NextPayableDate = 7; //【範囲】次回配当日(相対日数)
IndicatorType_Price = 8; //【範囲】最新価格
IndicatorType_MarketCap = 9; //【範囲】時価総額
}
// ソート字段 (固定降順)
enum SortField {
SortField_Unknown = 0; // デフォルト: HighYield→股息率TTM, DividendGrowth→连续增长年数
SortField_DividendYieldTTM = 1; // 配当利回りTTM
SortField_AvgDividendYield5Y = 2; // 5年平均配当利回り
SortField_DistributionFrequency = 3; // 配当頻度
SortField_DividendGrowYear = 4; // 配当連続増配年数
SortField_DividendsTTM = 5; // 配当TTM
SortField_PayoutRatioLFY = 6; // 配当性向LFY
SortField_Price = 7; // 価格
SortField_MarketCap = 8; // 時価総額
SortField_ChangeRate = 9; // 今日騰落率
SortField_ChangeAmount = 10; // 本日騰落額
}
// スクリーニング条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2; // スクリーニング值(枚举型用valueList, 范围型用valueInterval)
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket(HK=1, US=11, MY=61, SG=31, JP=41のみ対応)
required int32 rankType = 2; // DividendRankType
optional int32 count = 3; // 戻り値数量 [1,300], デフォルト10
repeated Indicator filterList = 4; // 可选スクリーニング条件(AND关系)
optional int32 sortField = 5; // SortField, ソート字段(固定降順), デフォルト由rankType决定
}
// 配当ランキングデータ項目
message DividendRankItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional string industry = 3; // 業種
// 相場
optional double curPrice = 10; // 最新値
optional double changeRate = 11; // 今日騰落率 (%)
optional double changeAmount = 12; // 本日騰落額
optional double marketCap = 13; // 時価総額
// 配当
optional double dividendYieldTTM = 20; // 配当利回りTTM(%)
optional double avgDividendYield5Y = 21; // 5年平均配当利回り(%)
optional int32 distributionFrequency = 22; // 派息频率 (1:年派, 2:半年派, 3:季派, 4:月派),不支持HKマーケット
optional int32 dividendGrowYear = 23; // 配当連続増配年数
optional double dividendsTTM = 24; // 配当TTM(金額)
optional double payoutRatioLFY = 25; // 配当性向LFY(%)
optional string nextPayableDate = 26; // 次回配当日("YYYY-MM-DD")
}
message S2C {
repeated DividendRankItem dataList = 1; // データリスト
}
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
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
- API 呼び出し結果,構造は~を参照: RetType
プロトコル 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)
説明
配当ランキングを取得します。指定市場における高配当利回りまたは配当連続増加の銘柄ランキングリストを返します。配当利回り、配当頻度、連続増加年数などの指標データを含みます。
パラメータ
// 配当ランキングタイプ
enum DividendRankType {
DividendRankType_Unknown = 0;
DividendRankType_HighYield = 1; // 高配当利回り
DividendRankType_DividendGrowth = 2; // 配当連続成長
}
// スクリーニング条件タイプ
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_DividendYieldTTM = 1; //【範囲】配当利回りTTM(%)
IndicatorType_AvgDividendYield5Y = 2; //【範囲】5年平均配当利回り(%)
IndicatorType_DistributionFrequency = 3; //【列挙】配当頻度(1:年間, 2:半年, 3:四半期, 4:月次)
IndicatorType_DividendGrowYear = 4; //【範囲】配当連続増配年数
IndicatorType_DividendsTTM = 5; //【範囲】配当TTM(金額)
IndicatorType_PayoutRatioLFY = 6; //【範囲】配当性向LFY(%)
IndicatorType_NextPayableDate = 7; //【範囲】次回配当日(相対日数)
IndicatorType_Price = 8; //【範囲】最新価格
IndicatorType_MarketCap = 9; //【範囲】時価総額
}
// ソート字段 (固定降順)
enum SortField {
SortField_Unknown = 0; // デフォルト: HighYield→股息率TTM, DividendGrowth→连续增长年数
SortField_DividendYieldTTM = 1; // 配当利回りTTM
SortField_AvgDividendYield5Y = 2; // 5年平均配当利回り
SortField_DistributionFrequency = 3; // 配当頻度
SortField_DividendGrowYear = 4; // 配当連続増配年数
SortField_DividendsTTM = 5; // 配当TTM
SortField_PayoutRatioLFY = 6; // 配当性向LFY
SortField_Price = 7; // 価格
SortField_MarketCap = 8; // 時価総額
SortField_ChangeRate = 9; // 今日騰落率
SortField_ChangeAmount = 10; // 本日騰落額
}
// スクリーニング条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2; // スクリーニング值(枚举型用valueList, 范围型用valueInterval)
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket(HK=1, US=11, MY=61, SG=31, JP=41のみ対応)
required int32 rankType = 2; // DividendRankType
optional int32 count = 3; // 戻り値数量 [1,300], デフォルト10
repeated Indicator filterList = 4; // 可选スクリーニング条件(AND关系)
optional int32 sortField = 5; // SortField, ソート字段(固定降順), デフォルト由rankType决定
}
// 配当ランキングデータ項目
message DividendRankItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional string industry = 3; // 業種
// 相場
optional double curPrice = 10; // 最新値
optional double changeRate = 11; // 今日騰落率 (%)
optional double changeAmount = 12; // 本日騰落額
optional double marketCap = 13; // 時価総額
// 配当
optional double dividendYieldTTM = 20; // 配当利回りTTM(%)
optional double avgDividendYield5Y = 21; // 5年平均配当利回り(%)
optional int32 distributionFrequency = 22; // 派息频率 (1:年派, 2:半年派, 3:季派, 4:月派),不支持HKマーケット
optional int32 dividendGrowYear = 23; // 配当連続増配年数
optional double dividendsTTM = 24; // 配当TTM(金額)
optional double payoutRatioLFY = 25; // 配当性向LFY(%)
optional string nextPayableDate = 26; // 次回配当日("YYYY-MM-DD")
}
message S2C {
repeated DividendRankItem dataList = 1; // データリスト
}
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
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
- API呼び出し結果、構造体については以下を参照 RetType
プロトコル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制限
- 30秒以内に最大60回のリクエストが可能です
- ページネーションリクエストは最初のページのみレート制限にカウントされます
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_dividend_rank(market, rank_type, count=None, filter_list=None, sort_field=None)
説明
配当ランキングを取得します。指定市場で高配当利回りまたは配当連続増加の銘柄ランキングリストを返します。配当利回り、配当頻度、連続増配年数等のデータを含みます。
パラメータ
パラメータ タイプ 説明 market Market 市場タイプ(HK/US/MY/SG/JP対応)(必須) rank_type DividendRankType ランキングタイプ(必須) count int 取得数量 [1, 300]、デフォルト 10 filter_list list[ DividendRankFilter]フィルター条件リスト(複数条件はAND関係、範囲型と列挙型をサポート) sort_field DividendRankSortField ソートフィールド(固定降順)、デフォルトは rankType により決定 入力制限
filter_listフィルター条件(DividendRankFilter):DividendRankFilterでフィルター条件を構築、範囲型と列挙型の2種類をサポート:コンストラクタパラメータ 説明 indicator_typeフィルター指標タイプ( DividendRankIndicatorType、必須)value_list列挙値リスト(列挙型フィルターに使用、例:配当頻度) interval_min範囲最小値(閉区間、範囲フィルターに使用) interval_max範囲最大値(閉区間、範囲フィルターに使用) 注意:
value_listとinterval_min/interval_maxのうち少なくとも1つを指定してください。
戻り値
パラメータ タイプ 説明 ret RET_CODE API呼び出し結果 data pd.DataFrame ret == RET_OK の場合、データを返す str ret != RET_OK の場合、エラー説明を返す - データフォーマット:
フィールド タイプ 説明 security str 銘柄コード(例: 'HK.00005')name str 銘柄名 industry str 所属業種 cur_price float 最新価格 change_rate float 本日騰落率(%) change_amount float 本日騰落額 market_cap float 時価総額 dividend_yield_ttm float 配当利回り TTM(%) avg_dividend_yield_5y float 5年平均配当利回り(%) distribution_frequency str 配当頻度(ANNUAL/SEMI_ANNUAL/QUARTERLY/MONTHLY)、HK市場非対応 dividend_grow_year int 配当連続増配年数 dividends_ttm float 配当 TTM(金額) payout_ratio_lfy float 配当支払率 LFY(%) next_payable_date str 次回配当日(例: '2025-09-15')
- データフォーマット:
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
説明
配当ランキングを取得します。指定市場における高配当利回りまたは配当連続増加の銘柄ランキングリストを返します。配当利回り、配当頻度、連続増加年数などの指標データを含みます。
パラメータ
// 配当ランキングタイプ
enum DividendRankType {
DividendRankType_Unknown = 0;
DividendRankType_HighYield = 1; // 高配当利回り
DividendRankType_DividendGrowth = 2; // 配当連続成長
}
// スクリーニング条件タイプ
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_DividendYieldTTM = 1; //【範囲】配当利回りTTM(%)
IndicatorType_AvgDividendYield5Y = 2; //【範囲】5年平均配当利回り(%)
IndicatorType_DistributionFrequency = 3; //【列挙】配当頻度(1:年間, 2:半年, 3:四半期, 4:月次)
IndicatorType_DividendGrowYear = 4; //【範囲】配当連続増配年数
IndicatorType_DividendsTTM = 5; //【範囲】配当TTM(金額)
IndicatorType_PayoutRatioLFY = 6; //【範囲】配当性向LFY(%)
IndicatorType_NextPayableDate = 7; //【範囲】次回配当日(相対日数)
IndicatorType_Price = 8; //【範囲】最新価格
IndicatorType_MarketCap = 9; //【範囲】時価総額
}
// ソート字段 (固定降順)
enum SortField {
SortField_Unknown = 0; // デフォルト: HighYield→股息率TTM, DividendGrowth→连续增长年数
SortField_DividendYieldTTM = 1; // 配当利回りTTM
SortField_AvgDividendYield5Y = 2; // 5年平均配当利回り
SortField_DistributionFrequency = 3; // 配当頻度
SortField_DividendGrowYear = 4; // 配当連続増配年数
SortField_DividendsTTM = 5; // 配当TTM
SortField_PayoutRatioLFY = 6; // 配当性向LFY
SortField_Price = 7; // 価格
SortField_MarketCap = 8; // 時価総額
SortField_ChangeRate = 9; // 今日騰落率
SortField_ChangeAmount = 10; // 本日騰落額
}
// スクリーニング条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2; // スクリーニング值(枚举型用valueList, 范围型用valueInterval)
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket(HK=1, US=11, MY=61, SG=31, JP=41のみ対応)
required int32 rankType = 2; // DividendRankType
optional int32 count = 3; // 戻り値数量 [1,300], デフォルト10
repeated Indicator filterList = 4; // 可选スクリーニング条件(AND关系)
optional int32 sortField = 5; // SortField, ソート字段(固定降順), デフォルト由rankType决定
}
// 配当ランキングデータ項目
message DividendRankItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional string industry = 3; // 業種
// 相場
optional double curPrice = 10; // 最新値
optional double changeRate = 11; // 今日騰落率 (%)
optional double changeAmount = 12; // 本日騰落額
optional double marketCap = 13; // 時価総額
// 配当
optional double dividendYieldTTM = 20; // 配当利回りTTM(%)
optional double avgDividendYield5Y = 21; // 5年平均配当利回り(%)
optional int32 distributionFrequency = 22; // 派息频率 (1:年派, 2:半年派, 3:季派, 4:月派),不支持HKマーケット
optional int32 dividendGrowYear = 23; // 配当連続増配年数
optional double dividendsTTM = 24; // 配当TTM(金額)
optional double payoutRatioLFY = 25; // 配当性向LFY(%)
optional string nextPayableDate = 26; // 次回配当日("YYYY-MM-DD")
}
message S2C {
repeated DividendRankItem dataList = 1; // データリスト
}
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
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
プロトコルID
3407
uint GetDividendRank(Qot_GetDividendRank.Request req);
virtual void OnReply_GetDividendRank(FTAPI_Conn client, uint nSerialNo, Qot_GetDividendRank.Response rsp);
説明
配当ランキングを取得します。指定市場における高配当利回りまたは配当連続増加の銘柄ランキングリストを返します。配当利回り、配当頻度、連続増加年数などの指標データを含みます。
パラメータ
// 配当ランキングタイプ
enum DividendRankType {
DividendRankType_Unknown = 0;
DividendRankType_HighYield = 1; // 高配当利回り
DividendRankType_DividendGrowth = 2; // 配当連続成長
}
// スクリーニング条件タイプ
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_DividendYieldTTM = 1; //【範囲】配当利回りTTM(%)
IndicatorType_AvgDividendYield5Y = 2; //【範囲】5年平均配当利回り(%)
IndicatorType_DistributionFrequency = 3; //【列挙】配当頻度(1:年間, 2:半年, 3:四半期, 4:月次)
IndicatorType_DividendGrowYear = 4; //【範囲】配当連続増配年数
IndicatorType_DividendsTTM = 5; //【範囲】配当TTM(金額)
IndicatorType_PayoutRatioLFY = 6; //【範囲】配当性向LFY(%)
IndicatorType_NextPayableDate = 7; //【範囲】次回配当日(相対日数)
IndicatorType_Price = 8; //【範囲】最新価格
IndicatorType_MarketCap = 9; //【範囲】時価総額
}
// ソート字段 (固定降順)
enum SortField {
SortField_Unknown = 0; // デフォルト: HighYield→股息率TTM, DividendGrowth→连续增长年数
SortField_DividendYieldTTM = 1; // 配当利回りTTM
SortField_AvgDividendYield5Y = 2; // 5年平均配当利回り
SortField_DistributionFrequency = 3; // 配当頻度
SortField_DividendGrowYear = 4; // 配当連続増配年数
SortField_DividendsTTM = 5; // 配当TTM
SortField_PayoutRatioLFY = 6; // 配当性向LFY
SortField_Price = 7; // 価格
SortField_MarketCap = 8; // 時価総額
SortField_ChangeRate = 9; // 今日騰落率
SortField_ChangeAmount = 10; // 本日騰落額
}
// スクリーニング条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2; // スクリーニング值(枚举型用valueList, 范围型用valueInterval)
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket(HK=1, US=11, MY=61, SG=31, JP=41のみ対応)
required int32 rankType = 2; // DividendRankType
optional int32 count = 3; // 戻り値数量 [1,300], デフォルト10
repeated Indicator filterList = 4; // 可选スクリーニング条件(AND关系)
optional int32 sortField = 5; // SortField, ソート字段(固定降順), デフォルト由rankType决定
}
// 配当ランキングデータ項目
message DividendRankItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional string industry = 3; // 業種
// 相場
optional double curPrice = 10; // 最新値
optional double changeRate = 11; // 今日騰落率 (%)
optional double changeAmount = 12; // 本日騰落額
optional double marketCap = 13; // 時価総額
// 配当
optional double dividendYieldTTM = 20; // 配当利回りTTM(%)
optional double avgDividendYield5Y = 21; // 5年平均配当利回り(%)
optional int32 distributionFrequency = 22; // 派息频率 (1:年派, 2:半年派, 3:季派, 4:月派),不支持HKマーケット
optional int32 dividendGrowYear = 23; // 配当連続増配年数
optional double dividendsTTM = 24; // 配当TTM(金額)
optional double payoutRatioLFY = 25; // 配当性向LFY(%)
optional string nextPayableDate = 26; // 次回配当日("YYYY-MM-DD")
}
message S2C {
repeated DividendRankItem dataList = 1; // データリスト
}
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
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
- API呼び出し結果、構造体については以下を参照 RetType
プロトコル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)
説明
配当ランキングを取得します。指定市場における高配当利回りまたは配当連続増加の銘柄ランキングリストを返します。配当利回り、配当頻度、連続増加年数などの指標データを含みます。
パラメータ
// 配当ランキングタイプ
enum DividendRankType {
DividendRankType_Unknown = 0;
DividendRankType_HighYield = 1; // 高配当利回り
DividendRankType_DividendGrowth = 2; // 配当連続成長
}
// スクリーニング条件タイプ
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_DividendYieldTTM = 1; //【範囲】配当利回りTTM(%)
IndicatorType_AvgDividendYield5Y = 2; //【範囲】5年平均配当利回り(%)
IndicatorType_DistributionFrequency = 3; //【列挙】配当頻度(1:年間, 2:半年, 3:四半期, 4:月次)
IndicatorType_DividendGrowYear = 4; //【範囲】配当連続増配年数
IndicatorType_DividendsTTM = 5; //【範囲】配当TTM(金額)
IndicatorType_PayoutRatioLFY = 6; //【範囲】配当性向LFY(%)
IndicatorType_NextPayableDate = 7; //【範囲】次回配当日(相対日数)
IndicatorType_Price = 8; //【範囲】最新価格
IndicatorType_MarketCap = 9; //【範囲】時価総額
}
// ソート字段 (固定降順)
enum SortField {
SortField_Unknown = 0; // デフォルト: HighYield→股息率TTM, DividendGrowth→连续增长年数
SortField_DividendYieldTTM = 1; // 配当利回りTTM
SortField_AvgDividendYield5Y = 2; // 5年平均配当利回り
SortField_DistributionFrequency = 3; // 配当頻度
SortField_DividendGrowYear = 4; // 配当連続増配年数
SortField_DividendsTTM = 5; // 配当TTM
SortField_PayoutRatioLFY = 6; // 配当性向LFY
SortField_Price = 7; // 価格
SortField_MarketCap = 8; // 時価総額
SortField_ChangeRate = 9; // 今日騰落率
SortField_ChangeAmount = 10; // 本日騰落額
}
// スクリーニング条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2; // スクリーニング值(枚举型用valueList, 范围型用valueInterval)
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket(HK=1, US=11, MY=61, SG=31, JP=41のみ対応)
required int32 rankType = 2; // DividendRankType
optional int32 count = 3; // 戻り値数量 [1,300], デフォルト10
repeated Indicator filterList = 4; // 可选スクリーニング条件(AND关系)
optional int32 sortField = 5; // SortField, ソート字段(固定降順), デフォルト由rankType决定
}
// 配当ランキングデータ項目
message DividendRankItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional string industry = 3; // 業種
// 相場
optional double curPrice = 10; // 最新値
optional double changeRate = 11; // 今日騰落率 (%)
optional double changeAmount = 12; // 本日騰落額
optional double marketCap = 13; // 時価総額
// 配当
optional double dividendYieldTTM = 20; // 配当利回りTTM(%)
optional double avgDividendYield5Y = 21; // 5年平均配当利回り(%)
optional int32 distributionFrequency = 22; // 派息频率 (1:年派, 2:半年派, 3:季派, 4:月派),不支持HKマーケット
optional int32 dividendGrowYear = 23; // 配当連続増配年数
optional double dividendsTTM = 24; // 配当TTM(金額)
optional double payoutRatioLFY = 25; // 配当性向LFY(%)
optional string nextPayableDate = 26; // 次回配当日("YYYY-MM-DD")
}
message S2C {
repeated DividendRankItem dataList = 1; // データリスト
}
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
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
- API呼び出し結果、構造体については以下を参照 RetType
プロトコル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;
概要
プロトコルリクエストとレスポンスの定義
パラメータ
// 配当ランキングタイプ
enum DividendRankType {
DividendRankType_Unknown = 0;
DividendRankType_HighYield = 1; // 高配当利回り
DividendRankType_DividendGrowth = 2; // 配当連続成長
}
// スクリーニング条件タイプ
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_DividendYieldTTM = 1; //【範囲】配当利回りTTM(%)
IndicatorType_AvgDividendYield5Y = 2; //【範囲】5年平均配当利回り(%)
IndicatorType_DistributionFrequency = 3; //【列挙】配当頻度(1:年間, 2:半年, 3:四半期, 4:月次)
IndicatorType_DividendGrowYear = 4; //【範囲】配当連続増配年数
IndicatorType_DividendsTTM = 5; //【範囲】配当TTM(金額)
IndicatorType_PayoutRatioLFY = 6; //【範囲】配当性向LFY(%)
IndicatorType_NextPayableDate = 7; //【範囲】次回配当日(相対日数)
IndicatorType_Price = 8; //【範囲】最新価格
IndicatorType_MarketCap = 9; //【範囲】時価総額
}
// ソート字段 (固定降順)
enum SortField {
SortField_Unknown = 0; // デフォルト: HighYield→股息率TTM, DividendGrowth→连续增长年数
SortField_DividendYieldTTM = 1; // 配当利回りTTM
SortField_AvgDividendYield5Y = 2; // 5年平均配当利回り
SortField_DistributionFrequency = 3; // 配当頻度
SortField_DividendGrowYear = 4; // 配当連続増配年数
SortField_DividendsTTM = 5; // 配当TTM
SortField_PayoutRatioLFY = 6; // 配当性向LFY
SortField_Price = 7; // 価格
SortField_MarketCap = 8; // 時価総額
SortField_ChangeRate = 9; // 今日騰落率
SortField_ChangeAmount = 10; // 本日騰落額
}
// スクリーニング条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2; // スクリーニング值(枚举型用valueList, 范围型用valueInterval)
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket(HK=1, US=11, MY=61, SG=31, JP=41のみ対応)
required int32 rankType = 2; // DividendRankType
optional int32 count = 3; // 戻り値数量 [1,300], デフォルト10
repeated Indicator filterList = 4; // 可选スクリーニング条件(AND关系)
optional int32 sortField = 5; // SortField, ソート字段(固定降順), デフォルト由rankType决定
}
// 配当ランキングデータ項目
message DividendRankItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional string industry = 3; // 業種
// 相場
optional double curPrice = 10; // 最新値
optional double changeRate = 11; // 今日騰落率 (%)
optional double changeAmount = 12; // 本日騰落額
optional double marketCap = 13; // 時価総額
// 配当
optional double dividendYieldTTM = 20; // 配当利回りTTM(%)
optional double avgDividendYield5Y = 21; // 5年平均配当利回り(%)
optional int32 distributionFrequency = 22; // 派息频率 (1:年派, 2:半年派, 3:季派, 4:月派),不支持HKマーケット
optional int32 dividendGrowYear = 23; // 配当連続増配年数
optional double dividendsTTM = 24; // 配当TTM(金額)
optional double payoutRatioLFY = 25; // 配当性向LFY(%)
optional string nextPayableDate = 26; // 次回配当日("YYYY-MM-DD")
}
message S2C {
repeated DividendRankItem dataList = 1; // データリスト
}
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
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
- API 呼び出し結果,構造は~を参照: RetType
プロトコル 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)
説明
配当ランキングを取得します。指定市場における高配当利回りまたは配当連続増加の銘柄ランキングリストを返します。配当利回り、配当頻度、連続増加年数などの指標データを含みます。
パラメータ
// 配当ランキングタイプ
enum DividendRankType {
DividendRankType_Unknown = 0;
DividendRankType_HighYield = 1; // 高配当利回り
DividendRankType_DividendGrowth = 2; // 配当連続成長
}
// スクリーニング条件タイプ
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_DividendYieldTTM = 1; //【範囲】配当利回りTTM(%)
IndicatorType_AvgDividendYield5Y = 2; //【範囲】5年平均配当利回り(%)
IndicatorType_DistributionFrequency = 3; //【列挙】配当頻度(1:年間, 2:半年, 3:四半期, 4:月次)
IndicatorType_DividendGrowYear = 4; //【範囲】配当連続増配年数
IndicatorType_DividendsTTM = 5; //【範囲】配当TTM(金額)
IndicatorType_PayoutRatioLFY = 6; //【範囲】配当性向LFY(%)
IndicatorType_NextPayableDate = 7; //【範囲】次回配当日(相対日数)
IndicatorType_Price = 8; //【範囲】最新価格
IndicatorType_MarketCap = 9; //【範囲】時価総額
}
// ソート字段 (固定降順)
enum SortField {
SortField_Unknown = 0; // デフォルト: HighYield→股息率TTM, DividendGrowth→连续增长年数
SortField_DividendYieldTTM = 1; // 配当利回りTTM
SortField_AvgDividendYield5Y = 2; // 5年平均配当利回り
SortField_DistributionFrequency = 3; // 配当頻度
SortField_DividendGrowYear = 4; // 配当連続増配年数
SortField_DividendsTTM = 5; // 配当TTM
SortField_PayoutRatioLFY = 6; // 配当性向LFY
SortField_Price = 7; // 価格
SortField_MarketCap = 8; // 時価総額
SortField_ChangeRate = 9; // 今日騰落率
SortField_ChangeAmount = 10; // 本日騰落額
}
// スクリーニング条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2; // スクリーニング值(枚举型用valueList, 范围型用valueInterval)
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket(HK=1, US=11, MY=61, SG=31, JP=41のみ対応)
required int32 rankType = 2; // DividendRankType
optional int32 count = 3; // 戻り値数量 [1,300], デフォルト10
repeated Indicator filterList = 4; // 可选スクリーニング条件(AND关系)
optional int32 sortField = 5; // SortField, ソート字段(固定降順), デフォルト由rankType决定
}
// 配当ランキングデータ項目
message DividendRankItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional string industry = 3; // 業種
// 相場
optional double curPrice = 10; // 最新値
optional double changeRate = 11; // 今日騰落率 (%)
optional double changeAmount = 12; // 本日騰落額
optional double marketCap = 13; // 時価総額
// 配当
optional double dividendYieldTTM = 20; // 配当利回りTTM(%)
optional double avgDividendYield5Y = 21; // 5年平均配当利回り(%)
optional int32 distributionFrequency = 22; // 派息频率 (1:年派, 2:半年派, 3:季派, 4:月派),不支持HKマーケット
optional int32 dividendGrowYear = 23; // 配当連続増配年数
optional double dividendsTTM = 24; // 配当TTM(金額)
optional double payoutRatioLFY = 25; // 配当性向LFY(%)
optional string nextPayableDate = 26; // 次回配当日("YYYY-MM-DD")
}
message S2C {
repeated DividendRankItem dataList = 1; // データリスト
}
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
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
- API呼び出し結果、構造体については以下を参照 RetType
プロトコル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制限
- 30秒以内に最大60回のリクエストが可能です
- ページネーションリクエストは最初のページのみレート制限にカウントされます