# 获取评级汇总
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_research_rating_summary(code, rating_dimension_type=None, uid=None, num=None, next_key=None)
介绍
获取指定股票的机构或分析师评级汇总列表,或指定机构/分析师的评级详情,支持分页拉取
参数
参数 类型 说明 code str 股票代码 rating_dimension_type ResearchRatingDimensionType 评级维度 0=Unknown,1=Institution(机构维度),2=Analyst(分析师维度);默认机构维度uid str 机构或分析师 UID 空=取该股票的评级汇总列表
非空=取该 uid 对应的评级详情(分析师 uid 须搭配 rating_dimension_type=2)num int 每页返回数量 默认 10,范围 1~20next_key str 分页标识 首次不传,续拉时填上次返回的 next_key;"-1" 表示无更多数据返回
参数 类型 说明 ret RET_CODE 接口调用结果 data dict 当 ret == RET_OK,返回评级汇总数据字典 str 当 ret != RET_OK,返回错误描述 返回字典包含以下字段:
字段 类型 说明 inst_rating_summary_list list 机构评级汇总列表 uid 为空且 rating_dimension_type=1 时填充
每项含 institution_info 和 rating_item_listanalyst_rating_summary_list list 分析师评级汇总列表 uid 为空且 rating_dimension_type=2 时填充
每项含 analyst_info 和 rating_item_listinst_rating_detail dict 机构评级详情 uid 非空且 rating_dimension_type=1 时填充
含 institution_info、analyst_info_list 和 rating_item_listanalyst_rating_detail dict 分析师评级详情 uid 非空且 rating_dimension_type=2 时填充
含 analyst_info 和 rating_item_listnext_key str 分页标识 "-1" 表示无更多数据inst_rating_summary_list 每项字段(机构评级汇总行):
字段 类型 说明 institution_info dict 机构信息,见下表 rating_item_list list 评级记录列表,见下表 institution_info 字段(InstInfo):
字段 类型 说明 institution_uid str 机构唯一标识 institution_picture_url str 机构图片 URL institution_name str 机构名称 update_time int 更新时间戳(秒,对应市场时区) update_time_str str 更新日期 格式 YYYY-MM-DD,对应市场时区institution_source_name str 机构来源名称 institution_en_name str 机构英文名称 analyst_info 字段(AnalystInfo):
字段 类型 说明 analyst_uid str 分析师唯一标识 analyst_name str 分析师姓名 analyst_picture_url str 分析师头像 URL num_of_stars float 星级 0.0~5.0,如 3.50 表示 3.5 星success_rate float 成功率 百分号前的值,如 12.34 表示 12.34%excess_return float 超额收益 百分号前的值,如 12.34 表示 12.34%stock_success_rate float 个股成功率 百分号前的值,如 12.34 表示 12.34%stock_avg_return float 个股平均收益 百分号前的值,如 12.34 表示 12.34%institution_info dict 所属机构信息,见 institution_info 字段表 update_time int 更新时间戳(秒,对应市场时区) update_time_str str 更新日期 格式 YYYY-MM-DD,对应市场时区rating_item_list 每项字段(RatingItem):
字段 类型 说明 analyst_uid str 分析师唯一标识 institution_uid str 机构唯一标识 rating ResearchRatingType 评级 0=Unknown,1=Sell,2=Underperform,3=Hold,4=Buy,5=StrongBuy
本接口仅返回 Sell(1)/Hold(3)/Buy(4),数值越大评级越高target_price float 目标价 recommendation_date int 评级日期时间戳(秒,对应市场时区) recommendation_date_str str 评级日期 格式 YYYY-MM-DD,对应市场时区rating_url str 评级来源 URL update_time int 更新时间戳(秒,对应市场时区) update_time_str str 更新日期 格式 YYYY-MM-DD,对应市场时区
Example
from futu import *
import pandas as pd
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_research_rating_summary("US.AAPL", rating_dimension_type=1)
if ret == RET_OK:
rows = []
for row in data.get('inst_rating_summary_list', []):
info = row.get('institution_info', {})
rows.append({
'institution_name': info.get('institution_name', ''),
'institution_en_name': info.get('institution_en_name', ''),
'institution_uid': info.get('institution_uid', ''),
'institution_source_name': info.get('institution_source_name', ''),
'update_time_str': info.get('update_time_str', ''),
})
df = pd.DataFrame(rows)
print(df.to_string(index=False))
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
- Output
institution_name institution_en_name institution_uid institution_source_name update_time_str
韦德布什 Wedbush 8c9ae25a-07e2-4d52-a511-b0dd115a5224 Wedbush 2024-03-01
艾弗考尔 Evercore a746f081-c12a-4d6d-8067-f4b6634de478 Evercore ISI 2024-03-21
瑞士银行 UBS 1d3bfc25-1dda-48fd-bd9f-d4de47e68def UBS 2024-03-01
高盛集团 Goldman Sachs d0e296b4-c2e4-4fad-837c-cd79aaed2e8e Goldman Sachs 2024-03-01
联博集团 Bernstein 16358c98-ccc1-4d08-a875-2c727b7b8d70 Bernstein 2024-03-01
星展银行 DBS 44dec2a6-aca9-4b52-9fed-4bbf78749783 DBS 2024-03-01
美银证券 BofA Securities 7890753d-5482-4311-a7af-8d5feed39f3e Bank of America Securities 2024-03-01
辉立证券 Phillip Securities a294f0ca-10c0-4884-86a7-359995505e70 Phillip Securities 2024-09-09
摩根大通 J.P. Morgan f5ec822c-d561-4db3-a09d-a1e71a9a832f J.P. Morgan 2024-03-01
摩根士丹利 Morgan Stanley 9a29ac93-221c-4c1a-ba1a-bbbbf57a5ca6 Morgan Stanley 2024-03-01
2
3
4
5
6
7
8
9
10
11
# Qot_GetResearchRatingSummary.proto
介绍
获取评级汇总
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional Qot_Common.ResearchRatingDimensionType ratingDimensionType = 2; // 评级维度(详见 Qot_Common.ResearchRatingDimensionType 定义),默认机构维度
optional string uid = 3; // 空=取该股票的评级汇总列表;非空=取该 uid(institutionUid 或 analystUid)的评级详情
optional string nextKey = 4; // 分页标识,首次不填,续拉时填上次返回的 nextKey;"-1" 表示无更多数据
optional int32 num = 5; // 每页返回数量,默认 10,范围 1~20
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 股票结构参见 Security
- 评级维度类型参见 ResearchRatingDimensionType
- 返回
message InstInfo
{
optional string institutionUid = 1; // 机构唯一标识
optional string institutionPictureUrl = 2; // 机构图片 URL
optional string institutionName = 3; // 机构名称
optional int64 updateTime = 4; // 更新时间戳(秒)
optional string updateTimeStr = 5; // 更新时间字符串,格式 YYYY-MM-DD,对应市场时区
optional string institutionSourceName = 6; // 机构来源名称
optional string institutionEnName = 7; // 机构英文名称
}
message AnalystInfo
{
optional string analystUid = 1; // 分析师唯一标识
optional string analystName = 2; // 分析师姓名
optional string analystPictureUrl = 3; // 分析师头像 URL
optional double numOfStars = 4; // 星级(0.0~5.0,如 3.50 表示 3.5 星)
optional double successRate = 5; // 成功率,百分号前的值,如 12.34 表示 12.34%
optional double excessReturn = 6; // 超额收益,百分号前的值,如 12.34 表示 12.34%
optional double stockSuccessRate = 7; // 个股成功率,百分号前的值,如 12.34 表示 12.34%
optional double stockAvgReturn = 8; // 个股平均收益,百分号前的值,如 12.34 表示 12.34%
optional InstInfo institutionInfo = 9; // 所属机构信息
optional int64 updateTime = 10; // 更新时间戳(秒)
optional string updateTimeStr = 11; // 更新时间字符串,格式 YYYY-MM-DD,对应市场时区
}
message RatingItem
{
optional string analystUid = 1; // 分析师唯一标识
optional string institutionUid = 2; // 机构唯一标识
optional Qot_Common.ResearchRatingType rating = 3; // 评级(详见 Qot_Common.ResearchRatingType 定义),仅返回 Sell(1)/Hold(3)/Buy(4),数值越大评级越高
optional double targetPrice = 4; // 目标价
optional int64 recommendationDate = 5; // 评级日期时间戳(秒)
optional string recommendationDateStr = 6; // 评级日期字符串,格式 YYYY-MM-DD,对应市场时区
optional string ratingUrl = 7; // 评级来源 URL
optional int64 updateTime = 8; // 更新时间戳(秒)
optional string updateTimeStr = 9; // 更新时间字符串,格式 YYYY-MM-DD,对应市场时区
}
// 机构评级汇总行(uid 空, ratingDimensionType=1)
message InstRatingSummaryItem
{
optional InstInfo institutionInfo = 1; // 机构信息
repeated RatingItem ratingItemList = 2; // 该机构对该股票的评级记录列表
}
// 分析师评级汇总行(uid 空, ratingDimensionType=2)
message AnalystRatingSummaryItem
{
optional AnalystInfo analystInfo = 1; // 分析师信息
repeated RatingItem ratingItemList = 2; // 该分析师对该股票的评级记录列表
}
// 机构评级详情(uid 非空, ratingDimensionType=1)
message InstRatingDetail
{
optional InstInfo institutionInfo = 1; // 机构信息
repeated AnalystInfo analystInfoList = 2; // 机构下的分析师列表(精简版,不含 stockSuccessRate/stockAvgReturn/institutionInfo)
repeated RatingItem ratingItemList = 3; // 机构下的评级记录列表
}
// 分析师评级详情(uid 非空, ratingDimensionType=2)
message AnalystRatingDetail
{
optional AnalystInfo analystInfo = 1; // 分析师信息(含所属 institutionInfo)
repeated RatingItem ratingItemList = 2; // 该分析师对该股票的评级记录列表
}
message S2C
{
repeated InstRatingSummaryItem instRatingSummaryList = 1; // 机构评级汇总列表(uid 空, ratingDimensionType=1 时填充)
repeated AnalystRatingSummaryItem analystRatingSummaryList = 2; // 分析师评级汇总列表(uid 空, ratingDimensionType=2 时填充)
optional InstRatingDetail instRatingDetail = 3; // 机构评级详情(uid 非空, ratingDimensionType=1 时填充)
optional AnalystRatingDetail analystRatingDetail = 4; // 分析师评级详情(uid 非空, ratingDimensionType=2 时填充)
optional string nextKey = 5; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // 返回结果,详见 Common.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
- 接口调用结果,结构参见 RetType
- 分析师评级参见 ResearchRatingType
协议 ID
3230
uint GetResearchRatingSummary(QotGetResearchRatingSummary.Request req);
virtual void OnReply_GetResearchRatingSummary(FTAPI_Conn client, uint nSerialNo, QotGetResearchRatingSummary.Response rsp);
介绍
获取评级汇总
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional Qot_Common.ResearchRatingDimensionType ratingDimensionType = 2; // 评级维度(详见 Qot_Common.ResearchRatingDimensionType 定义),默认机构维度
optional string uid = 3; // 空=取该股票的评级汇总列表;非空=取该 uid(institutionUid 或 analystUid)的评级详情
optional string nextKey = 4; // 分页标识,首次不填,续拉时填上次返回的 nextKey;"-1" 表示无更多数据
optional int32 num = 5; // 每页返回数量,默认 10,范围 1~20
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 股票结构参见 Security
- 评级维度类型参见 ResearchRatingDimensionType
- 返回
message InstInfo
{
optional string institutionUid = 1; // 机构唯一标识
optional string institutionPictureUrl = 2; // 机构图片 URL
optional string institutionName = 3; // 机构名称
optional int64 updateTime = 4; // 更新时间戳(秒)
optional string updateTimeStr = 5; // 更新时间字符串,格式 YYYY-MM-DD,对应市场时区
optional string institutionSourceName = 6; // 机构来源名称
optional string institutionEnName = 7; // 机构英文名称
}
message AnalystInfo
{
optional string analystUid = 1; // 分析师唯一标识
optional string analystName = 2; // 分析师姓名
optional string analystPictureUrl = 3; // 分析师头像 URL
optional double numOfStars = 4; // 星级(0.0~5.0,如 3.50 表示 3.5 星)
optional double successRate = 5; // 成功率,百分号前的值,如 12.34 表示 12.34%
optional double excessReturn = 6; // 超额收益,百分号前的值,如 12.34 表示 12.34%
optional double stockSuccessRate = 7; // 个股成功率,百分号前的值,如 12.34 表示 12.34%
optional double stockAvgReturn = 8; // 个股平均收益,百分号前的值,如 12.34 表示 12.34%
optional InstInfo institutionInfo = 9; // 所属机构信息
optional int64 updateTime = 10; // 更新时间戳(秒)
optional string updateTimeStr = 11; // 更新时间字符串,格式 YYYY-MM-DD,对应市场时区
}
message RatingItem
{
optional string analystUid = 1; // 分析师唯一标识
optional string institutionUid = 2; // 机构唯一标识
optional Qot_Common.ResearchRatingType rating = 3; // 评级,仅返回 Sell(1)/Hold(3)/Buy(4)
optional double targetPrice = 4; // 目标价
optional int64 recommendationDate = 5; // 评级日期时间戳(秒)
optional string recommendationDateStr = 6; // 评级日期字符串,格式 YYYY-MM-DD
optional string ratingUrl = 7; // 评级来源 URL
optional int64 updateTime = 8; // 更新时间戳(秒)
optional string updateTimeStr = 9; // 更新时间字符串,格式 YYYY-MM-DD
}
message InstRatingSummaryItem
{
optional InstInfo institutionInfo = 1; // 机构信息
repeated RatingItem ratingItemList = 2; // 该机构对该股票的评级记录列表
}
message AnalystRatingSummaryItem
{
optional AnalystInfo analystInfo = 1; // 分析师信息
repeated RatingItem ratingItemList = 2; // 该分析师对该股票的评级记录列表
}
message InstRatingDetail
{
optional InstInfo institutionInfo = 1; // 机构信息
repeated AnalystInfo analystInfoList = 2; // 机构下的分析师列表
repeated RatingItem ratingItemList = 3; // 机构下的评级记录列表
}
message AnalystRatingDetail
{
optional AnalystInfo analystInfo = 1; // 分析师信息
repeated RatingItem ratingItemList = 2; // 该分析师对该股票的评级记录列表
}
message S2C
{
repeated InstRatingSummaryItem instRatingSummaryList = 1; // 机构评级汇总列表
repeated AnalystRatingSummaryItem analystRatingSummaryList = 2; // 分析师评级汇总列表
optional InstRatingDetail instRatingDetail = 3; // 机构评级详情
optional AnalystRatingDetail analystRatingDetail = 4; // 分析师评级详情
optional string nextKey = 5; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // 返回结果,详见 Common.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
- 接口调用结果,结构参见 RetType
- 分析师评级参见 ResearchRatingType
- 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}\n", errCode, desc, client.GetConnectID());
if (errCode != 0)
return;
QotCommon.Security sec = QotCommon.Security.CreateBuilder()
.SetMarket((int)QotCommon.QotMarket.QotMarket_US_Security)
.SetCode("AAPL")
.Build();
QotGetResearchRatingSummary.C2S c2s = QotGetResearchRatingSummary.C2S.CreateBuilder()
.SetSecurity(sec)
.Build();
QotGetResearchRatingSummary.Request req = QotGetResearchRatingSummary.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetResearchRatingSummary(req);
Console.Write("Send QotGetResearchRatingSummary: {0}\n", seqNo);
}
public void OnDisconnect(FTAPI_Conn client, long errCode)
{
Console.Write("Qot onDisConnect: {0}\n", errCode);
}
public void OnReply_GetResearchRatingSummary(FTAPI_Conn client, uint nSerialNo, QotGetResearchRatingSummary.Response rsp)
{
Console.Write("Reply: QotGetResearchRatingSummary: {0} {1}\n", nSerialNo, rsp.ToString());
}
public static void Main(String[] args)
{
FTAPI.Init();
Program qot = new Program();
qot.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
55
56
- Output
sent seqNo=3
retType: 0
retMsg: ""
errCode: 0
s2c {
instRatingSummaryList {
institutionInfo {
institutionUid: "8c9ae25a-07e2-4d52-a511-b0dd115a5224"
institutionPictureUrl: "https://foss1.futunn.com/tip_rank_analysts_data_sync/prod/institution/8c9ae25a-07e2-4d52-a511-b0dd115a5224.jpeg"
institutionName: "韦德布什"
updateTime: 1709278279
updateTimeStr: "2024-03-01"
institutionSourceName: "Wedbush"
institutionEnName: "Wedbush"
}
ratingItemList {
institutionUid: "8c9ae25a-07e2-4d52-a511-b0dd115a5224"
rating: ResearchRatingType_Buy
targetPrice: 400
recommendationDate: 1778216400
recommendationDateStr: "2026-05-08"
ratingUrl: "https://www.tipranks.com/news/the-fly/apple-price-target-raised-to-400-from-350-at-wedbush-thefly-news"
updateTime: 1778322675652242
updateTimeStr: "2026-05-09"
}
ratingItemList {
//...
}
}
instRatingSummaryList {
//...
}
nextKey: "10"
}
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
int getResearchRatingSummary(QotGetResearchRatingSummary.Request req);
void onReply_GetResearchRatingSummary(FTAPI_Conn client, int nSerialNo, QotGetResearchRatingSummary.Response rsp);
介绍
获取评级汇总
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional Qot_Common.ResearchRatingDimensionType ratingDimensionType = 2; // 评级维度(详见 Qot_Common.ResearchRatingDimensionType 定义),默认机构维度
optional string uid = 3; // 空=取该股票的评级汇总列表;非空=取该 uid(institutionUid 或 analystUid)的评级详情
optional string nextKey = 4; // 分页标识,首次不填,续拉时填上次返回的 nextKey;"-1" 表示无更多数据
optional int32 num = 5; // 每页返回数量,默认 10,范围 1~20
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 股票结构参见 Security
- 评级维度类型参见 ResearchRatingDimensionType
- 返回
message InstInfo
{
optional string institutionUid = 1; // 机构唯一标识
optional string institutionPictureUrl = 2; // 机构图片 URL
optional string institutionName = 3; // 机构名称
optional int64 updateTime = 4; // 更新时间戳(秒)
optional string updateTimeStr = 5; // 更新时间字符串,格式 YYYY-MM-DD,对应市场时区
optional string institutionSourceName = 6; // 机构来源名称
optional string institutionEnName = 7; // 机构英文名称
}
message AnalystInfo
{
optional string analystUid = 1; // 分析师唯一标识
optional string analystName = 2; // 分析师姓名
optional string analystPictureUrl = 3; // 分析师头像 URL
optional double numOfStars = 4; // 星级(0.0~5.0,如 3.50 表示 3.5 星)
optional double successRate = 5; // 成功率,百分号前的值,如 12.34 表示 12.34%
optional double excessReturn = 6; // 超额收益,百分号前的值,如 12.34 表示 12.34%
optional double stockSuccessRate = 7; // 个股成功率,百分号前的值,如 12.34 表示 12.34%
optional double stockAvgReturn = 8; // 个股平均收益,百分号前的值,如 12.34 表示 12.34%
optional InstInfo institutionInfo = 9; // 所属机构信息
optional int64 updateTime = 10; // 更新时间戳(秒)
optional string updateTimeStr = 11; // 更新时间字符串,格式 YYYY-MM-DD,对应市场时区
}
message RatingItem
{
optional string analystUid = 1; // 分析师唯一标识
optional string institutionUid = 2; // 机构唯一标识
optional Qot_Common.ResearchRatingType rating = 3; // 评级,仅返回 Sell(1)/Hold(3)/Buy(4)
optional double targetPrice = 4; // 目标价
optional int64 recommendationDate = 5; // 评级日期时间戳(秒)
optional string recommendationDateStr = 6; // 评级日期字符串,格式 YYYY-MM-DD
optional string ratingUrl = 7; // 评级来源 URL
optional int64 updateTime = 8; // 更新时间戳(秒)
optional string updateTimeStr = 9; // 更新时间字符串,格式 YYYY-MM-DD
}
message InstRatingSummaryItem
{
optional InstInfo institutionInfo = 1; // 机构信息
repeated RatingItem ratingItemList = 2; // 该机构对该股票的评级记录列表
}
message AnalystRatingSummaryItem
{
optional AnalystInfo analystInfo = 1; // 分析师信息
repeated RatingItem ratingItemList = 2; // 该分析师对该股票的评级记录列表
}
message InstRatingDetail
{
optional InstInfo institutionInfo = 1; // 机构信息
repeated AnalystInfo analystInfoList = 2; // 机构下的分析师列表
repeated RatingItem ratingItemList = 3; // 机构下的评级记录列表
}
message AnalystRatingDetail
{
optional AnalystInfo analystInfo = 1; // 分析师信息
repeated RatingItem ratingItemList = 2; // 该分析师对该股票的评级记录列表
}
message S2C
{
repeated InstRatingSummaryItem instRatingSummaryList = 1; // 机构评级汇总列表
repeated AnalystRatingSummaryItem analystRatingSummaryList = 2; // 分析师评级汇总列表
optional InstRatingDetail instRatingDetail = 3; // 机构评级详情
optional AnalystRatingDetail analystRatingDetail = 4; // 分析师评级详情
optional string nextKey = 5; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // 返回结果,详见 Common.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
- 接口调用结果,结构参见 RetType
- 分析师评级参见 ResearchRatingType
- 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=%b desc=%s connID=%d\n", errCode, desc, client.getConnectID());
if (errCode != 0)
return;
QotCommon.Security sec = QotCommon.Security.newBuilder()
.setMarket(QotCommon.QotMarket.QotMarket_US_Security_VALUE)
.setCode("AAPL")
.build();
QotGetResearchRatingSummary.C2S c2s = QotGetResearchRatingSummary.C2S.newBuilder()
.setSecurity(sec)
.build();
QotGetResearchRatingSummary.Request req = QotGetResearchRatingSummary.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getResearchRatingSummary(req);
System.out.printf("Send QotGetResearchRatingSummary: %d\n", seqNo);
}
@Override
public void onDisconnect(FTAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d\n", errCode);
}
@Override
public void onReply_GetResearchRatingSummary(FTAPI_Conn client, int nSerialNo, QotGetResearchRatingSummary.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetResearchRatingSummary failed: %s\n", rsp.getRetMsg());
}
else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetResearchRatingSummary: %s\n", 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
- Output
Qot onInitConnect: ret=0 desc= connID=7459213530564494444
Send Qot_GetResearchRatingSummary: 2
Receive Qot_GetResearchRatingSummary: retType: 0
retMsg: ""
errCode: 0
s2c {
instRatingSummaryList {
institutionInfo {
institutionUid: "8c9ae25a-07e2-4d52-a511-b0dd115a5224"
institutionPictureUrl: "https://foss1.futunn.com/tip_rank_analysts_data_sync/prod/institution/8c9ae25a-07e2-4d52-a511-b0dd115a5224.jpeg"
institutionName: "韦德布什"
updateTime: 1709278279
updateTimeStr: "2024-03-01"
institutionSourceName: "Wedbush"
institutionEnName: "Wedbush"
}
ratingItemList {
institutionUid: "8c9ae25a-07e2-4d52-a511-b0dd115a5224"
rating: ResearchRatingType_Buy
targetPrice: 400.0
recommendationDate: 1778216400
recommendationDateStr: "2026-05-08"
ratingUrl: "https://www.tipranks.com/news/the-fly/apple-price-target-raised-to-400-from-350-at-wedbush-thefly-news"
updateTime: 1778322675652242
updateTimeStr: "2026-05-09"
}
ratingItemList {
//...
}
}
instRatingSummaryList {
//...
}
nextKey: "10"
}
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
Futu::u32_t GetResearchRatingSummary(const Qot_GetResearchRatingSummary::Request &stReq);
virtual void OnReply_GetResearchRatingSummary(Futu::u32_t nSerialNo, const Qot_GetResearchRatingSummary::Response &stRsp) = 0;
介绍
获取评级汇总
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional Qot_Common.ResearchRatingDimensionType ratingDimensionType = 2; // 评级维度(详见 Qot_Common.ResearchRatingDimensionType 定义),默认机构维度
optional string uid = 3; // 空=取该股票的评级汇总列表;非空=取该 uid(institutionUid 或 analystUid)的评级详情
optional string nextKey = 4; // 分页标识,首次不填,续拉时填上次返回的 nextKey;"-1" 表示无更多数据
optional int32 num = 5; // 每页返回数量,默认 10,范围 1~20
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 股票结构参见 Security
- 评级维度类型参见 ResearchRatingDimensionType
- 返回
message InstInfo
{
optional string institutionUid = 1; // 机构唯一标识
optional string institutionPictureUrl = 2; // 机构图片 URL
optional string institutionName = 3; // 机构名称
optional int64 updateTime = 4; // 更新时间戳(秒)
optional string updateTimeStr = 5; // 更新时间字符串,格式 YYYY-MM-DD,对应市场时区
optional string institutionSourceName = 6; // 机构来源名称
optional string institutionEnName = 7; // 机构英文名称
}
message AnalystInfo
{
optional string analystUid = 1; // 分析师唯一标识
optional string analystName = 2; // 分析师姓名
optional string analystPictureUrl = 3; // 分析师头像 URL
optional double numOfStars = 4; // 星级(0.0~5.0,如 3.50 表示 3.5 星)
optional double successRate = 5; // 成功率,百分号前的值,如 12.34 表示 12.34%
optional double excessReturn = 6; // 超额收益,百分号前的值,如 12.34 表示 12.34%
optional double stockSuccessRate = 7; // 个股成功率,百分号前的值,如 12.34 表示 12.34%
optional double stockAvgReturn = 8; // 个股平均收益,百分号前的值,如 12.34 表示 12.34%
optional InstInfo institutionInfo = 9; // 所属机构信息
optional int64 updateTime = 10; // 更新时间戳(秒)
optional string updateTimeStr = 11; // 更新时间字符串,格式 YYYY-MM-DD,对应市场时区
}
message RatingItem
{
optional string analystUid = 1; // 分析师唯一标识
optional string institutionUid = 2; // 机构唯一标识
optional Qot_Common.ResearchRatingType rating = 3; // 评级,仅返回 Sell(1)/Hold(3)/Buy(4)
optional double targetPrice = 4; // 目标价
optional int64 recommendationDate = 5; // 评级日期时间戳(秒)
optional string recommendationDateStr = 6; // 评级日期字符串,格式 YYYY-MM-DD
optional string ratingUrl = 7; // 评级来源 URL
optional int64 updateTime = 8; // 更新时间戳(秒)
optional string updateTimeStr = 9; // 更新时间字符串,格式 YYYY-MM-DD
}
message InstRatingSummaryItem
{
optional InstInfo institutionInfo = 1; // 机构信息
repeated RatingItem ratingItemList = 2; // 该机构对该股票的评级记录列表
}
message AnalystRatingSummaryItem
{
optional AnalystInfo analystInfo = 1; // 分析师信息
repeated RatingItem ratingItemList = 2; // 该分析师对该股票的评级记录列表
}
message InstRatingDetail
{
optional InstInfo institutionInfo = 1; // 机构信息
repeated AnalystInfo analystInfoList = 2; // 机构下的分析师列表
repeated RatingItem ratingItemList = 3; // 机构下的评级记录列表
}
message AnalystRatingDetail
{
optional AnalystInfo analystInfo = 1; // 分析师信息
repeated RatingItem ratingItemList = 2; // 该分析师对该股票的评级记录列表
}
message S2C
{
repeated InstRatingSummaryItem instRatingSummaryList = 1; // 机构评级汇总列表
repeated AnalystRatingSummaryItem analystRatingSummaryList = 2; // 分析师评级汇总列表
optional InstRatingDetail instRatingDetail = 3; // 机构评级详情
optional AnalystRatingDetail analystRatingDetail = 4; // 分析师评级详情
optional string nextKey = 5; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // 返回结果,详见 Common.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
- 接口调用结果,结构参见 RetType
- 分析师评级参见 ResearchRatingType
- Example
class Program : public FTSPI_Qot, public FTSPI_Trd, 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) {
cout << "connect" << endl;
// construct request message
Qot_GetResearchRatingSummary::Request req;
Qot_GetResearchRatingSummary::C2S *c2s = req.mutable_c2s();
Qot_Common::Security *sec = c2s->mutable_security();
sec->set_code("AAPL");
sec->set_market(Qot_Common::QotMarket::QotMarket_US_Security);
m_pQotApi->GetResearchRatingSummary(req);
cout << "GetResearchRatingSummary" << endl;
}
virtual void OnReply_GetResearchRatingSummary(Futu::u32_t nSerialNo, const Qot_GetResearchRatingSummary::Response &stRsp){
cout << "OnReply_GetResearchRatingSummary:" << endl;
// print response
// ProtoBufToBodyData and UTF8ToLocal refer to tool.h in Samples
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
FTAPI_Qot *m_pQotApi;
};
int32_t main(int32_t argc, char** argv)
{
FTAPI::Init();
{
Program program;
program.Start();
getchar();
}
protobuf::ShutdownProtobufLibrary();
FTAPI::UnInit();
return 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
- Output
onInitConnect: ret=0 desc=Succeed!
Send Qot_GetResearchRatingSummary seqNo=3
retType: 0
retMsg: ""
errCode: 0
s2c {
instRatingSummaryList {
institutionInfo {
institutionUid: "8c9ae25a-07e2-4d52-a511-b0dd115a5224"
institutionPictureUrl: "https://foss1.futunn.com/tip_rank_analysts_data_sync/prod/institution/8c9ae25a-07e2-4d52-a511-b0dd115a5224.jpeg"
institutionName: "韦德布什"
updateTime: 1709278279
updateTimeStr: "2024-03-01"
institutionSourceName: "Wedbush"
institutionEnName: "Wedbush"
}
ratingItemList {
institutionUid: "8c9ae25a-07e2-4d52-a511-b0dd115a5224"
rating: ResearchRatingType_Buy
targetPrice: 400
recommendationDate: 1778216400
recommendationDateStr: "2026-05-08"
ratingUrl: "https://www.tipranks.com/news/the-fly/apple-price-target-raised-to-400-from-350-at-wedbush-thefly-news"
updateTime: 1778322675652242
updateTimeStr: "2026-05-09"
}
ratingItemList {
//...
}
}
instRatingSummaryList {
//...
}
nextKey: "10"
}
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
GetResearchRatingSummary(req);
介绍
获取评级汇总
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional Qot_Common.ResearchRatingDimensionType ratingDimensionType = 2; // 评级维度(详见 Qot_Common.ResearchRatingDimensionType 定义),默认机构维度
optional string uid = 3; // 空=取该股票的评级汇总列表;非空=取该 uid(institutionUid 或 analystUid)的评级详情
optional string nextKey = 4; // 分页标识,首次不填,续拉时填上次返回的 nextKey;"-1" 表示无更多数据
optional int32 num = 5; // 每页返回数量,默认 10,范围 1~20
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 股票结构参见 Security
- 评级维度类型参见 ResearchRatingDimensionType
- 返回
message InstInfo
{
optional string institutionUid = 1; // 机构唯一标识
optional string institutionPictureUrl = 2; // 机构图片 URL
optional string institutionName = 3; // 机构名称
optional int64 updateTime = 4; // 更新时间戳(秒)
optional string updateTimeStr = 5; // 更新时间字符串,格式 YYYY-MM-DD,对应市场时区
optional string institutionSourceName = 6; // 机构来源名称
optional string institutionEnName = 7; // 机构英文名称
}
message AnalystInfo
{
optional string analystUid = 1; // 分析师唯一标识
optional string analystName = 2; // 分析师姓名
optional string analystPictureUrl = 3; // 分析师头像 URL
optional double numOfStars = 4; // 星级(0.0~5.0,如 3.50 表示 3.5 星)
optional double successRate = 5; // 成功率,百分号前的值,如 12.34 表示 12.34%
optional double excessReturn = 6; // 超额收益,百分号前的值,如 12.34 表示 12.34%
optional double stockSuccessRate = 7; // 个股成功率,百分号前的值,如 12.34 表示 12.34%
optional double stockAvgReturn = 8; // 个股平均收益,百分号前的值,如 12.34 表示 12.34%
optional InstInfo institutionInfo = 9; // 所属机构信息
optional int64 updateTime = 10; // 更新时间戳(秒)
optional string updateTimeStr = 11; // 更新时间字符串,格式 YYYY-MM-DD,对应市场时区
}
message RatingItem
{
optional string analystUid = 1; // 分析师唯一标识
optional string institutionUid = 2; // 机构唯一标识
optional Qot_Common.ResearchRatingType rating = 3; // 评级,仅返回 Sell(1)/Hold(3)/Buy(4)
optional double targetPrice = 4; // 目标价
optional int64 recommendationDate = 5; // 评级日期时间戳(秒)
optional string recommendationDateStr = 6; // 评级日期字符串,格式 YYYY-MM-DD
optional string ratingUrl = 7; // 评级来源 URL
optional int64 updateTime = 8; // 更新时间戳(秒)
optional string updateTimeStr = 9; // 更新时间字符串,格式 YYYY-MM-DD
}
message InstRatingSummaryItem
{
optional InstInfo institutionInfo = 1; // 机构信息
repeated RatingItem ratingItemList = 2; // 该机构对该股票的评级记录列表
}
message AnalystRatingSummaryItem
{
optional AnalystInfo analystInfo = 1; // 分析师信息
repeated RatingItem ratingItemList = 2; // 该分析师对该股票的评级记录列表
}
message InstRatingDetail
{
optional InstInfo institutionInfo = 1; // 机构信息
repeated AnalystInfo analystInfoList = 2; // 机构下的分析师列表
repeated RatingItem ratingItemList = 3; // 机构下的评级记录列表
}
message AnalystRatingDetail
{
optional AnalystInfo analystInfo = 1; // 分析师信息
repeated RatingItem ratingItemList = 2; // 该分析师对该股票的评级记录列表
}
message S2C
{
repeated InstRatingSummaryItem instRatingSummaryList = 1; // 机构评级汇总列表
repeated AnalystRatingSummaryItem analystRatingSummaryList = 2; // 分析师评级汇总列表
optional InstRatingDetail instRatingDetail = 3; // 机构评级详情
optional AnalystRatingDetail analystRatingDetail = 4; // 分析师评级详情
optional string nextKey = 5; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // 返回结果,详见 Common.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
- 接口调用结果,结构参见 RetType
- 分析师评级参见 ResearchRatingType
- Example
import ftWebsocket from "futu-api";
import { Common, Qot_Common } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetResearchRatingSummary(){
const { RetType } = Common
const { QotMarket } = Qot_Common
let [addr, port, enable_ssl, key] = ["127.0.0.1", 33333, false, '7522027ccf5a06b1'];
let websocket = new ftWebsocket();
websocket.onlogin = (ret, msg)=>{
if (ret) {
const req = {
c2s: {
security: {
market: QotMarket.QotMarket_US_Security,
code: "AAPL",
},
},
};
websocket.GetResearchRatingSummary(req)
.then((res) => {
let { errCode, retMsg, retType,s2c } = res
console.log("GetResearchRatingSummary: 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("error", msg);
}
};
websocket.start(addr, port, enable_ssl, key);
setTimeout(()=>{
websocket.stop();
console.log("stop");
}, 5000);
}
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
- Output
GetResearchRatingSummary: errCode 0, retMsg , retType 0
{
"instRatingSummaryList": [{
"institutionInfo": {
"institutionUid": "8c9ae25a-07e2-4d52-a511-b0dd115a5224",
"institutionPictureUrl": "https://foss1.futunn.com/tip_rank_analysts_data_sync/prod/institution/8c9ae25a-07e2-4d52-a511-b0dd115a5224.jpeg",
"institutionName": "韦德布什",
"updateTime": "1709278279",
"updateTimeStr": "2024-03-01",
"institutionSourceName": "Wedbush",
"institutionEnName": "Wedbush"
},
"ratingItemList": [{
"institutionUid": "8c9ae25a-07e2-4d52-a511-b0dd115a5224",
"rating": "ResearchRatingType_Buy",
"targetPrice": 400,
"recommendationDate": "1778216400",
"recommendationDateStr": "2026-05-08",
"ratingUrl": "https://www.tipranks.com/news/the-fly/apple-price-target-raised-to-400-from-350-at-wedbush-thefly-news",
"updateTime": "1778322675652242",
"updateTimeStr": "2026-05-09"
//...
}]
//...
}],
"nextKey": "10"
}
stop
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
接口限制
- 每 30 秒内最多请求 30 次。
- 支持美股正股及 REIT。
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_research_rating_summary(code, rating_dimension_type=None, uid=None, num=None, next_key=None)
介绍
获取指定股票的机构或分析师评级汇总列表,或指定机构/分析师的评级详情,支持分页拉取
参数
参数 类型 说明 code str 股票代码 rating_dimension_type ResearchRatingDimensionType 评级维度 0=Unknown,1=Institution(机构维度),2=Analyst(分析师维度);默认机构维度uid str 机构或分析师 UID 空=取该股票的评级汇总列表
非空=取该 uid 对应的评级详情(分析师 uid 须搭配 rating_dimension_type=2)num int 每页返回数量 默认 10,范围 1~20next_key str 分页标识 首次不传,续拉时填上次返回的 next_key;"-1" 表示无更多数据返回
参数 类型 说明 ret RET_CODE 接口调用结果 data dict 当 ret == RET_OK,返回评级汇总数据字典 str 当 ret != RET_OK,返回错误描述 返回字典包含以下字段:
字段 类型 说明 inst_rating_summary_list list 机构评级汇总列表 uid 为空且 rating_dimension_type=1 时填充
每项含 institution_info 和 rating_item_listanalyst_rating_summary_list list 分析师评级汇总列表 uid 为空且 rating_dimension_type=2 时填充
每项含 analyst_info 和 rating_item_listinst_rating_detail dict 机构评级详情 uid 非空且 rating_dimension_type=1 时填充
含 institution_info、analyst_info_list 和 rating_item_listanalyst_rating_detail dict 分析师评级详情 uid 非空且 rating_dimension_type=2 时填充
含 analyst_info 和 rating_item_listnext_key str 分页标识 "-1" 表示无更多数据inst_rating_summary_list 每项字段(机构评级汇总行):
字段 类型 说明 institution_info dict 机构信息,见下表 rating_item_list list 评级记录列表,见下表 institution_info 字段(InstInfo):
字段 类型 说明 institution_uid str 机构唯一标识 institution_picture_url str 机构图片 URL institution_name str 机构名称 update_time int 更新时间戳(秒,对应市场时区) update_time_str str 更新日期 格式 YYYY-MM-DD,对应市场时区institution_source_name str 机构来源名称 institution_en_name str 机构英文名称 analyst_info 字段(AnalystInfo):
字段 类型 说明 analyst_uid str 分析师唯一标识 analyst_name str 分析师姓名 analyst_picture_url str 分析师头像 URL num_of_stars float 星级 0.0~5.0,如 3.50 表示 3.5 星success_rate float 成功率 百分号前的值,如 12.34 表示 12.34%excess_return float 超额收益 百分号前的值,如 12.34 表示 12.34%stock_success_rate float 个股成功率 百分号前的值,如 12.34 表示 12.34%stock_avg_return float 个股平均收益 百分号前的值,如 12.34 表示 12.34%institution_info dict 所属机构信息,见 institution_info 字段表 update_time int 更新时间戳(秒,对应市场时区) update_time_str str 更新日期 格式 YYYY-MM-DD,对应市场时区rating_item_list 每项字段(RatingItem):
字段 类型 说明 analyst_uid str 分析师唯一标识 institution_uid str 机构唯一标识 rating ResearchRatingType 评级 0=Unknown,1=Sell,2=Underperform,3=Hold,4=Buy,5=StrongBuy
本接口仅返回 Sell(1)/Hold(3)/Buy(4),数值越大评级越高target_price float 目标价 recommendation_date int 评级日期时间戳(秒,对应市场时区) recommendation_date_str str 评级日期 格式 YYYY-MM-DD,对应市场时区rating_url str 评级来源 URL update_time int 更新时间戳(秒,对应市场时区) update_time_str str 更新日期 格式 YYYY-MM-DD,对应市场时区
Example
from moomoo import *
import pandas as pd
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_research_rating_summary("US.AAPL", rating_dimension_type=1)
if ret == RET_OK:
rows = []
for row in data.get('inst_rating_summary_list', []):
info = row.get('institution_info', {})
rows.append({
'institution_name': info.get('institution_name', ''),
'institution_en_name': info.get('institution_en_name', ''),
'institution_uid': info.get('institution_uid', ''),
'institution_source_name': info.get('institution_source_name', ''),
'update_time_str': info.get('update_time_str', ''),
})
df = pd.DataFrame(rows)
print(df.to_string(index=False))
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
- Output
institution_name institution_en_name institution_uid institution_source_name update_time_str
韦德布什 Wedbush 8c9ae25a-07e2-4d52-a511-b0dd115a5224 Wedbush 2024-03-01
艾弗考尔 Evercore a746f081-c12a-4d6d-8067-f4b6634de478 Evercore ISI 2024-03-21
瑞士银行 UBS 1d3bfc25-1dda-48fd-bd9f-d4de47e68def UBS 2024-03-01
高盛集团 Goldman Sachs d0e296b4-c2e4-4fad-837c-cd79aaed2e8e Goldman Sachs 2024-03-01
联博集团 Bernstein 16358c98-ccc1-4d08-a875-2c727b7b8d70 Bernstein 2024-03-01
星展银行 DBS 44dec2a6-aca9-4b52-9fed-4bbf78749783 DBS 2024-03-01
美银证券 BofA Securities 7890753d-5482-4311-a7af-8d5feed39f3e Bank of America Securities 2024-03-01
辉立证券 Phillip Securities a294f0ca-10c0-4884-86a7-359995505e70 Phillip Securities 2024-09-09
摩根大通 J.P. Morgan f5ec822c-d561-4db3-a09d-a1e71a9a832f J.P. Morgan 2024-03-01
摩根士丹利 Morgan Stanley 9a29ac93-221c-4c1a-ba1a-bbbbf57a5ca6 Morgan Stanley 2024-03-01
2
3
4
5
6
7
8
9
10
11
# Qot_GetResearchRatingSummary.proto
介绍
获取评级汇总
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional Qot_Common.ResearchRatingDimensionType ratingDimensionType = 2; // 评级维度(详见 Qot_Common.ResearchRatingDimensionType 定义),默认机构维度
optional string uid = 3; // 空=取该股票的评级汇总列表;非空=取该 uid(institutionUid 或 analystUid)的评级详情
optional string nextKey = 4; // 分页标识,首次不填,续拉时填上次返回的 nextKey;"-1" 表示无更多数据
optional int32 num = 5; // 每页返回数量,默认 10,范围 1~20
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 股票结构参见 Security
- 评级维度类型参见 ResearchRatingDimensionType
- 返回
message InstInfo
{
optional string institutionUid = 1; // 机构唯一标识
optional string institutionPictureUrl = 2; // 机构图片 URL
optional string institutionName = 3; // 机构名称
optional int64 updateTime = 4; // 更新时间戳(秒)
optional string updateTimeStr = 5; // 更新时间字符串,格式 YYYY-MM-DD,对应市场时区
optional string institutionSourceName = 6; // 机构来源名称
optional string institutionEnName = 7; // 机构英文名称
}
message AnalystInfo
{
optional string analystUid = 1; // 分析师唯一标识
optional string analystName = 2; // 分析师姓名
optional string analystPictureUrl = 3; // 分析师头像 URL
optional double numOfStars = 4; // 星级(0.0~5.0,如 3.50 表示 3.5 星)
optional double successRate = 5; // 成功率,百分号前的值,如 12.34 表示 12.34%
optional double excessReturn = 6; // 超额收益,百分号前的值,如 12.34 表示 12.34%
optional double stockSuccessRate = 7; // 个股成功率,百分号前的值,如 12.34 表示 12.34%
optional double stockAvgReturn = 8; // 个股平均收益,百分号前的值,如 12.34 表示 12.34%
optional InstInfo institutionInfo = 9; // 所属机构信息
optional int64 updateTime = 10; // 更新时间戳(秒)
optional string updateTimeStr = 11; // 更新时间字符串,格式 YYYY-MM-DD,对应市场时区
}
message RatingItem
{
optional string analystUid = 1; // 分析师唯一标识
optional string institutionUid = 2; // 机构唯一标识
optional Qot_Common.ResearchRatingType rating = 3; // 评级(详见 Qot_Common.ResearchRatingType 定义),仅返回 Sell(1)/Hold(3)/Buy(4),数值越大评级越高
optional double targetPrice = 4; // 目标价
optional int64 recommendationDate = 5; // 评级日期时间戳(秒)
optional string recommendationDateStr = 6; // 评级日期字符串,格式 YYYY-MM-DD,对应市场时区
optional string ratingUrl = 7; // 评级来源 URL
optional int64 updateTime = 8; // 更新时间戳(秒)
optional string updateTimeStr = 9; // 更新时间字符串,格式 YYYY-MM-DD,对应市场时区
}
// 机构评级汇总行(uid 空, ratingDimensionType=1)
message InstRatingSummaryItem
{
optional InstInfo institutionInfo = 1; // 机构信息
repeated RatingItem ratingItemList = 2; // 该机构对该股票的评级记录列表
}
// 分析师评级汇总行(uid 空, ratingDimensionType=2)
message AnalystRatingSummaryItem
{
optional AnalystInfo analystInfo = 1; // 分析师信息
repeated RatingItem ratingItemList = 2; // 该分析师对该股票的评级记录列表
}
// 机构评级详情(uid 非空, ratingDimensionType=1)
message InstRatingDetail
{
optional InstInfo institutionInfo = 1; // 机构信息
repeated AnalystInfo analystInfoList = 2; // 机构下的分析师列表(精简版,不含 stockSuccessRate/stockAvgReturn/institutionInfo)
repeated RatingItem ratingItemList = 3; // 机构下的评级记录列表
}
// 分析师评级详情(uid 非空, ratingDimensionType=2)
message AnalystRatingDetail
{
optional AnalystInfo analystInfo = 1; // 分析师信息(含所属 institutionInfo)
repeated RatingItem ratingItemList = 2; // 该分析师对该股票的评级记录列表
}
message S2C
{
repeated InstRatingSummaryItem instRatingSummaryList = 1; // 机构评级汇总列表(uid 空, ratingDimensionType=1 时填充)
repeated AnalystRatingSummaryItem analystRatingSummaryList = 2; // 分析师评级汇总列表(uid 空, ratingDimensionType=2 时填充)
optional InstRatingDetail instRatingDetail = 3; // 机构评级详情(uid 非空, ratingDimensionType=1 时填充)
optional AnalystRatingDetail analystRatingDetail = 4; // 分析师评级详情(uid 非空, ratingDimensionType=2 时填充)
optional string nextKey = 5; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // 返回结果,详见 Common.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
- 接口调用结果,结构参见 RetType
- 分析师评级参见 ResearchRatingType
协议 ID
3230
uint GetResearchRatingSummary(QotGetResearchRatingSummary.Request req);
virtual void OnReply_GetResearchRatingSummary(MMAPI_Conn client, uint nSerialNo, QotGetResearchRatingSummary.Response rsp);
介绍
获取评级汇总
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional Qot_Common.ResearchRatingDimensionType ratingDimensionType = 2; // 评级维度(详见 Qot_Common.ResearchRatingDimensionType 定义),默认机构维度
optional string uid = 3; // 空=取该股票的评级汇总列表;非空=取该 uid(institutionUid 或 analystUid)的评级详情
optional string nextKey = 4; // 分页标识,首次不填,续拉时填上次返回的 nextKey;"-1" 表示无更多数据
optional int32 num = 5; // 每页返回数量,默认 10,范围 1~20
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 股票结构参见 Security
- 评级维度类型参见 ResearchRatingDimensionType
- 返回
message InstInfo
{
optional string institutionUid = 1; // 机构唯一标识
optional string institutionPictureUrl = 2; // 机构图片 URL
optional string institutionName = 3; // 机构名称
optional int64 updateTime = 4; // 更新时间戳(秒)
optional string updateTimeStr = 5; // 更新时间字符串,格式 YYYY-MM-DD,对应市场时区
optional string institutionSourceName = 6; // 机构来源名称
optional string institutionEnName = 7; // 机构英文名称
}
message AnalystInfo
{
optional string analystUid = 1; // 分析师唯一标识
optional string analystName = 2; // 分析师姓名
optional string analystPictureUrl = 3; // 分析师头像 URL
optional double numOfStars = 4; // 星级(0.0~5.0,如 3.50 表示 3.5 星)
optional double successRate = 5; // 成功率,百分号前的值,如 12.34 表示 12.34%
optional double excessReturn = 6; // 超额收益,百分号前的值,如 12.34 表示 12.34%
optional double stockSuccessRate = 7; // 个股成功率,百分号前的值,如 12.34 表示 12.34%
optional double stockAvgReturn = 8; // 个股平均收益,百分号前的值,如 12.34 表示 12.34%
optional InstInfo institutionInfo = 9; // 所属机构信息
optional int64 updateTime = 10; // 更新时间戳(秒)
optional string updateTimeStr = 11; // 更新时间字符串,格式 YYYY-MM-DD,对应市场时区
}
message RatingItem
{
optional string analystUid = 1; // 分析师唯一标识
optional string institutionUid = 2; // 机构唯一标识
optional Qot_Common.ResearchRatingType rating = 3; // 评级,仅返回 Sell(1)/Hold(3)/Buy(4)
optional double targetPrice = 4; // 目标价
optional int64 recommendationDate = 5; // 评级日期时间戳(秒)
optional string recommendationDateStr = 6; // 评级日期字符串,格式 YYYY-MM-DD
optional string ratingUrl = 7; // 评级来源 URL
optional int64 updateTime = 8; // 更新时间戳(秒)
optional string updateTimeStr = 9; // 更新时间字符串,格式 YYYY-MM-DD
}
message InstRatingSummaryItem
{
optional InstInfo institutionInfo = 1; // 机构信息
repeated RatingItem ratingItemList = 2; // 该机构对该股票的评级记录列表
}
message AnalystRatingSummaryItem
{
optional AnalystInfo analystInfo = 1; // 分析师信息
repeated RatingItem ratingItemList = 2; // 该分析师对该股票的评级记录列表
}
message InstRatingDetail
{
optional InstInfo institutionInfo = 1; // 机构信息
repeated AnalystInfo analystInfoList = 2; // 机构下的分析师列表
repeated RatingItem ratingItemList = 3; // 机构下的评级记录列表
}
message AnalystRatingDetail
{
optional AnalystInfo analystInfo = 1; // 分析师信息
repeated RatingItem ratingItemList = 2; // 该分析师对该股票的评级记录列表
}
message S2C
{
repeated InstRatingSummaryItem instRatingSummaryList = 1; // 机构评级汇总列表
repeated AnalystRatingSummaryItem analystRatingSummaryList = 2; // 分析师评级汇总列表
optional InstRatingDetail instRatingDetail = 3; // 机构评级详情
optional AnalystRatingDetail analystRatingDetail = 4; // 分析师评级详情
optional string nextKey = 5; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // 返回结果,详见 Common.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
- 接口调用结果,结构参见 RetType
- 分析师评级参见 ResearchRatingType
- 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}\n", errCode, desc, client.GetConnectID());
if (errCode != 0)
return;
QotCommon.Security sec = QotCommon.Security.CreateBuilder()
.SetMarket((int)QotCommon.QotMarket.QotMarket_US_Security)
.SetCode("AAPL")
.Build();
QotGetResearchRatingSummary.C2S c2s = QotGetResearchRatingSummary.C2S.CreateBuilder()
.SetSecurity(sec)
.Build();
QotGetResearchRatingSummary.Request req = QotGetResearchRatingSummary.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetResearchRatingSummary(req);
Console.Write("Send QotGetResearchRatingSummary: {0}\n", seqNo);
}
public void OnDisconnect(MMAPI_Conn client, long errCode)
{
Console.Write("Qot onDisConnect: {0}\n", errCode);
}
public void OnReply_GetResearchRatingSummary(MMAPI_Conn client, uint nSerialNo, QotGetResearchRatingSummary.Response rsp)
{
Console.Write("Reply: QotGetResearchRatingSummary: {0} {1}\n", nSerialNo, rsp.ToString());
}
public static void Main(String[] args)
{
MMAPI.Init();
Program qot = new Program();
qot.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
55
56
- Output
sent seqNo=3
retType: 0
retMsg: ""
errCode: 0
s2c {
instRatingSummaryList {
institutionInfo {
institutionUid: "8c9ae25a-07e2-4d52-a511-b0dd115a5224"
institutionPictureUrl: "https://foss1.futunn.com/tip_rank_analysts_data_sync/prod/institution/8c9ae25a-07e2-4d52-a511-b0dd115a5224.jpeg"
institutionName: "韦德布什"
updateTime: 1709278279
updateTimeStr: "2024-03-01"
institutionSourceName: "Wedbush"
institutionEnName: "Wedbush"
}
ratingItemList {
institutionUid: "8c9ae25a-07e2-4d52-a511-b0dd115a5224"
rating: ResearchRatingType_Buy
targetPrice: 400
recommendationDate: 1778216400
recommendationDateStr: "2026-05-08"
ratingUrl: "https://www.tipranks.com/news/the-fly/apple-price-target-raised-to-400-from-350-at-wedbush-thefly-news"
updateTime: 1778322675652242
updateTimeStr: "2026-05-09"
}
ratingItemList {
//...
}
}
instRatingSummaryList {
//...
}
nextKey: "10"
}
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
int getResearchRatingSummary(QotGetResearchRatingSummary.Request req);
void onReply_GetResearchRatingSummary(MMAPI_Conn client, int nSerialNo, QotGetResearchRatingSummary.Response rsp);
介绍
获取评级汇总
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional Qot_Common.ResearchRatingDimensionType ratingDimensionType = 2; // 评级维度(详见 Qot_Common.ResearchRatingDimensionType 定义),默认机构维度
optional string uid = 3; // 空=取该股票的评级汇总列表;非空=取该 uid(institutionUid 或 analystUid)的评级详情
optional string nextKey = 4; // 分页标识,首次不填,续拉时填上次返回的 nextKey;"-1" 表示无更多数据
optional int32 num = 5; // 每页返回数量,默认 10,范围 1~20
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 股票结构参见 Security
- 评级维度类型参见 ResearchRatingDimensionType
- 返回
message InstInfo
{
optional string institutionUid = 1; // 机构唯一标识
optional string institutionPictureUrl = 2; // 机构图片 URL
optional string institutionName = 3; // 机构名称
optional int64 updateTime = 4; // 更新时间戳(秒)
optional string updateTimeStr = 5; // 更新时间字符串,格式 YYYY-MM-DD,对应市场时区
optional string institutionSourceName = 6; // 机构来源名称
optional string institutionEnName = 7; // 机构英文名称
}
message AnalystInfo
{
optional string analystUid = 1; // 分析师唯一标识
optional string analystName = 2; // 分析师姓名
optional string analystPictureUrl = 3; // 分析师头像 URL
optional double numOfStars = 4; // 星级(0.0~5.0,如 3.50 表示 3.5 星)
optional double successRate = 5; // 成功率,百分号前的值,如 12.34 表示 12.34%
optional double excessReturn = 6; // 超额收益,百分号前的值,如 12.34 表示 12.34%
optional double stockSuccessRate = 7; // 个股成功率,百分号前的值,如 12.34 表示 12.34%
optional double stockAvgReturn = 8; // 个股平均收益,百分号前的值,如 12.34 表示 12.34%
optional InstInfo institutionInfo = 9; // 所属机构信息
optional int64 updateTime = 10; // 更新时间戳(秒)
optional string updateTimeStr = 11; // 更新时间字符串,格式 YYYY-MM-DD,对应市场时区
}
message RatingItem
{
optional string analystUid = 1; // 分析师唯一标识
optional string institutionUid = 2; // 机构唯一标识
optional Qot_Common.ResearchRatingType rating = 3; // 评级,仅返回 Sell(1)/Hold(3)/Buy(4)
optional double targetPrice = 4; // 目标价
optional int64 recommendationDate = 5; // 评级日期时间戳(秒)
optional string recommendationDateStr = 6; // 评级日期字符串,格式 YYYY-MM-DD
optional string ratingUrl = 7; // 评级来源 URL
optional int64 updateTime = 8; // 更新时间戳(秒)
optional string updateTimeStr = 9; // 更新时间字符串,格式 YYYY-MM-DD
}
message InstRatingSummaryItem
{
optional InstInfo institutionInfo = 1; // 机构信息
repeated RatingItem ratingItemList = 2; // 该机构对该股票的评级记录列表
}
message AnalystRatingSummaryItem
{
optional AnalystInfo analystInfo = 1; // 分析师信息
repeated RatingItem ratingItemList = 2; // 该分析师对该股票的评级记录列表
}
message InstRatingDetail
{
optional InstInfo institutionInfo = 1; // 机构信息
repeated AnalystInfo analystInfoList = 2; // 机构下的分析师列表
repeated RatingItem ratingItemList = 3; // 机构下的评级记录列表
}
message AnalystRatingDetail
{
optional AnalystInfo analystInfo = 1; // 分析师信息
repeated RatingItem ratingItemList = 2; // 该分析师对该股票的评级记录列表
}
message S2C
{
repeated InstRatingSummaryItem instRatingSummaryList = 1; // 机构评级汇总列表
repeated AnalystRatingSummaryItem analystRatingSummaryList = 2; // 分析师评级汇总列表
optional InstRatingDetail instRatingDetail = 3; // 机构评级详情
optional AnalystRatingDetail analystRatingDetail = 4; // 分析师评级详情
optional string nextKey = 5; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // 返回结果,详见 Common.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
- 接口调用结果,结构参见 RetType
- 分析师评级参见 ResearchRatingType
- 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=%b desc=%s connID=%d\n", errCode, desc, client.getConnectID());
if (errCode != 0)
return;
QotCommon.Security sec = QotCommon.Security.newBuilder()
.setMarket(QotCommon.QotMarket.QotMarket_US_Security_VALUE)
.setCode("AAPL")
.build();
QotGetResearchRatingSummary.C2S c2s = QotGetResearchRatingSummary.C2S.newBuilder()
.setSecurity(sec)
.build();
QotGetResearchRatingSummary.Request req = QotGetResearchRatingSummary.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getResearchRatingSummary(req);
System.out.printf("Send QotGetResearchRatingSummary: %d\n", seqNo);
}
@Override
public void onDisconnect(MMAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d\n", errCode);
}
@Override
public void onReply_GetResearchRatingSummary(MMAPI_Conn client, int nSerialNo, QotGetResearchRatingSummary.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetResearchRatingSummary failed: %s\n", rsp.getRetMsg());
}
else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetResearchRatingSummary: %s\n", 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
- Output
Qot onInitConnect: ret=0 desc= connID=7459213530564494444
Send Qot_GetResearchRatingSummary: 2
Receive Qot_GetResearchRatingSummary: retType: 0
retMsg: ""
errCode: 0
s2c {
instRatingSummaryList {
institutionInfo {
institutionUid: "8c9ae25a-07e2-4d52-a511-b0dd115a5224"
institutionPictureUrl: "https://foss1.futunn.com/tip_rank_analysts_data_sync/prod/institution/8c9ae25a-07e2-4d52-a511-b0dd115a5224.jpeg"
institutionName: "韦德布什"
updateTime: 1709278279
updateTimeStr: "2024-03-01"
institutionSourceName: "Wedbush"
institutionEnName: "Wedbush"
}
ratingItemList {
institutionUid: "8c9ae25a-07e2-4d52-a511-b0dd115a5224"
rating: ResearchRatingType_Buy
targetPrice: 400.0
recommendationDate: 1778216400
recommendationDateStr: "2026-05-08"
ratingUrl: "https://www.tipranks.com/news/the-fly/apple-price-target-raised-to-400-from-350-at-wedbush-thefly-news"
updateTime: 1778322675652242
updateTimeStr: "2026-05-09"
}
ratingItemList {
//...
}
}
instRatingSummaryList {
//...
}
nextKey: "10"
}
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
moomoo::u32_t GetResearchRatingSummary(const Qot_GetResearchRatingSummary::Request &stReq);
virtual void OnReply_GetResearchRatingSummary(moomoo::u32_t nSerialNo, const Qot_GetResearchRatingSummary::Response &stRsp) = 0;
介绍
获取评级汇总
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional Qot_Common.ResearchRatingDimensionType ratingDimensionType = 2; // 评级维度(详见 Qot_Common.ResearchRatingDimensionType 定义),默认机构维度
optional string uid = 3; // 空=取该股票的评级汇总列表;非空=取该 uid(institutionUid 或 analystUid)的评级详情
optional string nextKey = 4; // 分页标识,首次不填,续拉时填上次返回的 nextKey;"-1" 表示无更多数据
optional int32 num = 5; // 每页返回数量,默认 10,范围 1~20
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 股票结构参见 Security
- 评级维度类型参见 ResearchRatingDimensionType
- 返回
message InstInfo
{
optional string institutionUid = 1; // 机构唯一标识
optional string institutionPictureUrl = 2; // 机构图片 URL
optional string institutionName = 3; // 机构名称
optional int64 updateTime = 4; // 更新时间戳(秒)
optional string updateTimeStr = 5; // 更新时间字符串,格式 YYYY-MM-DD,对应市场时区
optional string institutionSourceName = 6; // 机构来源名称
optional string institutionEnName = 7; // 机构英文名称
}
message AnalystInfo
{
optional string analystUid = 1; // 分析师唯一标识
optional string analystName = 2; // 分析师姓名
optional string analystPictureUrl = 3; // 分析师头像 URL
optional double numOfStars = 4; // 星级(0.0~5.0,如 3.50 表示 3.5 星)
optional double successRate = 5; // 成功率,百分号前的值,如 12.34 表示 12.34%
optional double excessReturn = 6; // 超额收益,百分号前的值,如 12.34 表示 12.34%
optional double stockSuccessRate = 7; // 个股成功率,百分号前的值,如 12.34 表示 12.34%
optional double stockAvgReturn = 8; // 个股平均收益,百分号前的值,如 12.34 表示 12.34%
optional InstInfo institutionInfo = 9; // 所属机构信息
optional int64 updateTime = 10; // 更新时间戳(秒)
optional string updateTimeStr = 11; // 更新时间字符串,格式 YYYY-MM-DD,对应市场时区
}
message RatingItem
{
optional string analystUid = 1; // 分析师唯一标识
optional string institutionUid = 2; // 机构唯一标识
optional Qot_Common.ResearchRatingType rating = 3; // 评级,仅返回 Sell(1)/Hold(3)/Buy(4)
optional double targetPrice = 4; // 目标价
optional int64 recommendationDate = 5; // 评级日期时间戳(秒)
optional string recommendationDateStr = 6; // 评级日期字符串,格式 YYYY-MM-DD
optional string ratingUrl = 7; // 评级来源 URL
optional int64 updateTime = 8; // 更新时间戳(秒)
optional string updateTimeStr = 9; // 更新时间字符串,格式 YYYY-MM-DD
}
message InstRatingSummaryItem
{
optional InstInfo institutionInfo = 1; // 机构信息
repeated RatingItem ratingItemList = 2; // 该机构对该股票的评级记录列表
}
message AnalystRatingSummaryItem
{
optional AnalystInfo analystInfo = 1; // 分析师信息
repeated RatingItem ratingItemList = 2; // 该分析师对该股票的评级记录列表
}
message InstRatingDetail
{
optional InstInfo institutionInfo = 1; // 机构信息
repeated AnalystInfo analystInfoList = 2; // 机构下的分析师列表
repeated RatingItem ratingItemList = 3; // 机构下的评级记录列表
}
message AnalystRatingDetail
{
optional AnalystInfo analystInfo = 1; // 分析师信息
repeated RatingItem ratingItemList = 2; // 该分析师对该股票的评级记录列表
}
message S2C
{
repeated InstRatingSummaryItem instRatingSummaryList = 1; // 机构评级汇总列表
repeated AnalystRatingSummaryItem analystRatingSummaryList = 2; // 分析师评级汇总列表
optional InstRatingDetail instRatingDetail = 3; // 机构评级详情
optional AnalystRatingDetail analystRatingDetail = 4; // 分析师评级详情
optional string nextKey = 5; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // 返回结果,详见 Common.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
- 接口调用结果,结构参见 RetType
- 分析师评级参见 ResearchRatingType
- Example
class Program : public MMSPI_Qot, public MMSPI_Trd, 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) {
cout << "connect" << endl;
// construct request message
Qot_GetResearchRatingSummary::Request req;
Qot_GetResearchRatingSummary::C2S *c2s = req.mutable_c2s();
Qot_Common::Security *sec = c2s->mutable_security();
sec->set_code("AAPL");
sec->set_market(Qot_Common::QotMarket::QotMarket_US_Security);
m_pQotApi->GetResearchRatingSummary(req);
cout << "GetResearchRatingSummary" << endl;
}
virtual void OnReply_GetResearchRatingSummary(moomoo::u32_t nSerialNo, const Qot_GetResearchRatingSummary::Response &stRsp){
cout << "OnReply_GetResearchRatingSummary:" << endl;
// print response
// ProtoBufToBodyData and UTF8ToLocal refer to tool.h in Samples
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
MMAPI_Qot *m_pQotApi;
};
int32_t main(int32_t argc, char** argv)
{
MMAPI::Init();
{
Program program;
program.Start();
getchar();
}
protobuf::ShutdownProtobufLibrary();
MMAPI::UnInit();
return 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
- Output
onInitConnect: ret=0 desc=Succeed!
Send Qot_GetResearchRatingSummary seqNo=3
retType: 0
retMsg: ""
errCode: 0
s2c {
instRatingSummaryList {
institutionInfo {
institutionUid: "8c9ae25a-07e2-4d52-a511-b0dd115a5224"
institutionPictureUrl: "https://foss1.futunn.com/tip_rank_analysts_data_sync/prod/institution/8c9ae25a-07e2-4d52-a511-b0dd115a5224.jpeg"
institutionName: "韦德布什"
updateTime: 1709278279
updateTimeStr: "2024-03-01"
institutionSourceName: "Wedbush"
institutionEnName: "Wedbush"
}
ratingItemList {
institutionUid: "8c9ae25a-07e2-4d52-a511-b0dd115a5224"
rating: ResearchRatingType_Buy
targetPrice: 400
recommendationDate: 1778216400
recommendationDateStr: "2026-05-08"
ratingUrl: "https://www.tipranks.com/news/the-fly/apple-price-target-raised-to-400-from-350-at-wedbush-thefly-news"
updateTime: 1778322675652242
updateTimeStr: "2026-05-09"
}
ratingItemList {
//...
}
}
instRatingSummaryList {
//...
}
nextKey: "10"
}
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
GetResearchRatingSummary(req);
介绍
获取评级汇总
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional Qot_Common.ResearchRatingDimensionType ratingDimensionType = 2; // 评级维度(详见 Qot_Common.ResearchRatingDimensionType 定义),默认机构维度
optional string uid = 3; // 空=取该股票的评级汇总列表;非空=取该 uid(institutionUid 或 analystUid)的评级详情
optional string nextKey = 4; // 分页标识,首次不填,续拉时填上次返回的 nextKey;"-1" 表示无更多数据
optional int32 num = 5; // 每页返回数量,默认 10,范围 1~20
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 股票结构参见 Security
- 评级维度类型参见 ResearchRatingDimensionType
- 返回
message InstInfo
{
optional string institutionUid = 1; // 机构唯一标识
optional string institutionPictureUrl = 2; // 机构图片 URL
optional string institutionName = 3; // 机构名称
optional int64 updateTime = 4; // 更新时间戳(秒)
optional string updateTimeStr = 5; // 更新时间字符串,格式 YYYY-MM-DD,对应市场时区
optional string institutionSourceName = 6; // 机构来源名称
optional string institutionEnName = 7; // 机构英文名称
}
message AnalystInfo
{
optional string analystUid = 1; // 分析师唯一标识
optional string analystName = 2; // 分析师姓名
optional string analystPictureUrl = 3; // 分析师头像 URL
optional double numOfStars = 4; // 星级(0.0~5.0,如 3.50 表示 3.5 星)
optional double successRate = 5; // 成功率,百分号前的值,如 12.34 表示 12.34%
optional double excessReturn = 6; // 超额收益,百分号前的值,如 12.34 表示 12.34%
optional double stockSuccessRate = 7; // 个股成功率,百分号前的值,如 12.34 表示 12.34%
optional double stockAvgReturn = 8; // 个股平均收益,百分号前的值,如 12.34 表示 12.34%
optional InstInfo institutionInfo = 9; // 所属机构信息
optional int64 updateTime = 10; // 更新时间戳(秒)
optional string updateTimeStr = 11; // 更新时间字符串,格式 YYYY-MM-DD,对应市场时区
}
message RatingItem
{
optional string analystUid = 1; // 分析师唯一标识
optional string institutionUid = 2; // 机构唯一标识
optional Qot_Common.ResearchRatingType rating = 3; // 评级,仅返回 Sell(1)/Hold(3)/Buy(4)
optional double targetPrice = 4; // 目标价
optional int64 recommendationDate = 5; // 评级日期时间戳(秒)
optional string recommendationDateStr = 6; // 评级日期字符串,格式 YYYY-MM-DD
optional string ratingUrl = 7; // 评级来源 URL
optional int64 updateTime = 8; // 更新时间戳(秒)
optional string updateTimeStr = 9; // 更新时间字符串,格式 YYYY-MM-DD
}
message InstRatingSummaryItem
{
optional InstInfo institutionInfo = 1; // 机构信息
repeated RatingItem ratingItemList = 2; // 该机构对该股票的评级记录列表
}
message AnalystRatingSummaryItem
{
optional AnalystInfo analystInfo = 1; // 分析师信息
repeated RatingItem ratingItemList = 2; // 该分析师对该股票的评级记录列表
}
message InstRatingDetail
{
optional InstInfo institutionInfo = 1; // 机构信息
repeated AnalystInfo analystInfoList = 2; // 机构下的分析师列表
repeated RatingItem ratingItemList = 3; // 机构下的评级记录列表
}
message AnalystRatingDetail
{
optional AnalystInfo analystInfo = 1; // 分析师信息
repeated RatingItem ratingItemList = 2; // 该分析师对该股票的评级记录列表
}
message S2C
{
repeated InstRatingSummaryItem instRatingSummaryList = 1; // 机构评级汇总列表
repeated AnalystRatingSummaryItem analystRatingSummaryList = 2; // 分析师评级汇总列表
optional InstRatingDetail instRatingDetail = 3; // 机构评级详情
optional AnalystRatingDetail analystRatingDetail = 4; // 分析师评级详情
optional string nextKey = 5; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // 返回结果,详见 Common.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
- 接口调用结果,结构参见 RetType
- 分析师评级参见 ResearchRatingType
- Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_Common } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetResearchRatingSummary(){
const { RetType } = Common
const { QotMarket } = Qot_Common
let [addr, port, enable_ssl, key] = ["127.0.0.1", 33333, false, '7522027ccf5a06b1'];
let websocket = new mmWebsocket();
websocket.onlogin = (ret, msg)=>{
if (ret) {
const req = {
c2s: {
security: {
market: QotMarket.QotMarket_US_Security,
code: "AAPL",
},
},
};
websocket.GetResearchRatingSummary(req)
.then((res) => {
let { errCode, retMsg, retType,s2c } = res
console.log("GetResearchRatingSummary: 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("error", msg);
}
};
websocket.start(addr, port, enable_ssl, key);
setTimeout(()=>{
websocket.stop();
console.log("stop");
}, 5000);
}
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
- Output
GetResearchRatingSummary: errCode 0, retMsg , retType 0
{
"instRatingSummaryList": [{
"institutionInfo": {
"institutionUid": "8c9ae25a-07e2-4d52-a511-b0dd115a5224",
"institutionPictureUrl": "https://foss1.futunn.com/tip_rank_analysts_data_sync/prod/institution/8c9ae25a-07e2-4d52-a511-b0dd115a5224.jpeg",
"institutionName": "韦德布什",
"updateTime": "1709278279",
"updateTimeStr": "2024-03-01",
"institutionSourceName": "Wedbush",
"institutionEnName": "Wedbush"
},
"ratingItemList": [{
"institutionUid": "8c9ae25a-07e2-4d52-a511-b0dd115a5224",
"rating": "ResearchRatingType_Buy",
"targetPrice": 400,
"recommendationDate": "1778216400",
"recommendationDateStr": "2026-05-08",
"ratingUrl": "https://www.tipranks.com/news/the-fly/apple-price-target-raised-to-400-from-350-at-wedbush-thefly-news",
"updateTime": "1778322675652242",
"updateTimeStr": "2026-05-09"
//...
}]
//...
}],
"nextKey": "10"
}
stop
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
接口限制
- 每 30 秒内最多请求 30 次。
- 支持美股正股及 REIT。