# 業績予想上振れランキングの取得
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_earnings_beat_rank(market, beat_type, count=None, term=None, filter_list=None, sort_field=None)
説明
業績予想上振れランキングを取得します。指定市場で決算実績値が予想値を上回る銘柄ランキングリストを返します。予想上振れ率、決算発表翌日騰落率、前年同期比成長率等のデータを含みます。
パラメータ
パラメータ タイプ 説明 market Market 市場タイプ(HK/US/SG/JP対応)(必須) beat_type BeatType 予想上振れタイプ(必須) count int 取得数量 [1, 300]、デフォルト 30 term BeatTerm 決算期間(例: '2024/Q1')filter_list list[ EarningsBeatRankFilter]フィルター条件リスト(複数条件はAND関係) sort_field EarningsBeatSortField ソートフィールド(固定降順)、デフォルト時価総額 入力制限
filter_listフィルター条件(EarningsBeatRankFilter):EarningsBeatRankFilterでフィルター条件を構築、範囲フィルターのみサポート:コンストラクタパラメータ 説明 indicator_typeフィルター指標タイプ( EarningsBeatIndicatorType、必須)interval_min範囲最小値(閉区間) interval_max範囲最大値(閉区間) filter_list未指定時はデフォルトフィルターを適用:予想超過率 > 0、発表日が直近30日以内。
戻り値
パラメータ タイプ 説明 ret RET_CODE API呼び出し結果 data pd.DataFrame ret == RET_OK の場合、(all_count, DataFrame) タプルを返す str ret != RET_OK の場合、エラー説明を返す - データフォーマット:
フィールド タイプ 説明 security str 銘柄コード(例 'US.AAPL')name str 銘柄名 industry str 所属業種 cur_price float 最新価格 last_close_price float 前日終値 change_rate float 本日騰落率(%) market_cap float 時価総額 pe_ttm float PER TTM dividends_ttm float 配当利回り TTM(%) released_date str 決算発表日(例: '2024-01-15')beat_ratio float 予想上振れ率(%) actual float 実績値 estimate float 予想値 yoy float 前年同期 yoy_growth float 前年同期比成長率(%) earning_day_chg float 決算発表翌日騰落率(%) term str 決算期間(例: '2024/Q1')detail_post_period str 発表時間帯(BEFORE=プレマーケット / AFTER=アフターマーケット / REGULAR=当日 / INTRADAY_TRADING=日中)
- データフォーマット:
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_earnings_beat_rank(market=Market.US, beat_type=BeatType.EPS, count=2)
if ret == RET_OK:
all_count, df = data
print(f'データ総数: {all_count}')
print(df)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
- Output
データ総数: 1276
security name industry cur_price last_close_price change_rate market_cap pe_ttm dividends_ttm released_date beat_ratio actual estimate yoy yoy_growth earning_day_chg term detail_post_period
0 US.NVDA 英伟达 半导体 200.04 208.65 -4.126 4.840968e+12 30.63399 0.019 2026-05-20 37.253 2.3900 1.7413 0.76 214.473 -1.772 2027/Q1 AFTER
1 US.AAPL 苹果 消费电子产品 294.30 297.01 -0.912 4.322489e+12 35.62953 0.353 2026-04-30 3.373 2.0099 1.9444 1.65 21.818 3.239 2026/Q2 AFTER
2
3
4
# Qot_GetEarningsBeatRank.proto
説明
決算サプライズランキングを取得します。指定市場において決算実績値が予想値を上回った銘柄のランキングリストを返します。サプライズ比率、決算後初日の騰落率、前年比成長率などの指標データを含みます。
パラメータ
// 決算予想超えタイプ
enum BeatType {
BeatType_Unknown = 0;
BeatType_EPS = 1; // EPS(1株当たり利益)
BeatType_REVENUE = 2; // 売上高
BeatType_EBIT = 3; // EBIT(税引前利益)
}
// 決算期
enum BeatTerm {
BeatTerm_Latest = 0; // 最近一期 (デフォルト)
BeatTerm_LatestQuarter = 1; // 直近四半期報告
BeatTerm_LatestHalf = 2; // 直近半年報告
BeatTerm_LatestAnnual = 3; // 直近年次報告
BeatTerm_All = 4; // 全部(時間一样季报优先,時間不同最近一期)
}
// スクリーニング条件タイプ
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_BeatRatio = 1; //【範囲】予想上振れ比率
IndicatorType_ReleasedDate = 2; //【范围】发布時間(時間戳秒)
IndicatorType_MarketCap = 3; //【範囲】時価総額
IndicatorType_Price = 4; //【範囲】最新価格
IndicatorType_PeTTM = 5; //【范围】PER(株価収益率)TTM
}
// ソート字段 (固定降順)
enum SortField {
SortField_Unknown = 0; // デフォルト按市值ソート
SortField_BeatRatio = 1; // 予想上振れ比率
SortField_EarningDayChg = 2; // 決算発表翌日騰落率
SortField_ReleasedDate = 3; // 発表時間
SortField_Actual = 4; // 実績値
SortField_Estimate = 5; // 予測値
SortField_Yoy = 6; // 前年同期
SortField_YoyGrowth = 7; // 前年同期比成長率
SortField_PeTTM = 8; // PER(株価収益率)TTM
SortField_DividendsTTM = 9; // 配当利回りTTM
SortField_Price = 10; // 価格
SortField_ChangeRate = 11; // 今日騰落率
}
// 決算発表時間帯
enum PostPeriodType {
PostPeriodType_Regular = 0; // 当日(時間帯未判定)
PostPeriodType_Before = 1; // プレマーケット
PostPeriodType_After = 2; // アフターマーケット
PostPeriodType_IntradayTrading = 3; // ザラ場
}
// スクリーニング条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.Interval indicatorValue = 2; // スクリーニング範囲
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket(HK=1, US=11, SG=31, JP=41のみ対応)
required int32 beatType = 2; // BeatType
optional int32 count = 3; // 戻り値数量 [1,300], デフォルト30
optional int32 term = 4; // BeatTerm, デフォルト All
repeated Indicator filterList = 5; // 可选スクリーニング条件(AND关系), 不传则使用デフォルト值(超预期>0, 時間=最近30天)
optional int32 sortField = 6; // SortField, ソート字段(固定降順), デフォルト按市值
}
// 決算予想超えランキングデータ項目
message EarningsBeatItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional string industry = 3; // 業種
// 相場
optional double curPrice = 10; // 最新値
optional double lastClosePrice = 11; // 前日終値
optional double changeRate = 12; // 今日騰落率 (%)
optional double marketCap = 13; // 時価総額
optional double peTTM = 14; // PER(株価収益率)TTM
optional double dividendsTTM = 15; // 配当利回りTTM(%)
// 決算予想超え
optional string releasedDate = 20; // 发布日付 (如 "2024-01-15")
optional double beatRatio = 21; // 予想上振れ比率(%)
optional double actual = 22; // 実績値
optional double estimate = 23; // 予測値
optional double yoy = 24; // 前年同期
optional double yoyGrowth = 25; // 前年同期比成長率(%)
optional double earningDayChg = 26; // 決算発表翌日騰落率(%)
optional string term = 27; // 決算期(例:"2024/Q1")
optional int32 detailPostPeriod = 28; // PostPeriodType、発表時間帯
}
message S2C {
repeated EarningsBeatItem dataList = 1; // データリスト
optional int32 allCount = 2; // データ総数
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType、戻り値
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
プロトコルID
3406
uint GetEarningsBeatRank(Qot_GetEarningsBeatRank.Request req);
virtual void OnReply_GetEarningsBeatRank(FTAPI_Conn client, uint nSerialNo, Qot_GetEarningsBeatRank.Response rsp);
説明
決算サプライズランキングを取得します。指定市場において決算実績値が予想値を上回った銘柄のランキングリストを返します。サプライズ比率、決算後初日の騰落率、前年比成長率などの指標データを含みます。
パラメータ
// 決算予想超えタイプ
enum BeatType {
BeatType_Unknown = 0;
BeatType_EPS = 1; // EPS(1株当たり利益)
BeatType_REVENUE = 2; // 売上高
BeatType_EBIT = 3; // EBIT(税引前利益)
}
// 決算期
enum BeatTerm {
BeatTerm_Latest = 0; // 最近一期 (デフォルト)
BeatTerm_LatestQuarter = 1; // 直近四半期報告
BeatTerm_LatestHalf = 2; // 直近半年報告
BeatTerm_LatestAnnual = 3; // 直近年次報告
BeatTerm_All = 4; // 全部(時間一样季报优先,時間不同最近一期)
}
// スクリーニング条件タイプ
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_BeatRatio = 1; //【範囲】予想上振れ比率
IndicatorType_ReleasedDate = 2; //【范围】发布時間(時間戳秒)
IndicatorType_MarketCap = 3; //【範囲】時価総額
IndicatorType_Price = 4; //【範囲】最新価格
IndicatorType_PeTTM = 5; //【范围】PER(株価収益率)TTM
}
// ソート字段 (固定降順)
enum SortField {
SortField_Unknown = 0; // デフォルト按市值ソート
SortField_BeatRatio = 1; // 予想上振れ比率
SortField_EarningDayChg = 2; // 決算発表翌日騰落率
SortField_ReleasedDate = 3; // 発表時間
SortField_Actual = 4; // 実績値
SortField_Estimate = 5; // 予測値
SortField_Yoy = 6; // 前年同期
SortField_YoyGrowth = 7; // 前年同期比成長率
SortField_PeTTM = 8; // PER(株価収益率)TTM
SortField_DividendsTTM = 9; // 配当利回りTTM
SortField_Price = 10; // 価格
SortField_ChangeRate = 11; // 今日騰落率
}
// 決算発表時間帯
enum PostPeriodType {
PostPeriodType_Regular = 0; // 当日(時間帯未判定)
PostPeriodType_Before = 1; // プレマーケット
PostPeriodType_After = 2; // アフターマーケット
PostPeriodType_IntradayTrading = 3; // ザラ場
}
// スクリーニング条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.Interval indicatorValue = 2; // スクリーニング範囲
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket(HK=1, US=11, SG=31, JP=41のみ対応)
required int32 beatType = 2; // BeatType
optional int32 count = 3; // 戻り値数量 [1,300], デフォルト30
optional int32 term = 4; // BeatTerm, デフォルト All
repeated Indicator filterList = 5; // 可选スクリーニング条件(AND关系), 不传则使用デフォルト值(超预期>0, 時間=最近30天)
optional int32 sortField = 6; // SortField, ソート字段(固定降順), デフォルト按市值
}
// 決算予想超えランキングデータ項目
message EarningsBeatItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional string industry = 3; // 業種
// 相場
optional double curPrice = 10; // 最新値
optional double lastClosePrice = 11; // 前日終値
optional double changeRate = 12; // 今日騰落率 (%)
optional double marketCap = 13; // 時価総額
optional double peTTM = 14; // PER(株価収益率)TTM
optional double dividendsTTM = 15; // 配当利回りTTM(%)
// 決算予想超え
optional string releasedDate = 20; // 发布日付 (如 "2024-01-15")
optional double beatRatio = 21; // 予想上振れ比率(%)
optional double actual = 22; // 実績値
optional double estimate = 23; // 予測値
optional double yoy = 24; // 前年同期
optional double yoyGrowth = 25; // 前年同期比成長率(%)
optional double earningDayChg = 26; // 決算発表翌日騰落率(%)
optional string term = 27; // 決算期(例:"2024/Q1")
optional int32 detailPostPeriod = 28; // PostPeriodType、発表時間帯
}
message S2C {
repeated EarningsBeatItem dataList = 1; // データリスト
optional int32 allCount = 2; // データ総数
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType、戻り値
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
- API呼び出し結果、構造体については以下を参照 RetType
プロトコルID
3406
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;
QotGetEarningsBeatRank.C2S c2s = QotGetEarningsBeatRank.C2S.CreateBuilder()
.SetMarket(11)
.SetBeatType(1)
.SetCount(3)
.Build();
QotGetEarningsBeatRank.Request req = QotGetEarningsBeatRank.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetEarningsBeatRank(req);
Console.Write("Send QotGetEarningsBeatRank: {0}
", seqNo);
}
public void OnDisconnect(FTAPI_Conn client, long errCode) {
Console.Write("Qot onDisConnect: {0}
", errCode);
}
public void OnReply_GetEarningsBeatRank(FTAPI_Conn client, uint nSerialNo, QotGetEarningsBeatRank.Response rsp)
{
Console.Write("Reply: QotGetEarningsBeatRank: {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 QotGetEarningsBeatRank: 3
Reply: QotGetEarningsBeatRank: 3
GetEarningsBeatRank: errCode 0, retMsg , retType 0
{
"allCount": 1282,
"dataList": [
{ "security": { "market": 11, "code": "NVDA" }, "name": "英伟达", "beatRatio": 37.253, "earningDayChg": -1.772 },
{ "security": { "market": 11, "code": "GOOGL" }, "name": "谷歌-A", "beatRatio": 91.593, "earningDayChg": 9.961 },
{ "security": { "market": 11, "code": "GOOG" }, "name": "谷歌-C", "beatRatio": 91.593, "earningDayChg": 9.970 }
]
}
2
3
4
5
6
7
8
9
10
11
int getEarningsBeatRank(Qot_GetEarningsBeatRank.Request req);
onReply_GetEarningsBeatRank(FTAPI_Conn client, int nSerialNo, Qot_GetEarningsBeatRank.Response rsp)
説明
決算サプライズランキングを取得します。指定市場において決算実績値が予想値を上回った銘柄のランキングリストを返します。サプライズ比率、決算後初日の騰落率、前年比成長率などの指標データを含みます。
パラメータ
// 決算予想超えタイプ
enum BeatType {
BeatType_Unknown = 0;
BeatType_EPS = 1; // EPS(1株当たり利益)
BeatType_REVENUE = 2; // 売上高
BeatType_EBIT = 3; // EBIT(税引前利益)
}
// 決算期
enum BeatTerm {
BeatTerm_Latest = 0; // 最近一期 (デフォルト)
BeatTerm_LatestQuarter = 1; // 直近四半期報告
BeatTerm_LatestHalf = 2; // 直近半年報告
BeatTerm_LatestAnnual = 3; // 直近年次報告
BeatTerm_All = 4; // 全部(時間一样季报优先,時間不同最近一期)
}
// スクリーニング条件タイプ
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_BeatRatio = 1; //【範囲】予想上振れ比率
IndicatorType_ReleasedDate = 2; //【范围】发布時間(時間戳秒)
IndicatorType_MarketCap = 3; //【範囲】時価総額
IndicatorType_Price = 4; //【範囲】最新価格
IndicatorType_PeTTM = 5; //【范围】PER(株価収益率)TTM
}
// ソート字段 (固定降順)
enum SortField {
SortField_Unknown = 0; // デフォルト按市值ソート
SortField_BeatRatio = 1; // 予想上振れ比率
SortField_EarningDayChg = 2; // 決算発表翌日騰落率
SortField_ReleasedDate = 3; // 発表時間
SortField_Actual = 4; // 実績値
SortField_Estimate = 5; // 予測値
SortField_Yoy = 6; // 前年同期
SortField_YoyGrowth = 7; // 前年同期比成長率
SortField_PeTTM = 8; // PER(株価収益率)TTM
SortField_DividendsTTM = 9; // 配当利回りTTM
SortField_Price = 10; // 価格
SortField_ChangeRate = 11; // 今日騰落率
}
// 決算発表時間帯
enum PostPeriodType {
PostPeriodType_Regular = 0; // 当日(時間帯未判定)
PostPeriodType_Before = 1; // プレマーケット
PostPeriodType_After = 2; // アフターマーケット
PostPeriodType_IntradayTrading = 3; // ザラ場
}
// スクリーニング条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.Interval indicatorValue = 2; // スクリーニング範囲
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket(HK=1, US=11, SG=31, JP=41のみ対応)
required int32 beatType = 2; // BeatType
optional int32 count = 3; // 戻り値数量 [1,300], デフォルト30
optional int32 term = 4; // BeatTerm, デフォルト All
repeated Indicator filterList = 5; // 可选スクリーニング条件(AND关系), 不传则使用デフォルト值(超预期>0, 時間=最近30天)
optional int32 sortField = 6; // SortField, ソート字段(固定降順), デフォルト按市值
}
// 決算予想超えランキングデータ項目
message EarningsBeatItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional string industry = 3; // 業種
// 相場
optional double curPrice = 10; // 最新値
optional double lastClosePrice = 11; // 前日終値
optional double changeRate = 12; // 今日騰落率 (%)
optional double marketCap = 13; // 時価総額
optional double peTTM = 14; // PER(株価収益率)TTM
optional double dividendsTTM = 15; // 配当利回りTTM(%)
// 決算予想超え
optional string releasedDate = 20; // 发布日付 (如 "2024-01-15")
optional double beatRatio = 21; // 予想上振れ比率(%)
optional double actual = 22; // 実績値
optional double estimate = 23; // 予測値
optional double yoy = 24; // 前年同期
optional double yoyGrowth = 25; // 前年同期比成長率(%)
optional double earningDayChg = 26; // 決算発表翌日騰落率(%)
optional string term = 27; // 決算期(例:"2024/Q1")
optional int32 detailPostPeriod = 28; // PostPeriodType、発表時間帯
}
message S2C {
repeated EarningsBeatItem dataList = 1; // データリスト
optional int32 allCount = 2; // データ総数
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType、戻り値
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
- API呼び出し結果、構造体については以下を参照 RetType
プロトコルID
3406
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;
QotGetEarningsBeatRank.C2S c2s = QotGetEarningsBeatRank.C2S.newBuilder()
.setMarket(11)
.setBeatType(1)
.setCount(3)
.build();
QotGetEarningsBeatRank.Request req = QotGetEarningsBeatRank.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getEarningsBeatRank(req);
System.out.printf("Send QotGetEarningsBeatRank: %d
", seqNo);
}
@Override
public void onDisconnect(FTAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d
", errCode);
}
@Override
public void onReply_GetEarningsBeatRank(FTAPI_Conn client, int nSerialNo, QotGetEarningsBeatRank.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetEarningsBeatRank failed: %s
", rsp.getRetMsg());
} else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetEarningsBeatRank: %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 QotGetEarningsBeatRank: 3
Receive QotGetEarningsBeatRank: {
"allCount": 1282,
"dataList": [
{ "security": { "market": 11, "code": "NVDA" }, "name": "英伟达", "beatRatio": 37.253, "earningDayChg": -1.772 },
{ "security": { "market": 11, "code": "GOOGL" }, "name": "谷歌-A", "beatRatio": 91.593, "earningDayChg": 9.961 },
{ "security": { "market": 11, "code": "GOOG" }, "name": "谷歌-C", "beatRatio": 91.593, "earningDayChg": 9.970 }
]
}
2
3
4
5
6
7
8
9
Futu::u32_t GetEarningsBeatRank(const Qot_GetEarningsBeatRank::Request &stReq);
virtual void OnReply_GetEarningsBeatRank(Futu::u32_t nSerialNo, const Qot_GetEarningsBeatRank::Response &stRsp) = 0;
概要
プロトコルリクエストとレスポンスの定義
パラメータ
// 決算予想超えタイプ
enum BeatType {
BeatType_Unknown = 0;
BeatType_EPS = 1; // EPS(1株当たり利益)
BeatType_REVENUE = 2; // 売上高
BeatType_EBIT = 3; // EBIT(税引前利益)
}
// 決算期
enum BeatTerm {
BeatTerm_Latest = 0; // 最近一期 (デフォルト)
BeatTerm_LatestQuarter = 1; // 直近四半期報告
BeatTerm_LatestHalf = 2; // 直近半年報告
BeatTerm_LatestAnnual = 3; // 直近年次報告
BeatTerm_All = 4; // 全部(時間一样季报优先,時間不同最近一期)
}
// スクリーニング条件タイプ
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_BeatRatio = 1; //【範囲】予想上振れ比率
IndicatorType_ReleasedDate = 2; //【范围】发布時間(時間戳秒)
IndicatorType_MarketCap = 3; //【範囲】時価総額
IndicatorType_Price = 4; //【範囲】最新価格
IndicatorType_PeTTM = 5; //【范围】PER(株価収益率)TTM
}
// ソート字段 (固定降順)
enum SortField {
SortField_Unknown = 0; // デフォルト按市值ソート
SortField_BeatRatio = 1; // 予想上振れ比率
SortField_EarningDayChg = 2; // 決算発表翌日騰落率
SortField_ReleasedDate = 3; // 発表時間
SortField_Actual = 4; // 実績値
SortField_Estimate = 5; // 予測値
SortField_Yoy = 6; // 前年同期
SortField_YoyGrowth = 7; // 前年同期比成長率
SortField_PeTTM = 8; // PER(株価収益率)TTM
SortField_DividendsTTM = 9; // 配当利回りTTM
SortField_Price = 10; // 価格
SortField_ChangeRate = 11; // 今日騰落率
}
// 決算発表時間帯
enum PostPeriodType {
PostPeriodType_Regular = 0; // 当日(時間帯未判定)
PostPeriodType_Before = 1; // プレマーケット
PostPeriodType_After = 2; // アフターマーケット
PostPeriodType_IntradayTrading = 3; // ザラ場
}
// スクリーニング条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.Interval indicatorValue = 2; // スクリーニング範囲
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket(HK=1, US=11, SG=31, JP=41のみ対応)
required int32 beatType = 2; // BeatType
optional int32 count = 3; // 戻り値数量 [1,300], デフォルト30
optional int32 term = 4; // BeatTerm, デフォルト All
repeated Indicator filterList = 5; // 可选スクリーニング条件(AND关系), 不传则使用デフォルト值(超预期>0, 時間=最近30天)
optional int32 sortField = 6; // SortField, ソート字段(固定降順), デフォルト按市值
}
// 決算予想超えランキングデータ項目
message EarningsBeatItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional string industry = 3; // 業種
// 相場
optional double curPrice = 10; // 最新値
optional double lastClosePrice = 11; // 前日終値
optional double changeRate = 12; // 今日騰落率 (%)
optional double marketCap = 13; // 時価総額
optional double peTTM = 14; // PER(株価収益率)TTM
optional double dividendsTTM = 15; // 配当利回りTTM(%)
// 決算予想超え
optional string releasedDate = 20; // 发布日付 (如 "2024-01-15")
optional double beatRatio = 21; // 予想上振れ比率(%)
optional double actual = 22; // 実績値
optional double estimate = 23; // 予測値
optional double yoy = 24; // 前年同期
optional double yoyGrowth = 25; // 前年同期比成長率(%)
optional double earningDayChg = 26; // 決算発表翌日騰落率(%)
optional string term = 27; // 決算期(例:"2024/Q1")
optional int32 detailPostPeriod = 28; // PostPeriodType、発表時間帯
}
message S2C {
repeated EarningsBeatItem dataList = 1; // データリスト
optional int32 allCount = 2; // データ総数
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType、戻り値
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
- API 呼び出し結果,構造は~を参照: RetType
プロトコル ID
3406
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_GetEarningsBeatRank::Request req;
Qot_GetEarningsBeatRank::C2S *c2s = req.mutable_c2s();
c2s->set_market(Qot_Common::QotMarket::QotMarket_US_Security);
c2s->set_beattype(1); // BeatType_EPS
c2s->set_count(30);
m_GetEarningsBeatRankSerialNo = m_pQotApi->GetEarningsBeatRank(req);
}
virtual void OnReply_GetEarningsBeatRank(Futu::u32_t nSerialNo, const Qot_GetEarningsBeatRank::Response &stRsp) {
if (nSerialNo != m_GetEarningsBeatRankSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
FTAPI_Qot *m_pQotApi;
Futu::u32_t m_GetEarningsBeatRankSerialNo = 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": "NVDA"
},
"name": "NVIDIA",
"industry": "Semiconductor",
"curPrice": 875.4,
"changeRate": 9.32,
"marketCap": 2150000000000.0,
"peTTM": 65.2
}
],
"allCount": 30
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
getEarningsBeatRank(qotGetEarningsBeatRank)
説明
決算サプライズランキングを取得します。指定市場において決算実績値が予想値を上回った銘柄のランキングリストを返します。サプライズ比率、決算後初日の騰落率、前年比成長率などの指標データを含みます。
パラメータ
// 決算予想超えタイプ
enum BeatType {
BeatType_Unknown = 0;
BeatType_EPS = 1; // EPS(1株当たり利益)
BeatType_REVENUE = 2; // 売上高
BeatType_EBIT = 3; // EBIT(税引前利益)
}
// 決算期
enum BeatTerm {
BeatTerm_Latest = 0; // 最近一期 (デフォルト)
BeatTerm_LatestQuarter = 1; // 直近四半期報告
BeatTerm_LatestHalf = 2; // 直近半年報告
BeatTerm_LatestAnnual = 3; // 直近年次報告
BeatTerm_All = 4; // 全部(時間一样季报优先,時間不同最近一期)
}
// スクリーニング条件タイプ
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_BeatRatio = 1; //【範囲】予想上振れ比率
IndicatorType_ReleasedDate = 2; //【范围】发布時間(時間戳秒)
IndicatorType_MarketCap = 3; //【範囲】時価総額
IndicatorType_Price = 4; //【範囲】最新価格
IndicatorType_PeTTM = 5; //【范围】PER(株価収益率)TTM
}
// ソート字段 (固定降順)
enum SortField {
SortField_Unknown = 0; // デフォルト按市值ソート
SortField_BeatRatio = 1; // 予想上振れ比率
SortField_EarningDayChg = 2; // 決算発表翌日騰落率
SortField_ReleasedDate = 3; // 発表時間
SortField_Actual = 4; // 実績値
SortField_Estimate = 5; // 予測値
SortField_Yoy = 6; // 前年同期
SortField_YoyGrowth = 7; // 前年同期比成長率
SortField_PeTTM = 8; // PER(株価収益率)TTM
SortField_DividendsTTM = 9; // 配当利回りTTM
SortField_Price = 10; // 価格
SortField_ChangeRate = 11; // 今日騰落率
}
// 決算発表時間帯
enum PostPeriodType {
PostPeriodType_Regular = 0; // 当日(時間帯未判定)
PostPeriodType_Before = 1; // プレマーケット
PostPeriodType_After = 2; // アフターマーケット
PostPeriodType_IntradayTrading = 3; // ザラ場
}
// スクリーニング条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.Interval indicatorValue = 2; // スクリーニング範囲
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket(HK=1, US=11, SG=31, JP=41のみ対応)
required int32 beatType = 2; // BeatType
optional int32 count = 3; // 戻り値数量 [1,300], デフォルト30
optional int32 term = 4; // BeatTerm, デフォルト All
repeated Indicator filterList = 5; // 可选スクリーニング条件(AND关系), 不传则使用デフォルト值(超预期>0, 時間=最近30天)
optional int32 sortField = 6; // SortField, ソート字段(固定降順), デフォルト按市值
}
// 決算予想超えランキングデータ項目
message EarningsBeatItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional string industry = 3; // 業種
// 相場
optional double curPrice = 10; // 最新値
optional double lastClosePrice = 11; // 前日終値
optional double changeRate = 12; // 今日騰落率 (%)
optional double marketCap = 13; // 時価総額
optional double peTTM = 14; // PER(株価収益率)TTM
optional double dividendsTTM = 15; // 配当利回りTTM(%)
// 決算予想超え
optional string releasedDate = 20; // 发布日付 (如 "2024-01-15")
optional double beatRatio = 21; // 予想上振れ比率(%)
optional double actual = 22; // 実績値
optional double estimate = 23; // 予測値
optional double yoy = 24; // 前年同期
optional double yoyGrowth = 25; // 前年同期比成長率(%)
optional double earningDayChg = 26; // 決算発表翌日騰落率(%)
optional string term = 27; // 決算期(例:"2024/Q1")
optional int32 detailPostPeriod = 28; // PostPeriodType、発表時間帯
}
message S2C {
repeated EarningsBeatItem dataList = 1; // データリスト
optional int32 allCount = 2; // データ総数
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType、戻り値
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
- API呼び出し結果、構造体については以下を参照 RetType
プロトコルID
3406
Example
import ftWebsocket from "futu-api";
import { Common, Qot_Common } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetEarningsBeatRank(){
const { RetType } = Common
let [addr, port, enable_ssl, key] = ["127.0.0.1", 11111, false, "xxxxxx"];
let websocket = new ftWebsocket();
websocket.onlogin = (ret, msg)=>{
if (ret) {
const req = {
c2s: { market: 11, beatType: 1, count: 3 },
};
websocket.GetEarningsBeatRank(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetEarningsBeatRank: 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);
}
QotGetEarningsBeatRank()
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
GetEarningsBeatRank: errCode 0, retMsg , retType 0
{
"allCount": 1282,
"dataList": [
{ "security": { "market": 11, "code": "NVDA" }, "name": "英伟达", "beatRatio": 37.253, "earningDayChg": -1.772 },
{ "security": { "market": 11, "code": "GOOGL" }, "name": "谷歌-A", "beatRatio": 91.593, "earningDayChg": 9.961 },
{ "security": { "market": 11, "code": "GOOG" }, "name": "谷歌-C", "beatRatio": 91.593, "earningDayChg": 9.970 }
]
}
2
3
4
5
6
7
8
9
API制限
- 30秒以内に最大60回のリクエストが可能です
- ページネーションリクエストは最初のページのみレート制限にカウントされます
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_earnings_beat_rank(market, beat_type, count=None, term=None, filter_list=None, sort_field=None)
説明
業績予想上振れランキングを取得します。指定市場で決算実績値が予想値を上回る銘柄ランキングリストを返します。予想上振れ率、決算発表翌日騰落率、前年同期比成長率等のデータを含みます。
パラメータ
パラメータ タイプ 説明 market Market 市場タイプ(HK/US/SG/JP対応)(必須) beat_type BeatType 予想上振れタイプ(必須) count int 取得数量 [1, 300]、デフォルト 30 term BeatTerm 決算期間(例: '2024/Q1')filter_list list[ EarningsBeatRankFilter]フィルター条件リスト(複数条件はAND関係) sort_field EarningsBeatSortField ソートフィールド(固定降順)、デフォルト時価総額 入力制限
filter_listフィルター条件(EarningsBeatRankFilter):EarningsBeatRankFilterでフィルター条件を構築、範囲フィルターのみサポート:コンストラクタパラメータ 説明 indicator_typeフィルター指標タイプ( EarningsBeatIndicatorType、必須)interval_min範囲最小値(閉区間) interval_max範囲最大値(閉区間) filter_list未指定時はデフォルトフィルターを適用:予想超過率 > 0、発表日が直近30日以内。
戻り値
パラメータ タイプ 説明 ret RET_CODE API呼び出し結果 data pd.DataFrame ret == RET_OK の場合、(all_count, DataFrame) タプルを返す str ret != RET_OK の場合、エラー説明を返す - データフォーマット:
フィールド タイプ 説明 security str 銘柄コード(例 'US.AAPL')name str 銘柄名 industry str 所属業種 cur_price float 最新価格 last_close_price float 前日終値 change_rate float 本日騰落率(%) market_cap float 時価総額 pe_ttm float PER TTM dividends_ttm float 配当利回り TTM(%) released_date str 決算発表日(例: '2024-01-15')beat_ratio float 予想上振れ率(%) actual float 実績値 estimate float 予想値 yoy float 前年同期 yoy_growth float 前年同期比成長率(%) earning_day_chg float 決算発表翌日騰落率(%) term str 決算期間(例: '2024/Q1')detail_post_period str 発表時間帯(BEFORE=プレマーケット / AFTER=アフターマーケット / REGULAR=当日 / INTRADAY_TRADING=日中)
- データフォーマット:
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_earnings_beat_rank(market=Market.US, beat_type=BeatType.EPS, count=2)
if ret == RET_OK:
all_count, df = data
print(f'データ総数: {all_count}')
print(df)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
- Output
データ総数: 1276
security name industry cur_price last_close_price change_rate market_cap pe_ttm dividends_ttm released_date beat_ratio actual estimate yoy yoy_growth earning_day_chg term detail_post_period
0 US.NVDA 英伟达 半导体 200.04 208.65 -4.126 4.840968e+12 30.63399 0.019 2026-05-20 37.253 2.3900 1.7413 0.76 214.473 -1.772 2027/Q1 AFTER
1 US.AAPL 苹果 消费电子产品 294.30 297.01 -0.912 4.322489e+12 35.62953 0.353 2026-04-30 3.373 2.0099 1.9444 1.65 21.818 3.239 2026/Q2 AFTER
2
3
4
# Qot_GetEarningsBeatRank.proto
説明
決算サプライズランキングを取得します。指定市場において決算実績値が予想値を上回った銘柄のランキングリストを返します。サプライズ比率、決算後初日の騰落率、前年比成長率などの指標データを含みます。
パラメータ
// 決算予想超えタイプ
enum BeatType {
BeatType_Unknown = 0;
BeatType_EPS = 1; // EPS(1株当たり利益)
BeatType_REVENUE = 2; // 売上高
BeatType_EBIT = 3; // EBIT(税引前利益)
}
// 決算期
enum BeatTerm {
BeatTerm_Latest = 0; // 最近一期 (デフォルト)
BeatTerm_LatestQuarter = 1; // 直近四半期報告
BeatTerm_LatestHalf = 2; // 直近半年報告
BeatTerm_LatestAnnual = 3; // 直近年次報告
BeatTerm_All = 4; // 全部(時間一样季报优先,時間不同最近一期)
}
// スクリーニング条件タイプ
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_BeatRatio = 1; //【範囲】予想上振れ比率
IndicatorType_ReleasedDate = 2; //【范围】发布時間(時間戳秒)
IndicatorType_MarketCap = 3; //【範囲】時価総額
IndicatorType_Price = 4; //【範囲】最新価格
IndicatorType_PeTTM = 5; //【范围】PER(株価収益率)TTM
}
// ソート字段 (固定降順)
enum SortField {
SortField_Unknown = 0; // デフォルト按市值ソート
SortField_BeatRatio = 1; // 予想上振れ比率
SortField_EarningDayChg = 2; // 決算発表翌日騰落率
SortField_ReleasedDate = 3; // 発表時間
SortField_Actual = 4; // 実績値
SortField_Estimate = 5; // 予測値
SortField_Yoy = 6; // 前年同期
SortField_YoyGrowth = 7; // 前年同期比成長率
SortField_PeTTM = 8; // PER(株価収益率)TTM
SortField_DividendsTTM = 9; // 配当利回りTTM
SortField_Price = 10; // 価格
SortField_ChangeRate = 11; // 今日騰落率
}
// 決算発表時間帯
enum PostPeriodType {
PostPeriodType_Regular = 0; // 当日(時間帯未判定)
PostPeriodType_Before = 1; // プレマーケット
PostPeriodType_After = 2; // アフターマーケット
PostPeriodType_IntradayTrading = 3; // ザラ場
}
// スクリーニング条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.Interval indicatorValue = 2; // スクリーニング範囲
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket(HK=1, US=11, SG=31, JP=41のみ対応)
required int32 beatType = 2; // BeatType
optional int32 count = 3; // 戻り値数量 [1,300], デフォルト30
optional int32 term = 4; // BeatTerm, デフォルト All
repeated Indicator filterList = 5; // 可选スクリーニング条件(AND关系), 不传则使用デフォルト值(超预期>0, 時間=最近30天)
optional int32 sortField = 6; // SortField, ソート字段(固定降順), デフォルト按市值
}
// 決算予想超えランキングデータ項目
message EarningsBeatItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional string industry = 3; // 業種
// 相場
optional double curPrice = 10; // 最新値
optional double lastClosePrice = 11; // 前日終値
optional double changeRate = 12; // 今日騰落率 (%)
optional double marketCap = 13; // 時価総額
optional double peTTM = 14; // PER(株価収益率)TTM
optional double dividendsTTM = 15; // 配当利回りTTM(%)
// 決算予想超え
optional string releasedDate = 20; // 发布日付 (如 "2024-01-15")
optional double beatRatio = 21; // 予想上振れ比率(%)
optional double actual = 22; // 実績値
optional double estimate = 23; // 予測値
optional double yoy = 24; // 前年同期
optional double yoyGrowth = 25; // 前年同期比成長率(%)
optional double earningDayChg = 26; // 決算発表翌日騰落率(%)
optional string term = 27; // 決算期(例:"2024/Q1")
optional int32 detailPostPeriod = 28; // PostPeriodType、発表時間帯
}
message S2C {
repeated EarningsBeatItem dataList = 1; // データリスト
optional int32 allCount = 2; // データ総数
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType、戻り値
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
プロトコルID
3406
uint GetEarningsBeatRank(Qot_GetEarningsBeatRank.Request req);
virtual void OnReply_GetEarningsBeatRank(FTAPI_Conn client, uint nSerialNo, Qot_GetEarningsBeatRank.Response rsp);
説明
決算サプライズランキングを取得します。指定市場において決算実績値が予想値を上回った銘柄のランキングリストを返します。サプライズ比率、決算後初日の騰落率、前年比成長率などの指標データを含みます。
パラメータ
// 決算予想超えタイプ
enum BeatType {
BeatType_Unknown = 0;
BeatType_EPS = 1; // EPS(1株当たり利益)
BeatType_REVENUE = 2; // 売上高
BeatType_EBIT = 3; // EBIT(税引前利益)
}
// 決算期
enum BeatTerm {
BeatTerm_Latest = 0; // 最近一期 (デフォルト)
BeatTerm_LatestQuarter = 1; // 直近四半期報告
BeatTerm_LatestHalf = 2; // 直近半年報告
BeatTerm_LatestAnnual = 3; // 直近年次報告
BeatTerm_All = 4; // 全部(時間一样季报优先,時間不同最近一期)
}
// スクリーニング条件タイプ
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_BeatRatio = 1; //【範囲】予想上振れ比率
IndicatorType_ReleasedDate = 2; //【范围】发布時間(時間戳秒)
IndicatorType_MarketCap = 3; //【範囲】時価総額
IndicatorType_Price = 4; //【範囲】最新価格
IndicatorType_PeTTM = 5; //【范围】PER(株価収益率)TTM
}
// ソート字段 (固定降順)
enum SortField {
SortField_Unknown = 0; // デフォルト按市值ソート
SortField_BeatRatio = 1; // 予想上振れ比率
SortField_EarningDayChg = 2; // 決算発表翌日騰落率
SortField_ReleasedDate = 3; // 発表時間
SortField_Actual = 4; // 実績値
SortField_Estimate = 5; // 予測値
SortField_Yoy = 6; // 前年同期
SortField_YoyGrowth = 7; // 前年同期比成長率
SortField_PeTTM = 8; // PER(株価収益率)TTM
SortField_DividendsTTM = 9; // 配当利回りTTM
SortField_Price = 10; // 価格
SortField_ChangeRate = 11; // 今日騰落率
}
// 決算発表時間帯
enum PostPeriodType {
PostPeriodType_Regular = 0; // 当日(時間帯未判定)
PostPeriodType_Before = 1; // プレマーケット
PostPeriodType_After = 2; // アフターマーケット
PostPeriodType_IntradayTrading = 3; // ザラ場
}
// スクリーニング条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.Interval indicatorValue = 2; // スクリーニング範囲
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket(HK=1, US=11, SG=31, JP=41のみ対応)
required int32 beatType = 2; // BeatType
optional int32 count = 3; // 戻り値数量 [1,300], デフォルト30
optional int32 term = 4; // BeatTerm, デフォルト All
repeated Indicator filterList = 5; // 可选スクリーニング条件(AND关系), 不传则使用デフォルト值(超预期>0, 時間=最近30天)
optional int32 sortField = 6; // SortField, ソート字段(固定降順), デフォルト按市值
}
// 決算予想超えランキングデータ項目
message EarningsBeatItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional string industry = 3; // 業種
// 相場
optional double curPrice = 10; // 最新値
optional double lastClosePrice = 11; // 前日終値
optional double changeRate = 12; // 今日騰落率 (%)
optional double marketCap = 13; // 時価総額
optional double peTTM = 14; // PER(株価収益率)TTM
optional double dividendsTTM = 15; // 配当利回りTTM(%)
// 決算予想超え
optional string releasedDate = 20; // 发布日付 (如 "2024-01-15")
optional double beatRatio = 21; // 予想上振れ比率(%)
optional double actual = 22; // 実績値
optional double estimate = 23; // 予測値
optional double yoy = 24; // 前年同期
optional double yoyGrowth = 25; // 前年同期比成長率(%)
optional double earningDayChg = 26; // 決算発表翌日騰落率(%)
optional string term = 27; // 決算期(例:"2024/Q1")
optional int32 detailPostPeriod = 28; // PostPeriodType、発表時間帯
}
message S2C {
repeated EarningsBeatItem dataList = 1; // データリスト
optional int32 allCount = 2; // データ総数
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType、戻り値
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
- API呼び出し結果、構造体については以下を参照 RetType
プロトコルID
3406
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;
QotGetEarningsBeatRank.C2S c2s = QotGetEarningsBeatRank.C2S.CreateBuilder()
.SetMarket(11)
.SetBeatType(1)
.SetCount(3)
.Build();
QotGetEarningsBeatRank.Request req = QotGetEarningsBeatRank.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetEarningsBeatRank(req);
Console.Write("Send QotGetEarningsBeatRank: {0}
", seqNo);
}
public void OnDisconnect(MMAPI_Conn client, long errCode) {
Console.Write("Qot onDisConnect: {0}
", errCode);
}
public void OnReply_GetEarningsBeatRank(MMAPI_Conn client, uint nSerialNo, QotGetEarningsBeatRank.Response rsp)
{
Console.Write("Reply: QotGetEarningsBeatRank: {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 QotGetEarningsBeatRank: 3
Reply: QotGetEarningsBeatRank: 3
GetEarningsBeatRank: errCode 0, retMsg , retType 0
{
"allCount": 1282,
"dataList": [
{ "security": { "market": 11, "code": "NVDA" }, "name": "英伟达", "beatRatio": 37.253, "earningDayChg": -1.772 },
{ "security": { "market": 11, "code": "GOOGL" }, "name": "谷歌-A", "beatRatio": 91.593, "earningDayChg": 9.961 },
{ "security": { "market": 11, "code": "GOOG" }, "name": "谷歌-C", "beatRatio": 91.593, "earningDayChg": 9.970 }
]
}
2
3
4
5
6
7
8
9
10
11
int getEarningsBeatRank(Qot_GetEarningsBeatRank.Request req);
onReply_GetEarningsBeatRank(FTAPI_Conn client, int nSerialNo, Qot_GetEarningsBeatRank.Response rsp)
説明
決算サプライズランキングを取得します。指定市場において決算実績値が予想値を上回った銘柄のランキングリストを返します。サプライズ比率、決算後初日の騰落率、前年比成長率などの指標データを含みます。
パラメータ
// 決算予想超えタイプ
enum BeatType {
BeatType_Unknown = 0;
BeatType_EPS = 1; // EPS(1株当たり利益)
BeatType_REVENUE = 2; // 売上高
BeatType_EBIT = 3; // EBIT(税引前利益)
}
// 決算期
enum BeatTerm {
BeatTerm_Latest = 0; // 最近一期 (デフォルト)
BeatTerm_LatestQuarter = 1; // 直近四半期報告
BeatTerm_LatestHalf = 2; // 直近半年報告
BeatTerm_LatestAnnual = 3; // 直近年次報告
BeatTerm_All = 4; // 全部(時間一样季报优先,時間不同最近一期)
}
// スクリーニング条件タイプ
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_BeatRatio = 1; //【範囲】予想上振れ比率
IndicatorType_ReleasedDate = 2; //【范围】发布時間(時間戳秒)
IndicatorType_MarketCap = 3; //【範囲】時価総額
IndicatorType_Price = 4; //【範囲】最新価格
IndicatorType_PeTTM = 5; //【范围】PER(株価収益率)TTM
}
// ソート字段 (固定降順)
enum SortField {
SortField_Unknown = 0; // デフォルト按市值ソート
SortField_BeatRatio = 1; // 予想上振れ比率
SortField_EarningDayChg = 2; // 決算発表翌日騰落率
SortField_ReleasedDate = 3; // 発表時間
SortField_Actual = 4; // 実績値
SortField_Estimate = 5; // 予測値
SortField_Yoy = 6; // 前年同期
SortField_YoyGrowth = 7; // 前年同期比成長率
SortField_PeTTM = 8; // PER(株価収益率)TTM
SortField_DividendsTTM = 9; // 配当利回りTTM
SortField_Price = 10; // 価格
SortField_ChangeRate = 11; // 今日騰落率
}
// 決算発表時間帯
enum PostPeriodType {
PostPeriodType_Regular = 0; // 当日(時間帯未判定)
PostPeriodType_Before = 1; // プレマーケット
PostPeriodType_After = 2; // アフターマーケット
PostPeriodType_IntradayTrading = 3; // ザラ場
}
// スクリーニング条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.Interval indicatorValue = 2; // スクリーニング範囲
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket(HK=1, US=11, SG=31, JP=41のみ対応)
required int32 beatType = 2; // BeatType
optional int32 count = 3; // 戻り値数量 [1,300], デフォルト30
optional int32 term = 4; // BeatTerm, デフォルト All
repeated Indicator filterList = 5; // 可选スクリーニング条件(AND关系), 不传则使用デフォルト值(超预期>0, 時間=最近30天)
optional int32 sortField = 6; // SortField, ソート字段(固定降順), デフォルト按市值
}
// 決算予想超えランキングデータ項目
message EarningsBeatItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional string industry = 3; // 業種
// 相場
optional double curPrice = 10; // 最新値
optional double lastClosePrice = 11; // 前日終値
optional double changeRate = 12; // 今日騰落率 (%)
optional double marketCap = 13; // 時価総額
optional double peTTM = 14; // PER(株価収益率)TTM
optional double dividendsTTM = 15; // 配当利回りTTM(%)
// 決算予想超え
optional string releasedDate = 20; // 发布日付 (如 "2024-01-15")
optional double beatRatio = 21; // 予想上振れ比率(%)
optional double actual = 22; // 実績値
optional double estimate = 23; // 予測値
optional double yoy = 24; // 前年同期
optional double yoyGrowth = 25; // 前年同期比成長率(%)
optional double earningDayChg = 26; // 決算発表翌日騰落率(%)
optional string term = 27; // 決算期(例:"2024/Q1")
optional int32 detailPostPeriod = 28; // PostPeriodType、発表時間帯
}
message S2C {
repeated EarningsBeatItem dataList = 1; // データリスト
optional int32 allCount = 2; // データ総数
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType、戻り値
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
- API呼び出し結果、構造体については以下を参照 RetType
プロトコルID
3406
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;
QotGetEarningsBeatRank.C2S c2s = QotGetEarningsBeatRank.C2S.newBuilder()
.setMarket(11)
.setBeatType(1)
.setCount(3)
.build();
QotGetEarningsBeatRank.Request req = QotGetEarningsBeatRank.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getEarningsBeatRank(req);
System.out.printf("Send QotGetEarningsBeatRank: %d
", seqNo);
}
@Override
public void onDisconnect(MMAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d
", errCode);
}
@Override
public void onReply_GetEarningsBeatRank(MMAPI_Conn client, int nSerialNo, QotGetEarningsBeatRank.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetEarningsBeatRank failed: %s
", rsp.getRetMsg());
} else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetEarningsBeatRank: %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 QotGetEarningsBeatRank: 3
Receive QotGetEarningsBeatRank: {
"allCount": 1282,
"dataList": [
{ "security": { "market": 11, "code": "NVDA" }, "name": "英伟达", "beatRatio": 37.253, "earningDayChg": -1.772 },
{ "security": { "market": 11, "code": "GOOGL" }, "name": "谷歌-A", "beatRatio": 91.593, "earningDayChg": 9.961 },
{ "security": { "market": 11, "code": "GOOG" }, "name": "谷歌-C", "beatRatio": 91.593, "earningDayChg": 9.970 }
]
}
2
3
4
5
6
7
8
9
moomoo::u32_t GetEarningsBeatRank(const Qot_GetEarningsBeatRank::Request &stReq);
virtual void OnReply_GetEarningsBeatRank(moomoo::u32_t nSerialNo, const Qot_GetEarningsBeatRank::Response &stRsp) = 0;
概要
プロトコルリクエストとレスポンスの定義
パラメータ
// 決算予想超えタイプ
enum BeatType {
BeatType_Unknown = 0;
BeatType_EPS = 1; // EPS(1株当たり利益)
BeatType_REVENUE = 2; // 売上高
BeatType_EBIT = 3; // EBIT(税引前利益)
}
// 決算期
enum BeatTerm {
BeatTerm_Latest = 0; // 最近一期 (デフォルト)
BeatTerm_LatestQuarter = 1; // 直近四半期報告
BeatTerm_LatestHalf = 2; // 直近半年報告
BeatTerm_LatestAnnual = 3; // 直近年次報告
BeatTerm_All = 4; // 全部(時間一样季报优先,時間不同最近一期)
}
// スクリーニング条件タイプ
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_BeatRatio = 1; //【範囲】予想上振れ比率
IndicatorType_ReleasedDate = 2; //【范围】发布時間(時間戳秒)
IndicatorType_MarketCap = 3; //【範囲】時価総額
IndicatorType_Price = 4; //【範囲】最新価格
IndicatorType_PeTTM = 5; //【范围】PER(株価収益率)TTM
}
// ソート字段 (固定降順)
enum SortField {
SortField_Unknown = 0; // デフォルト按市值ソート
SortField_BeatRatio = 1; // 予想上振れ比率
SortField_EarningDayChg = 2; // 決算発表翌日騰落率
SortField_ReleasedDate = 3; // 発表時間
SortField_Actual = 4; // 実績値
SortField_Estimate = 5; // 予測値
SortField_Yoy = 6; // 前年同期
SortField_YoyGrowth = 7; // 前年同期比成長率
SortField_PeTTM = 8; // PER(株価収益率)TTM
SortField_DividendsTTM = 9; // 配当利回りTTM
SortField_Price = 10; // 価格
SortField_ChangeRate = 11; // 今日騰落率
}
// 決算発表時間帯
enum PostPeriodType {
PostPeriodType_Regular = 0; // 当日(時間帯未判定)
PostPeriodType_Before = 1; // プレマーケット
PostPeriodType_After = 2; // アフターマーケット
PostPeriodType_IntradayTrading = 3; // ザラ場
}
// スクリーニング条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.Interval indicatorValue = 2; // スクリーニング範囲
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket(HK=1, US=11, SG=31, JP=41のみ対応)
required int32 beatType = 2; // BeatType
optional int32 count = 3; // 戻り値数量 [1,300], デフォルト30
optional int32 term = 4; // BeatTerm, デフォルト All
repeated Indicator filterList = 5; // 可选スクリーニング条件(AND关系), 不传则使用デフォルト值(超预期>0, 時間=最近30天)
optional int32 sortField = 6; // SortField, ソート字段(固定降順), デフォルト按市值
}
// 決算予想超えランキングデータ項目
message EarningsBeatItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional string industry = 3; // 業種
// 相場
optional double curPrice = 10; // 最新値
optional double lastClosePrice = 11; // 前日終値
optional double changeRate = 12; // 今日騰落率 (%)
optional double marketCap = 13; // 時価総額
optional double peTTM = 14; // PER(株価収益率)TTM
optional double dividendsTTM = 15; // 配当利回りTTM(%)
// 決算予想超え
optional string releasedDate = 20; // 发布日付 (如 "2024-01-15")
optional double beatRatio = 21; // 予想上振れ比率(%)
optional double actual = 22; // 実績値
optional double estimate = 23; // 予測値
optional double yoy = 24; // 前年同期
optional double yoyGrowth = 25; // 前年同期比成長率(%)
optional double earningDayChg = 26; // 決算発表翌日騰落率(%)
optional string term = 27; // 決算期(例:"2024/Q1")
optional int32 detailPostPeriod = 28; // PostPeriodType、発表時間帯
}
message S2C {
repeated EarningsBeatItem dataList = 1; // データリスト
optional int32 allCount = 2; // データ総数
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType、戻り値
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
- API 呼び出し結果,構造は~を参照: RetType
プロトコル ID
3406
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_GetEarningsBeatRank::Request req;
Qot_GetEarningsBeatRank::C2S *c2s = req.mutable_c2s();
c2s->set_market(Qot_Common::QotMarket::QotMarket_US_Security);
c2s->set_beattype(1); // BeatType_EPS
c2s->set_count(30);
m_GetEarningsBeatRankSerialNo = m_pQotApi->GetEarningsBeatRank(req);
}
virtual void OnReply_GetEarningsBeatRank(moomoo::u32_t nSerialNo, const Qot_GetEarningsBeatRank::Response &stRsp) {
if (nSerialNo != m_GetEarningsBeatRankSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
MMAPI_Qot *m_pQotApi;
moomoo::u32_t m_GetEarningsBeatRankSerialNo = 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": "NVDA"
},
"name": "NVIDIA",
"industry": "Semiconductor",
"curPrice": 875.4,
"changeRate": 9.32,
"marketCap": 2150000000000.0,
"peTTM": 65.2
}
],
"allCount": 30
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
getEarningsBeatRank(qotGetEarningsBeatRank)
説明
決算サプライズランキングを取得します。指定市場において決算実績値が予想値を上回った銘柄のランキングリストを返します。サプライズ比率、決算後初日の騰落率、前年比成長率などの指標データを含みます。
パラメータ
// 決算予想超えタイプ
enum BeatType {
BeatType_Unknown = 0;
BeatType_EPS = 1; // EPS(1株当たり利益)
BeatType_REVENUE = 2; // 売上高
BeatType_EBIT = 3; // EBIT(税引前利益)
}
// 決算期
enum BeatTerm {
BeatTerm_Latest = 0; // 最近一期 (デフォルト)
BeatTerm_LatestQuarter = 1; // 直近四半期報告
BeatTerm_LatestHalf = 2; // 直近半年報告
BeatTerm_LatestAnnual = 3; // 直近年次報告
BeatTerm_All = 4; // 全部(時間一样季报优先,時間不同最近一期)
}
// スクリーニング条件タイプ
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_BeatRatio = 1; //【範囲】予想上振れ比率
IndicatorType_ReleasedDate = 2; //【范围】发布時間(時間戳秒)
IndicatorType_MarketCap = 3; //【範囲】時価総額
IndicatorType_Price = 4; //【範囲】最新価格
IndicatorType_PeTTM = 5; //【范围】PER(株価収益率)TTM
}
// ソート字段 (固定降順)
enum SortField {
SortField_Unknown = 0; // デフォルト按市值ソート
SortField_BeatRatio = 1; // 予想上振れ比率
SortField_EarningDayChg = 2; // 決算発表翌日騰落率
SortField_ReleasedDate = 3; // 発表時間
SortField_Actual = 4; // 実績値
SortField_Estimate = 5; // 予測値
SortField_Yoy = 6; // 前年同期
SortField_YoyGrowth = 7; // 前年同期比成長率
SortField_PeTTM = 8; // PER(株価収益率)TTM
SortField_DividendsTTM = 9; // 配当利回りTTM
SortField_Price = 10; // 価格
SortField_ChangeRate = 11; // 今日騰落率
}
// 決算発表時間帯
enum PostPeriodType {
PostPeriodType_Regular = 0; // 当日(時間帯未判定)
PostPeriodType_Before = 1; // プレマーケット
PostPeriodType_After = 2; // アフターマーケット
PostPeriodType_IntradayTrading = 3; // ザラ場
}
// スクリーニング条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.Interval indicatorValue = 2; // スクリーニング範囲
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket(HK=1, US=11, SG=31, JP=41のみ対応)
required int32 beatType = 2; // BeatType
optional int32 count = 3; // 戻り値数量 [1,300], デフォルト30
optional int32 term = 4; // BeatTerm, デフォルト All
repeated Indicator filterList = 5; // 可选スクリーニング条件(AND关系), 不传则使用デフォルト值(超预期>0, 時間=最近30天)
optional int32 sortField = 6; // SortField, ソート字段(固定降順), デフォルト按市值
}
// 決算予想超えランキングデータ項目
message EarningsBeatItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional string industry = 3; // 業種
// 相場
optional double curPrice = 10; // 最新値
optional double lastClosePrice = 11; // 前日終値
optional double changeRate = 12; // 今日騰落率 (%)
optional double marketCap = 13; // 時価総額
optional double peTTM = 14; // PER(株価収益率)TTM
optional double dividendsTTM = 15; // 配当利回りTTM(%)
// 決算予想超え
optional string releasedDate = 20; // 发布日付 (如 "2024-01-15")
optional double beatRatio = 21; // 予想上振れ比率(%)
optional double actual = 22; // 実績値
optional double estimate = 23; // 予測値
optional double yoy = 24; // 前年同期
optional double yoyGrowth = 25; // 前年同期比成長率(%)
optional double earningDayChg = 26; // 決算発表翌日騰落率(%)
optional string term = 27; // 決算期(例:"2024/Q1")
optional int32 detailPostPeriod = 28; // PostPeriodType、発表時間帯
}
message S2C {
repeated EarningsBeatItem dataList = 1; // データリスト
optional int32 allCount = 2; // データ総数
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType、戻り値
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
- API呼び出し結果、構造体については以下を参照 RetType
プロトコルID
3406
Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_Common } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetEarningsBeatRank(){
const { RetType } = Common
let [addr, port, enable_ssl, key] = ["127.0.0.1", 11111, false, "xxxxxx"];
let websocket = new mmWebsocket();
websocket.onlogin = (ret, msg)=>{
if (ret) {
const req = {
c2s: { market: 11, beatType: 1, count: 3 },
};
websocket.GetEarningsBeatRank(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetEarningsBeatRank: 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);
}
QotGetEarningsBeatRank()
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
GetEarningsBeatRank: errCode 0, retMsg , retType 0
{
"allCount": 1282,
"dataList": [
{ "security": { "market": 11, "code": "NVDA" }, "name": "英伟达", "beatRatio": 37.253, "earningDayChg": -1.772 },
{ "security": { "market": 11, "code": "GOOGL" }, "name": "谷歌-A", "beatRatio": 91.593, "earningDayChg": 9.961 },
{ "security": { "market": 11, "code": "GOOG" }, "name": "谷歌-C", "beatRatio": 91.593, "earningDayChg": 9.970 }
]
}
2
3
4
5
6
7
8
9
API制限
- 30秒以内に最大60回のリクエストが可能です
- ページネーションリクエストは最初のページのみレート制限にカウントされます