# 获取盈利超预期排名
- 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 财报周期,默认 ALL 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 接口调用结果 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 市盈率 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; // 每股收益
BeatType_REVENUE = 2; // 营收
BeatType_EBIT = 3; // 息税前利润
}
// 财报周期
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; //【范围】市盈率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; // 市盈率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; // 市盈率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; // 每股收益
BeatType_REVENUE = 2; // 营收
BeatType_EBIT = 3; // 息税前利润
}
// 财报周期
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; //【范围】市盈率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; // 市盈率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; // 市盈率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
- 接口调用结果,结构参见 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; // 每股收益
BeatType_REVENUE = 2; // 营收
BeatType_EBIT = 3; // 息税前利润
}
// 财报周期
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; //【范围】市盈率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; // 市盈率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; // 市盈率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
- 接口调用结果,结构参见 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
介绍
获取盈利超预期排名,返回指定市场中财报实际值超出预期值的股票排行列表,包含超预期比率、财报后首日涨幅、同比增长率等维度数据。
参数
// 盈利超预期类型
enum BeatType {
BeatType_Unknown = 0;
BeatType_EPS = 1; // 每股收益
BeatType_REVENUE = 2; // 营收
BeatType_EBIT = 3; // 息税前利润
}
// 财报周期
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; //【范围】市盈率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; // 市盈率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; // 市盈率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
- 接口调用结果,结构参见 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; // 每股收益
BeatType_REVENUE = 2; // 营收
BeatType_EBIT = 3; // 息税前利润
}
// 财报周期
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; //【范围】市盈率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; // 市盈率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; // 市盈率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
- 接口调用结果,结构参见 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
接口限制
- 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 财报周期,默认 ALL 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 接口调用结果 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 市盈率 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; // 每股收益
BeatType_REVENUE = 2; // 营收
BeatType_EBIT = 3; // 息税前利润
}
// 财报周期
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; //【范围】市盈率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; // 市盈率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; // 市盈率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; // 每股收益
BeatType_REVENUE = 2; // 营收
BeatType_EBIT = 3; // 息税前利润
}
// 财报周期
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; //【范围】市盈率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; // 市盈率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; // 市盈率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
- 接口调用结果,结构参见 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; // 每股收益
BeatType_REVENUE = 2; // 营收
BeatType_EBIT = 3; // 息税前利润
}
// 财报周期
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; //【范围】市盈率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; // 市盈率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; // 市盈率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
- 接口调用结果,结构参见 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
介绍
获取盈利超预期排名,返回指定市场中财报实际值超出预期值的股票排行列表,包含超预期比率、财报后首日涨幅、同比增长率等维度数据。
参数
// 盈利超预期类型
enum BeatType {
BeatType_Unknown = 0;
BeatType_EPS = 1; // 每股收益
BeatType_REVENUE = 2; // 营收
BeatType_EBIT = 3; // 息税前利润
}
// 财报周期
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; //【范围】市盈率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; // 市盈率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; // 市盈率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
- 接口调用结果,结构参见 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; // 每股收益
BeatType_REVENUE = 2; // 营收
BeatType_EBIT = 3; // 息税前利润
}
// 财报周期
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; //【范围】市盈率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; // 市盈率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; // 市盈率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
- 接口调用结果,结构参见 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
接口限制
- 30 秒内最多 60 次请求
- 分页请求仅首页计入限频统计
← 获取FedWatch点阵图 获取股息排行 →