# Get Research Rating Summary
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_research_rating_summary(code, rating_dimension_type=None, uid=None, num=None, next_key=None)
Description
Get the institution or analyst rating summary list for the specified stock, or the rating detail for a specified institution/analyst, with pagination support
Parameters
Parameter Type Description code str Stock code rating_dimension_type ResearchRatingDimensionType Rating dimension 0=Unknown, 1=Institution, 2=Analyst; default is Institutionuid str Institution or analyst UID Empty=get rating summary list for the stock
non-empty=get rating detail for the specified uid (analyst uid must be used with rating_dimension_type=2)num int Number of items per page Default 10, range 1~20next_key str Pagination key Leave empty on first request; pass the next_key returned from the previous response to continue; "-1" means no more dataReturn
Parameter Type Description ret RET_CODE API call result data dict If ret == RET_OK, returns rating summary data dict str If ret != RET_OK, returns error description The returned dict contains the following fields:
Field Type Description inst_rating_summary_list list Institution rating summary list Populated when uid is empty and rating_dimension_type=1
each item contains institution_info and rating_item_listanalyst_rating_summary_list list Analyst rating summary list Populated when uid is empty and rating_dimension_type=2
each item contains analyst_info and rating_item_listinst_rating_detail dict Institution rating detail Populated when uid is non-empty and rating_dimension_type=1
contains institution_info, analyst_info_list, and rating_item_listanalyst_rating_detail dict Analyst rating detail Populated when uid is non-empty and rating_dimension_type=2
contains analyst_info and rating_item_listnext_key str Pagination key "-1" means no more dataFields in each item of inst_rating_summary_list (institution rating summary row):
Field Type Description institution_info dict Institution info, see table below rating_item_list list Rating record list, see table below institution_info fields (InstInfo):
Field Type Description institution_uid str Institution unique identifier institution_picture_url str Institution picture URL institution_name str Institution name update_time int Update timestamp Seconds, in market timezoneupdate_time_str str Update date Format YYYY-MM-DD, in market timezoneinstitution_source_name str Institution source name institution_en_name str Institution English name analyst_info fields (AnalystInfo):
Field Type Description analyst_uid str Analyst unique identifier analyst_name str Analyst name analyst_picture_url str Analyst avatar URL num_of_stars float Star rating 0.0~5.0, e.g. 3.50 means 3.5 starssuccess_rate float Success rate Value before the percent sign, e.g. 12.34 means 12.34%excess_return float Excess return Value before the percent sign, e.g. 12.34 means 12.34%stock_success_rate float Stock success rate Value before the percent sign, e.g. 12.34 means 12.34%stock_avg_return float Stock average return Value before the percent sign, e.g. 12.34 means 12.34%institution_info dict Affiliated institution info, see institution_info field table update_time int Update timestamp Seconds, in market timezoneupdate_time_str str Update date Format YYYY-MM-DD, in market timezoneFields in each item of rating_item_list (RatingItem):
Field Type Description analyst_uid str Analyst unique identifier institution_uid str Institution unique identifier rating ResearchRatingType Rating 0=Unknown, 1=Sell, 2=Underperform, 3=Hold, 4=Buy, 5=StrongBuy
this API only returns Sell(1)/Hold(3)/Buy(4), higher value means higher ratingtarget_price float Target price recommendation_date int Rating date timestamp Seconds, in market timezonerecommendation_date_str str Rating date Format YYYY-MM-DD, in market timezonerating_url str Rating source URL update_time int Update timestamp Seconds, in market timezoneupdate_time_str str Update date Format YYYY-MM-DD, in market timezone
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 Wedbush 8c9ae25a-07e2-4d52-a511-b0dd115a5224 Wedbush 2024-03-01
Evercore Evercore a746f081-c12a-4d6d-8067-f4b6634de478 Evercore ISI 2024-03-21
UBS UBS 1d3bfc25-1dda-48fd-bd9f-d4de47e68def UBS 2024-03-01
Goldman Sachs Goldman Sachs d0e296b4-c2e4-4fad-837c-cd79aaed2e8e Goldman Sachs 2024-03-01
Bernstein Bernstein 16358c98-ccc1-4d08-a875-2c727b7b8d70 Bernstein 2024-03-01
DBS DBS 44dec2a6-aca9-4b52-9fed-4bbf78749783 DBS 2024-03-01
BofA Securities BofA Securities 7890753d-5482-4311-a7af-8d5feed39f3e Bank of America Securities 2024-03-01
Phillip Securities Phillip Securities a294f0ca-10c0-4884-86a7-359995505e70 Phillip Securities 2024-09-09
J.P. Morgan J.P. Morgan f5ec822c-d561-4db3-a09d-a1e71a9a832f J.P. Morgan 2024-03-01
Morgan Stanley 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
Description
Get research rating summary
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional Qot_Common.ResearchRatingDimensionType ratingDimensionType = 2; // Rating dimension (see Qot_Common.ResearchRatingDimensionType), default is Institution
optional string uid = 3; // Empty=get rating summary list for the stock; non-empty=get rating detail for the specified uid (institutionUid or analystUid)
optional string nextKey = 4; // Pagination key; leave empty on first request; pass returned nextKey to continue; "-1" means no more data
optional int32 num = 5; // Number of items per page, default 10, range 1~20
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Security structure see Security
- Rating dimension type see ResearchRatingDimensionType
- Return
message InstInfo
{
optional string institutionUid = 1; // Institution unique identifier
optional string institutionPictureUrl = 2; // Institution picture URL
optional string institutionName = 3; // Institution name
optional int64 updateTime = 4; // Update timestamp (seconds)
optional string updateTimeStr = 5; // Update time string, format YYYY-MM-DD, in market timezone
optional string institutionSourceName = 6; // Institution source name
optional string institutionEnName = 7; // Institution English name
}
message AnalystInfo
{
optional string analystUid = 1; // Analyst unique identifier
optional string analystName = 2; // Analyst name
optional string analystPictureUrl = 3; // Analyst avatar URL
optional double numOfStars = 4; // Star rating (0.0~5.0, e.g. 3.50 means 3.5 stars)
optional double successRate = 5; // Success rate, value before the percent sign, e.g. 12.34 means 12.34%
optional double excessReturn = 6; // Excess return, value before the percent sign, e.g. 12.34 means 12.34%
optional double stockSuccessRate = 7; // Stock success rate, value before the percent sign, e.g. 12.34 means 12.34%
optional double stockAvgReturn = 8; // Stock average return, value before the percent sign, e.g. 12.34 means 12.34%
optional InstInfo institutionInfo = 9; // Affiliated institution info
optional int64 updateTime = 10; // Update timestamp (seconds)
optional string updateTimeStr = 11; // Update time string, format YYYY-MM-DD, in market timezone
}
message RatingItem
{
optional string analystUid = 1; // Analyst unique identifier
optional string institutionUid = 2; // Institution unique identifier
optional Qot_Common.ResearchRatingType rating = 3; // Rating (see Qot_Common.ResearchRatingType), only returns Sell(1)/Hold(3)/Buy(4), higher value means higher rating
optional double targetPrice = 4; // Target price
optional int64 recommendationDate = 5; // Rating date timestamp (seconds)
optional string recommendationDateStr = 6; // Rating date string, format YYYY-MM-DD, in market timezone
optional string ratingUrl = 7; // Rating source URL
optional int64 updateTime = 8; // Update timestamp (seconds)
optional string updateTimeStr = 9; // Update time string, format YYYY-MM-DD, in market timezone
}
// Institution rating summary row (uid empty, ratingDimensionType=1)
message InstRatingSummaryItem
{
optional InstInfo institutionInfo = 1; // Institution info
repeated RatingItem ratingItemList = 2; // Rating record list for this institution on this stock
}
// Analyst rating summary row (uid empty, ratingDimensionType=2)
message AnalystRatingSummaryItem
{
optional AnalystInfo analystInfo = 1; // Analyst info
repeated RatingItem ratingItemList = 2; // Rating record list for this analyst on this stock
}
// Institution rating detail (uid non-empty, ratingDimensionType=1)
message InstRatingDetail
{
optional InstInfo institutionInfo = 1; // Institution info
repeated AnalystInfo analystInfoList = 2; // Analyst list under this institution (simplified, without stockSuccessRate/stockAvgReturn/institutionInfo)
repeated RatingItem ratingItemList = 3; // Rating record list under this institution
}
// Analyst rating detail (uid non-empty, ratingDimensionType=2)
message AnalystRatingDetail
{
optional AnalystInfo analystInfo = 1; // Analyst info (including affiliated institutionInfo)
repeated RatingItem ratingItemList = 2; // Rating record list for this analyst on this stock
}
message S2C
{
repeated InstRatingSummaryItem instRatingSummaryList = 1; // Institution rating summary list (populated when uid empty, ratingDimensionType=1)
repeated AnalystRatingSummaryItem analystRatingSummaryList = 2; // Analyst rating summary list (populated when uid empty, ratingDimensionType=2)
optional InstRatingDetail instRatingDetail = 3; // Institution rating detail (populated when uid non-empty, ratingDimensionType=1)
optional AnalystRatingDetail analystRatingDetail = 4; // Analyst rating detail (populated when uid non-empty, ratingDimensionType=2)
optional string nextKey = 5; // Pagination key, "-1" means no more data
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return result description
optional int32 errCode = 3; // Error code
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
- API call result structure see RetType
- Rating type see ResearchRatingType
Protocol ID
3230
uint GetResearchRatingSummary(QotGetResearchRatingSummary.Request req);
virtual void OnReply_GetResearchRatingSummary(FTAPI_Conn client, uint nSerialNo, QotGetResearchRatingSummary.Response rsp);
Description
Get research rating summary
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional Qot_Common.ResearchRatingDimensionType ratingDimensionType = 2; // Rating dimension (see Qot_Common.ResearchRatingDimensionType), default is Institution
optional string uid = 3; // Empty=get rating summary list; non-empty=get rating detail for the specified uid
optional string nextKey = 4; // Pagination key; leave empty on first request; "-1" means no more data
optional int32 num = 5; // Number of items per page, default 10, range 1~20
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Security structure see Security
- Rating dimension type see ResearchRatingDimensionType
- Return
message InstInfo
{
optional string institutionUid = 1; // Institution unique identifier
optional string institutionPictureUrl = 2; // Institution picture URL
optional string institutionName = 3; // Institution name
optional int64 updateTime = 4; // Update timestamp (seconds)
optional string updateTimeStr = 5; // Update time string, format YYYY-MM-DD, in market timezone
optional string institutionSourceName = 6; // Institution source name
optional string institutionEnName = 7; // Institution English name
}
message AnalystInfo
{
optional string analystUid = 1; // Analyst unique identifier
optional string analystName = 2; // Analyst name
optional string analystPictureUrl = 3; // Analyst avatar URL
optional double numOfStars = 4; // Star rating (0.0~5.0)
optional double successRate = 5; // Success rate, value before the percent sign
optional double excessReturn = 6; // Excess return, value before the percent sign
optional double stockSuccessRate = 7; // Stock success rate, value before the percent sign
optional double stockAvgReturn = 8; // Stock average return, value before the percent sign
optional InstInfo institutionInfo = 9; // Affiliated institution info
optional int64 updateTime = 10; // Update timestamp (seconds)
optional string updateTimeStr = 11; // Update time string, format YYYY-MM-DD
}
message RatingItem
{
optional string analystUid = 1; // Analyst unique identifier
optional string institutionUid = 2; // Institution unique identifier
optional Qot_Common.ResearchRatingType rating = 3; // Rating, only returns Sell(1)/Hold(3)/Buy(4)
optional double targetPrice = 4; // Target price
optional int64 recommendationDate = 5; // Rating date timestamp (seconds)
optional string recommendationDateStr = 6; // Rating date string, format YYYY-MM-DD
optional string ratingUrl = 7; // Rating source URL
optional int64 updateTime = 8; // Update timestamp (seconds)
optional string updateTimeStr = 9; // Update time string, format YYYY-MM-DD
}
message InstRatingSummaryItem
{
optional InstInfo institutionInfo = 1; // Institution info
repeated RatingItem ratingItemList = 2; // Rating record list for this institution
}
message AnalystRatingSummaryItem
{
optional AnalystInfo analystInfo = 1; // Analyst info
repeated RatingItem ratingItemList = 2; // Rating record list for this analyst
}
message InstRatingDetail
{
optional InstInfo institutionInfo = 1; // Institution info
repeated AnalystInfo analystInfoList = 2; // Analyst list under this institution
repeated RatingItem ratingItemList = 3; // Rating record list under this institution
}
message AnalystRatingDetail
{
optional AnalystInfo analystInfo = 1; // Analyst info
repeated RatingItem ratingItemList = 2; // Rating record list for this analyst
}
message S2C
{
repeated InstRatingSummaryItem instRatingSummaryList = 1; // Institution rating summary list
repeated AnalystRatingSummaryItem analystRatingSummaryList = 2; // Analyst rating summary list
optional InstRatingDetail instRatingDetail = 3; // Institution rating detail
optional AnalystRatingDetail analystRatingDetail = 4; // Analyst rating detail
optional string nextKey = 5; // Pagination key, "-1" means no more data
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return result description
optional int32 errCode = 3; // Error code
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
- API call result structure see RetType
- Rating type see 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: "Wedbush"
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);
Description
Get research rating summary
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional Qot_Common.ResearchRatingDimensionType ratingDimensionType = 2; // Rating dimension (see Qot_Common.ResearchRatingDimensionType), default is Institution
optional string uid = 3; // Empty=get rating summary list; non-empty=get rating detail for the specified uid
optional string nextKey = 4; // Pagination key; leave empty on first request; "-1" means no more data
optional int32 num = 5; // Number of items per page, default 10, range 1~20
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Security structure see Security
- Rating dimension type see ResearchRatingDimensionType
- Return
message InstInfo
{
optional string institutionUid = 1; // Institution unique identifier
optional string institutionPictureUrl = 2; // Institution picture URL
optional string institutionName = 3; // Institution name
optional int64 updateTime = 4; // Update timestamp (seconds)
optional string updateTimeStr = 5; // Update time string, format YYYY-MM-DD, in market timezone
optional string institutionSourceName = 6; // Institution source name
optional string institutionEnName = 7; // Institution English name
}
message AnalystInfo
{
optional string analystUid = 1; // Analyst unique identifier
optional string analystName = 2; // Analyst name
optional string analystPictureUrl = 3; // Analyst avatar URL
optional double numOfStars = 4; // Star rating (0.0~5.0)
optional double successRate = 5; // Success rate, value before the percent sign
optional double excessReturn = 6; // Excess return, value before the percent sign
optional double stockSuccessRate = 7; // Stock success rate, value before the percent sign
optional double stockAvgReturn = 8; // Stock average return, value before the percent sign
optional InstInfo institutionInfo = 9; // Affiliated institution info
optional int64 updateTime = 10; // Update timestamp (seconds)
optional string updateTimeStr = 11; // Update time string, format YYYY-MM-DD
}
message RatingItem
{
optional string analystUid = 1; // Analyst unique identifier
optional string institutionUid = 2; // Institution unique identifier
optional Qot_Common.ResearchRatingType rating = 3; // Rating, only returns Sell(1)/Hold(3)/Buy(4)
optional double targetPrice = 4; // Target price
optional int64 recommendationDate = 5; // Rating date timestamp (seconds)
optional string recommendationDateStr = 6; // Rating date string, format YYYY-MM-DD
optional string ratingUrl = 7; // Rating source URL
optional int64 updateTime = 8; // Update timestamp (seconds)
optional string updateTimeStr = 9; // Update time string, format YYYY-MM-DD
}
message InstRatingSummaryItem
{
optional InstInfo institutionInfo = 1; // Institution info
repeated RatingItem ratingItemList = 2; // Rating record list for this institution
}
message AnalystRatingSummaryItem
{
optional AnalystInfo analystInfo = 1; // Analyst info
repeated RatingItem ratingItemList = 2; // Rating record list for this analyst
}
message InstRatingDetail
{
optional InstInfo institutionInfo = 1; // Institution info
repeated AnalystInfo analystInfoList = 2; // Analyst list under this institution
repeated RatingItem ratingItemList = 3; // Rating record list under this institution
}
message AnalystRatingDetail
{
optional AnalystInfo analystInfo = 1; // Analyst info
repeated RatingItem ratingItemList = 2; // Rating record list for this analyst
}
message S2C
{
repeated InstRatingSummaryItem instRatingSummaryList = 1; // Institution rating summary list
repeated AnalystRatingSummaryItem analystRatingSummaryList = 2; // Analyst rating summary list
optional InstRatingDetail instRatingDetail = 3; // Institution rating detail
optional AnalystRatingDetail analystRatingDetail = 4; // Analyst rating detail
optional string nextKey = 5; // Pagination key, "-1" means no more data
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return result description
optional int32 errCode = 3; // Error code
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
- API call result structure see RetType
- Rating type see 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=7459212582745187470
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: "Wedbush"
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;
Description
Get research rating summary
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional Qot_Common.ResearchRatingDimensionType ratingDimensionType = 2; // Rating dimension (see Qot_Common.ResearchRatingDimensionType), default is Institution
optional string uid = 3; // Empty=get rating summary list; non-empty=get rating detail for the specified uid
optional string nextKey = 4; // Pagination key; leave empty on first request; "-1" means no more data
optional int32 num = 5; // Number of items per page, default 10, range 1~20
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Security structure see Security
- Rating dimension type see ResearchRatingDimensionType
- Return
message InstInfo
{
optional string institutionUid = 1; // Institution unique identifier
optional string institutionPictureUrl = 2; // Institution picture URL
optional string institutionName = 3; // Institution name
optional int64 updateTime = 4; // Update timestamp (seconds)
optional string updateTimeStr = 5; // Update time string, format YYYY-MM-DD, in market timezone
optional string institutionSourceName = 6; // Institution source name
optional string institutionEnName = 7; // Institution English name
}
message AnalystInfo
{
optional string analystUid = 1; // Analyst unique identifier
optional string analystName = 2; // Analyst name
optional string analystPictureUrl = 3; // Analyst avatar URL
optional double numOfStars = 4; // Star rating (0.0~5.0)
optional double successRate = 5; // Success rate, value before the percent sign
optional double excessReturn = 6; // Excess return, value before the percent sign
optional double stockSuccessRate = 7; // Stock success rate, value before the percent sign
optional double stockAvgReturn = 8; // Stock average return, value before the percent sign
optional InstInfo institutionInfo = 9; // Affiliated institution info
optional int64 updateTime = 10; // Update timestamp (seconds)
optional string updateTimeStr = 11; // Update time string, format YYYY-MM-DD
}
message RatingItem
{
optional string analystUid = 1; // Analyst unique identifier
optional string institutionUid = 2; // Institution unique identifier
optional Qot_Common.ResearchRatingType rating = 3; // Rating, only returns Sell(1)/Hold(3)/Buy(4)
optional double targetPrice = 4; // Target price
optional int64 recommendationDate = 5; // Rating date timestamp (seconds)
optional string recommendationDateStr = 6; // Rating date string, format YYYY-MM-DD
optional string ratingUrl = 7; // Rating source URL
optional int64 updateTime = 8; // Update timestamp (seconds)
optional string updateTimeStr = 9; // Update time string, format YYYY-MM-DD
}
message InstRatingSummaryItem
{
optional InstInfo institutionInfo = 1; // Institution info
repeated RatingItem ratingItemList = 2; // Rating record list for this institution
}
message AnalystRatingSummaryItem
{
optional AnalystInfo analystInfo = 1; // Analyst info
repeated RatingItem ratingItemList = 2; // Rating record list for this analyst
}
message InstRatingDetail
{
optional InstInfo institutionInfo = 1; // Institution info
repeated AnalystInfo analystInfoList = 2; // Analyst list under this institution
repeated RatingItem ratingItemList = 3; // Rating record list under this institution
}
message AnalystRatingDetail
{
optional AnalystInfo analystInfo = 1; // Analyst info
repeated RatingItem ratingItemList = 2; // Rating record list for this analyst
}
message S2C
{
repeated InstRatingSummaryItem instRatingSummaryList = 1; // Institution rating summary list
repeated AnalystRatingSummaryItem analystRatingSummaryList = 2; // Analyst rating summary list
optional InstRatingDetail instRatingDetail = 3; // Institution rating detail
optional AnalystRatingDetail analystRatingDetail = 4; // Analyst rating detail
optional string nextKey = 5; // Pagination key, "-1" means no more data
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return result description
optional int32 errCode = 3; // Error code
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
- API call result structure see RetType
- Rating type see 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: "Wedbush"
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);
Description
Get research rating summary
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional Qot_Common.ResearchRatingDimensionType ratingDimensionType = 2; // Rating dimension (see Qot_Common.ResearchRatingDimensionType), default is Institution
optional string uid = 3; // Empty=get rating summary list; non-empty=get rating detail for the specified uid
optional string nextKey = 4; // Pagination key; leave empty on first request; "-1" means no more data
optional int32 num = 5; // Number of items per page, default 10, range 1~20
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Security structure see Security
- Rating dimension type see ResearchRatingDimensionType
- Return
message InstInfo
{
optional string institutionUid = 1; // Institution unique identifier
optional string institutionPictureUrl = 2; // Institution picture URL
optional string institutionName = 3; // Institution name
optional int64 updateTime = 4; // Update timestamp (seconds)
optional string updateTimeStr = 5; // Update time string, format YYYY-MM-DD, in market timezone
optional string institutionSourceName = 6; // Institution source name
optional string institutionEnName = 7; // Institution English name
}
message AnalystInfo
{
optional string analystUid = 1; // Analyst unique identifier
optional string analystName = 2; // Analyst name
optional string analystPictureUrl = 3; // Analyst avatar URL
optional double numOfStars = 4; // Star rating (0.0~5.0)
optional double successRate = 5; // Success rate, value before the percent sign
optional double excessReturn = 6; // Excess return, value before the percent sign
optional double stockSuccessRate = 7; // Stock success rate, value before the percent sign
optional double stockAvgReturn = 8; // Stock average return, value before the percent sign
optional InstInfo institutionInfo = 9; // Affiliated institution info
optional int64 updateTime = 10; // Update timestamp (seconds)
optional string updateTimeStr = 11; // Update time string, format YYYY-MM-DD
}
message RatingItem
{
optional string analystUid = 1; // Analyst unique identifier
optional string institutionUid = 2; // Institution unique identifier
optional Qot_Common.ResearchRatingType rating = 3; // Rating, only returns Sell(1)/Hold(3)/Buy(4)
optional double targetPrice = 4; // Target price
optional int64 recommendationDate = 5; // Rating date timestamp (seconds)
optional string recommendationDateStr = 6; // Rating date string, format YYYY-MM-DD
optional string ratingUrl = 7; // Rating source URL
optional int64 updateTime = 8; // Update timestamp (seconds)
optional string updateTimeStr = 9; // Update time string, format YYYY-MM-DD
}
message InstRatingSummaryItem
{
optional InstInfo institutionInfo = 1; // Institution info
repeated RatingItem ratingItemList = 2; // Rating record list for this institution
}
message AnalystRatingSummaryItem
{
optional AnalystInfo analystInfo = 1; // Analyst info
repeated RatingItem ratingItemList = 2; // Rating record list for this analyst
}
message InstRatingDetail
{
optional InstInfo institutionInfo = 1; // Institution info
repeated AnalystInfo analystInfoList = 2; // Analyst list under this institution
repeated RatingItem ratingItemList = 3; // Rating record list under this institution
}
message AnalystRatingDetail
{
optional AnalystInfo analystInfo = 1; // Analyst info
repeated RatingItem ratingItemList = 2; // Rating record list for this analyst
}
message S2C
{
repeated InstRatingSummaryItem instRatingSummaryList = 1; // Institution rating summary list
repeated AnalystRatingSummaryItem analystRatingSummaryList = 2; // Analyst rating summary list
optional InstRatingDetail instRatingDetail = 3; // Institution rating detail
optional AnalystRatingDetail analystRatingDetail = 4; // Analyst rating detail
optional string nextKey = 5; // Pagination key, "-1" means no more data
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return result description
optional int32 errCode = 3; // Error code
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
- API call result structure see RetType
- Rating type see 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": "Wedbush",
"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
API Limits
- Maximum 30 requests per 30 seconds.
- Supports US stocks and REITs.
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_research_rating_summary(code, rating_dimension_type=None, uid=None, num=None, next_key=None)
Description
Get the institution or analyst rating summary list for the specified stock, or the rating detail for a specified institution/analyst, with pagination support
Parameters
Parameter Type Description code str Stock code rating_dimension_type ResearchRatingDimensionType Rating dimension 0=Unknown, 1=Institution, 2=Analyst; default is Institutionuid str Institution or analyst UID Empty=get rating summary list for the stock
non-empty=get rating detail for the specified uid (analyst uid must be used with rating_dimension_type=2)num int Number of items per page Default 10, range 1~20next_key str Pagination key Leave empty on first request; pass the next_key returned from the previous response to continue; "-1" means no more dataReturn
Parameter Type Description ret RET_CODE API call result data dict If ret == RET_OK, returns rating summary data dict str If ret != RET_OK, returns error description The returned dict contains the following fields:
Field Type Description inst_rating_summary_list list Institution rating summary list Populated when uid is empty and rating_dimension_type=1
each item contains institution_info and rating_item_listanalyst_rating_summary_list list Analyst rating summary list Populated when uid is empty and rating_dimension_type=2
each item contains analyst_info and rating_item_listinst_rating_detail dict Institution rating detail Populated when uid is non-empty and rating_dimension_type=1
contains institution_info, analyst_info_list, and rating_item_listanalyst_rating_detail dict Analyst rating detail Populated when uid is non-empty and rating_dimension_type=2
contains analyst_info and rating_item_listnext_key str Pagination key "-1" means no more dataFields in each item of inst_rating_summary_list (institution rating summary row):
Field Type Description institution_info dict Institution info, see table below rating_item_list list Rating record list, see table below institution_info fields (InstInfo):
Field Type Description institution_uid str Institution unique identifier institution_picture_url str Institution picture URL institution_name str Institution name update_time int Update timestamp Seconds, in market timezoneupdate_time_str str Update date Format YYYY-MM-DD, in market timezoneinstitution_source_name str Institution source name institution_en_name str Institution English name analyst_info fields (AnalystInfo):
Field Type Description analyst_uid str Analyst unique identifier analyst_name str Analyst name analyst_picture_url str Analyst avatar URL num_of_stars float Star rating 0.0~5.0, e.g. 3.50 means 3.5 starssuccess_rate float Success rate Value before the percent sign, e.g. 12.34 means 12.34%excess_return float Excess return Value before the percent sign, e.g. 12.34 means 12.34%stock_success_rate float Stock success rate Value before the percent sign, e.g. 12.34 means 12.34%stock_avg_return float Stock average return Value before the percent sign, e.g. 12.34 means 12.34%institution_info dict Affiliated institution info, see institution_info field table update_time int Update timestamp Seconds, in market timezoneupdate_time_str str Update date Format YYYY-MM-DD, in market timezoneFields in each item of rating_item_list (RatingItem):
Field Type Description analyst_uid str Analyst unique identifier institution_uid str Institution unique identifier rating ResearchRatingType Rating 0=Unknown, 1=Sell, 2=Underperform, 3=Hold, 4=Buy, 5=StrongBuy
this API only returns Sell(1)/Hold(3)/Buy(4), higher value means higher ratingtarget_price float Target price recommendation_date int Rating date timestamp Seconds, in market timezonerecommendation_date_str str Rating date Format YYYY-MM-DD, in market timezonerating_url str Rating source URL update_time int Update timestamp Seconds, in market timezoneupdate_time_str str Update date Format YYYY-MM-DD, in market timezone
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 Wedbush 8c9ae25a-07e2-4d52-a511-b0dd115a5224 Wedbush 2024-03-01
Evercore Evercore a746f081-c12a-4d6d-8067-f4b6634de478 Evercore ISI 2024-03-21
UBS UBS 1d3bfc25-1dda-48fd-bd9f-d4de47e68def UBS 2024-03-01
Goldman Sachs Goldman Sachs d0e296b4-c2e4-4fad-837c-cd79aaed2e8e Goldman Sachs 2024-03-01
Bernstein Bernstein 16358c98-ccc1-4d08-a875-2c727b7b8d70 Bernstein 2024-03-01
DBS DBS 44dec2a6-aca9-4b52-9fed-4bbf78749783 DBS 2024-03-01
BofA Securities BofA Securities 7890753d-5482-4311-a7af-8d5feed39f3e Bank of America Securities 2024-03-01
Phillip Securities Phillip Securities a294f0ca-10c0-4884-86a7-359995505e70 Phillip Securities 2024-09-09
J.P. Morgan J.P. Morgan f5ec822c-d561-4db3-a09d-a1e71a9a832f J.P. Morgan 2024-03-01
Morgan Stanley 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
Description
Get research rating summary
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional Qot_Common.ResearchRatingDimensionType ratingDimensionType = 2; // Rating dimension (see Qot_Common.ResearchRatingDimensionType), default is Institution
optional string uid = 3; // Empty=get rating summary list for the stock; non-empty=get rating detail for the specified uid (institutionUid or analystUid)
optional string nextKey = 4; // Pagination key; leave empty on first request; pass returned nextKey to continue; "-1" means no more data
optional int32 num = 5; // Number of items per page, default 10, range 1~20
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Security structure see Security
- Rating dimension type see ResearchRatingDimensionType
- Return
message InstInfo
{
optional string institutionUid = 1; // Institution unique identifier
optional string institutionPictureUrl = 2; // Institution picture URL
optional string institutionName = 3; // Institution name
optional int64 updateTime = 4; // Update timestamp (seconds)
optional string updateTimeStr = 5; // Update time string, format YYYY-MM-DD, in market timezone
optional string institutionSourceName = 6; // Institution source name
optional string institutionEnName = 7; // Institution English name
}
message AnalystInfo
{
optional string analystUid = 1; // Analyst unique identifier
optional string analystName = 2; // Analyst name
optional string analystPictureUrl = 3; // Analyst avatar URL
optional double numOfStars = 4; // Star rating (0.0~5.0, e.g. 3.50 means 3.5 stars)
optional double successRate = 5; // Success rate, value before the percent sign, e.g. 12.34 means 12.34%
optional double excessReturn = 6; // Excess return, value before the percent sign, e.g. 12.34 means 12.34%
optional double stockSuccessRate = 7; // Stock success rate, value before the percent sign, e.g. 12.34 means 12.34%
optional double stockAvgReturn = 8; // Stock average return, value before the percent sign, e.g. 12.34 means 12.34%
optional InstInfo institutionInfo = 9; // Affiliated institution info
optional int64 updateTime = 10; // Update timestamp (seconds)
optional string updateTimeStr = 11; // Update time string, format YYYY-MM-DD, in market timezone
}
message RatingItem
{
optional string analystUid = 1; // Analyst unique identifier
optional string institutionUid = 2; // Institution unique identifier
optional Qot_Common.ResearchRatingType rating = 3; // Rating (see Qot_Common.ResearchRatingType), only returns Sell(1)/Hold(3)/Buy(4), higher value means higher rating
optional double targetPrice = 4; // Target price
optional int64 recommendationDate = 5; // Rating date timestamp (seconds)
optional string recommendationDateStr = 6; // Rating date string, format YYYY-MM-DD, in market timezone
optional string ratingUrl = 7; // Rating source URL
optional int64 updateTime = 8; // Update timestamp (seconds)
optional string updateTimeStr = 9; // Update time string, format YYYY-MM-DD, in market timezone
}
// Institution rating summary row (uid empty, ratingDimensionType=1)
message InstRatingSummaryItem
{
optional InstInfo institutionInfo = 1; // Institution info
repeated RatingItem ratingItemList = 2; // Rating record list for this institution on this stock
}
// Analyst rating summary row (uid empty, ratingDimensionType=2)
message AnalystRatingSummaryItem
{
optional AnalystInfo analystInfo = 1; // Analyst info
repeated RatingItem ratingItemList = 2; // Rating record list for this analyst on this stock
}
// Institution rating detail (uid non-empty, ratingDimensionType=1)
message InstRatingDetail
{
optional InstInfo institutionInfo = 1; // Institution info
repeated AnalystInfo analystInfoList = 2; // Analyst list under this institution (simplified, without stockSuccessRate/stockAvgReturn/institutionInfo)
repeated RatingItem ratingItemList = 3; // Rating record list under this institution
}
// Analyst rating detail (uid non-empty, ratingDimensionType=2)
message AnalystRatingDetail
{
optional AnalystInfo analystInfo = 1; // Analyst info (including affiliated institutionInfo)
repeated RatingItem ratingItemList = 2; // Rating record list for this analyst on this stock
}
message S2C
{
repeated InstRatingSummaryItem instRatingSummaryList = 1; // Institution rating summary list (populated when uid empty, ratingDimensionType=1)
repeated AnalystRatingSummaryItem analystRatingSummaryList = 2; // Analyst rating summary list (populated when uid empty, ratingDimensionType=2)
optional InstRatingDetail instRatingDetail = 3; // Institution rating detail (populated when uid non-empty, ratingDimensionType=1)
optional AnalystRatingDetail analystRatingDetail = 4; // Analyst rating detail (populated when uid non-empty, ratingDimensionType=2)
optional string nextKey = 5; // Pagination key, "-1" means no more data
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return result description
optional int32 errCode = 3; // Error code
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
- API call result structure see RetType
- Rating type see ResearchRatingType
Protocol ID
3230
uint GetResearchRatingSummary(QotGetResearchRatingSummary.Request req);
virtual void OnReply_GetResearchRatingSummary(MMAPI_Conn client, uint nSerialNo, QotGetResearchRatingSummary.Response rsp);
Description
Get research rating summary
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional Qot_Common.ResearchRatingDimensionType ratingDimensionType = 2; // Rating dimension (see Qot_Common.ResearchRatingDimensionType), default is Institution
optional string uid = 3; // Empty=get rating summary list; non-empty=get rating detail for the specified uid
optional string nextKey = 4; // Pagination key; leave empty on first request; "-1" means no more data
optional int32 num = 5; // Number of items per page, default 10, range 1~20
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Security structure see Security
- Rating dimension type see ResearchRatingDimensionType
- Return
message InstInfo
{
optional string institutionUid = 1; // Institution unique identifier
optional string institutionPictureUrl = 2; // Institution picture URL
optional string institutionName = 3; // Institution name
optional int64 updateTime = 4; // Update timestamp (seconds)
optional string updateTimeStr = 5; // Update time string, format YYYY-MM-DD, in market timezone
optional string institutionSourceName = 6; // Institution source name
optional string institutionEnName = 7; // Institution English name
}
message AnalystInfo
{
optional string analystUid = 1; // Analyst unique identifier
optional string analystName = 2; // Analyst name
optional string analystPictureUrl = 3; // Analyst avatar URL
optional double numOfStars = 4; // Star rating (0.0~5.0)
optional double successRate = 5; // Success rate, value before the percent sign
optional double excessReturn = 6; // Excess return, value before the percent sign
optional double stockSuccessRate = 7; // Stock success rate, value before the percent sign
optional double stockAvgReturn = 8; // Stock average return, value before the percent sign
optional InstInfo institutionInfo = 9; // Affiliated institution info
optional int64 updateTime = 10; // Update timestamp (seconds)
optional string updateTimeStr = 11; // Update time string, format YYYY-MM-DD
}
message RatingItem
{
optional string analystUid = 1; // Analyst unique identifier
optional string institutionUid = 2; // Institution unique identifier
optional Qot_Common.ResearchRatingType rating = 3; // Rating, only returns Sell(1)/Hold(3)/Buy(4)
optional double targetPrice = 4; // Target price
optional int64 recommendationDate = 5; // Rating date timestamp (seconds)
optional string recommendationDateStr = 6; // Rating date string, format YYYY-MM-DD
optional string ratingUrl = 7; // Rating source URL
optional int64 updateTime = 8; // Update timestamp (seconds)
optional string updateTimeStr = 9; // Update time string, format YYYY-MM-DD
}
message InstRatingSummaryItem
{
optional InstInfo institutionInfo = 1; // Institution info
repeated RatingItem ratingItemList = 2; // Rating record list for this institution
}
message AnalystRatingSummaryItem
{
optional AnalystInfo analystInfo = 1; // Analyst info
repeated RatingItem ratingItemList = 2; // Rating record list for this analyst
}
message InstRatingDetail
{
optional InstInfo institutionInfo = 1; // Institution info
repeated AnalystInfo analystInfoList = 2; // Analyst list under this institution
repeated RatingItem ratingItemList = 3; // Rating record list under this institution
}
message AnalystRatingDetail
{
optional AnalystInfo analystInfo = 1; // Analyst info
repeated RatingItem ratingItemList = 2; // Rating record list for this analyst
}
message S2C
{
repeated InstRatingSummaryItem instRatingSummaryList = 1; // Institution rating summary list
repeated AnalystRatingSummaryItem analystRatingSummaryList = 2; // Analyst rating summary list
optional InstRatingDetail instRatingDetail = 3; // Institution rating detail
optional AnalystRatingDetail analystRatingDetail = 4; // Analyst rating detail
optional string nextKey = 5; // Pagination key, "-1" means no more data
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return result description
optional int32 errCode = 3; // Error code
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
- API call result structure see RetType
- Rating type see 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: "Wedbush"
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);
Description
Get research rating summary
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional Qot_Common.ResearchRatingDimensionType ratingDimensionType = 2; // Rating dimension (see Qot_Common.ResearchRatingDimensionType), default is Institution
optional string uid = 3; // Empty=get rating summary list; non-empty=get rating detail for the specified uid
optional string nextKey = 4; // Pagination key; leave empty on first request; "-1" means no more data
optional int32 num = 5; // Number of items per page, default 10, range 1~20
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Security structure see Security
- Rating dimension type see ResearchRatingDimensionType
- Return
message InstInfo
{
optional string institutionUid = 1; // Institution unique identifier
optional string institutionPictureUrl = 2; // Institution picture URL
optional string institutionName = 3; // Institution name
optional int64 updateTime = 4; // Update timestamp (seconds)
optional string updateTimeStr = 5; // Update time string, format YYYY-MM-DD, in market timezone
optional string institutionSourceName = 6; // Institution source name
optional string institutionEnName = 7; // Institution English name
}
message AnalystInfo
{
optional string analystUid = 1; // Analyst unique identifier
optional string analystName = 2; // Analyst name
optional string analystPictureUrl = 3; // Analyst avatar URL
optional double numOfStars = 4; // Star rating (0.0~5.0)
optional double successRate = 5; // Success rate, value before the percent sign
optional double excessReturn = 6; // Excess return, value before the percent sign
optional double stockSuccessRate = 7; // Stock success rate, value before the percent sign
optional double stockAvgReturn = 8; // Stock average return, value before the percent sign
optional InstInfo institutionInfo = 9; // Affiliated institution info
optional int64 updateTime = 10; // Update timestamp (seconds)
optional string updateTimeStr = 11; // Update time string, format YYYY-MM-DD
}
message RatingItem
{
optional string analystUid = 1; // Analyst unique identifier
optional string institutionUid = 2; // Institution unique identifier
optional Qot_Common.ResearchRatingType rating = 3; // Rating, only returns Sell(1)/Hold(3)/Buy(4)
optional double targetPrice = 4; // Target price
optional int64 recommendationDate = 5; // Rating date timestamp (seconds)
optional string recommendationDateStr = 6; // Rating date string, format YYYY-MM-DD
optional string ratingUrl = 7; // Rating source URL
optional int64 updateTime = 8; // Update timestamp (seconds)
optional string updateTimeStr = 9; // Update time string, format YYYY-MM-DD
}
message InstRatingSummaryItem
{
optional InstInfo institutionInfo = 1; // Institution info
repeated RatingItem ratingItemList = 2; // Rating record list for this institution
}
message AnalystRatingSummaryItem
{
optional AnalystInfo analystInfo = 1; // Analyst info
repeated RatingItem ratingItemList = 2; // Rating record list for this analyst
}
message InstRatingDetail
{
optional InstInfo institutionInfo = 1; // Institution info
repeated AnalystInfo analystInfoList = 2; // Analyst list under this institution
repeated RatingItem ratingItemList = 3; // Rating record list under this institution
}
message AnalystRatingDetail
{
optional AnalystInfo analystInfo = 1; // Analyst info
repeated RatingItem ratingItemList = 2; // Rating record list for this analyst
}
message S2C
{
repeated InstRatingSummaryItem instRatingSummaryList = 1; // Institution rating summary list
repeated AnalystRatingSummaryItem analystRatingSummaryList = 2; // Analyst rating summary list
optional InstRatingDetail instRatingDetail = 3; // Institution rating detail
optional AnalystRatingDetail analystRatingDetail = 4; // Analyst rating detail
optional string nextKey = 5; // Pagination key, "-1" means no more data
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return result description
optional int32 errCode = 3; // Error code
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
- API call result structure see RetType
- Rating type see 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=7459212582745187470
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: "Wedbush"
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;
Description
Get research rating summary
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional Qot_Common.ResearchRatingDimensionType ratingDimensionType = 2; // Rating dimension (see Qot_Common.ResearchRatingDimensionType), default is Institution
optional string uid = 3; // Empty=get rating summary list; non-empty=get rating detail for the specified uid
optional string nextKey = 4; // Pagination key; leave empty on first request; "-1" means no more data
optional int32 num = 5; // Number of items per page, default 10, range 1~20
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Security structure see Security
- Rating dimension type see ResearchRatingDimensionType
- Return
message InstInfo
{
optional string institutionUid = 1; // Institution unique identifier
optional string institutionPictureUrl = 2; // Institution picture URL
optional string institutionName = 3; // Institution name
optional int64 updateTime = 4; // Update timestamp (seconds)
optional string updateTimeStr = 5; // Update time string, format YYYY-MM-DD, in market timezone
optional string institutionSourceName = 6; // Institution source name
optional string institutionEnName = 7; // Institution English name
}
message AnalystInfo
{
optional string analystUid = 1; // Analyst unique identifier
optional string analystName = 2; // Analyst name
optional string analystPictureUrl = 3; // Analyst avatar URL
optional double numOfStars = 4; // Star rating (0.0~5.0)
optional double successRate = 5; // Success rate, value before the percent sign
optional double excessReturn = 6; // Excess return, value before the percent sign
optional double stockSuccessRate = 7; // Stock success rate, value before the percent sign
optional double stockAvgReturn = 8; // Stock average return, value before the percent sign
optional InstInfo institutionInfo = 9; // Affiliated institution info
optional int64 updateTime = 10; // Update timestamp (seconds)
optional string updateTimeStr = 11; // Update time string, format YYYY-MM-DD
}
message RatingItem
{
optional string analystUid = 1; // Analyst unique identifier
optional string institutionUid = 2; // Institution unique identifier
optional Qot_Common.ResearchRatingType rating = 3; // Rating, only returns Sell(1)/Hold(3)/Buy(4)
optional double targetPrice = 4; // Target price
optional int64 recommendationDate = 5; // Rating date timestamp (seconds)
optional string recommendationDateStr = 6; // Rating date string, format YYYY-MM-DD
optional string ratingUrl = 7; // Rating source URL
optional int64 updateTime = 8; // Update timestamp (seconds)
optional string updateTimeStr = 9; // Update time string, format YYYY-MM-DD
}
message InstRatingSummaryItem
{
optional InstInfo institutionInfo = 1; // Institution info
repeated RatingItem ratingItemList = 2; // Rating record list for this institution
}
message AnalystRatingSummaryItem
{
optional AnalystInfo analystInfo = 1; // Analyst info
repeated RatingItem ratingItemList = 2; // Rating record list for this analyst
}
message InstRatingDetail
{
optional InstInfo institutionInfo = 1; // Institution info
repeated AnalystInfo analystInfoList = 2; // Analyst list under this institution
repeated RatingItem ratingItemList = 3; // Rating record list under this institution
}
message AnalystRatingDetail
{
optional AnalystInfo analystInfo = 1; // Analyst info
repeated RatingItem ratingItemList = 2; // Rating record list for this analyst
}
message S2C
{
repeated InstRatingSummaryItem instRatingSummaryList = 1; // Institution rating summary list
repeated AnalystRatingSummaryItem analystRatingSummaryList = 2; // Analyst rating summary list
optional InstRatingDetail instRatingDetail = 3; // Institution rating detail
optional AnalystRatingDetail analystRatingDetail = 4; // Analyst rating detail
optional string nextKey = 5; // Pagination key, "-1" means no more data
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return result description
optional int32 errCode = 3; // Error code
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
- API call result structure see RetType
- Rating type see 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: "Wedbush"
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);
Description
Get research rating summary
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional Qot_Common.ResearchRatingDimensionType ratingDimensionType = 2; // Rating dimension (see Qot_Common.ResearchRatingDimensionType), default is Institution
optional string uid = 3; // Empty=get rating summary list; non-empty=get rating detail for the specified uid
optional string nextKey = 4; // Pagination key; leave empty on first request; "-1" means no more data
optional int32 num = 5; // Number of items per page, default 10, range 1~20
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Security structure see Security
- Rating dimension type see ResearchRatingDimensionType
- Return
message InstInfo
{
optional string institutionUid = 1; // Institution unique identifier
optional string institutionPictureUrl = 2; // Institution picture URL
optional string institutionName = 3; // Institution name
optional int64 updateTime = 4; // Update timestamp (seconds)
optional string updateTimeStr = 5; // Update time string, format YYYY-MM-DD, in market timezone
optional string institutionSourceName = 6; // Institution source name
optional string institutionEnName = 7; // Institution English name
}
message AnalystInfo
{
optional string analystUid = 1; // Analyst unique identifier
optional string analystName = 2; // Analyst name
optional string analystPictureUrl = 3; // Analyst avatar URL
optional double numOfStars = 4; // Star rating (0.0~5.0)
optional double successRate = 5; // Success rate, value before the percent sign
optional double excessReturn = 6; // Excess return, value before the percent sign
optional double stockSuccessRate = 7; // Stock success rate, value before the percent sign
optional double stockAvgReturn = 8; // Stock average return, value before the percent sign
optional InstInfo institutionInfo = 9; // Affiliated institution info
optional int64 updateTime = 10; // Update timestamp (seconds)
optional string updateTimeStr = 11; // Update time string, format YYYY-MM-DD
}
message RatingItem
{
optional string analystUid = 1; // Analyst unique identifier
optional string institutionUid = 2; // Institution unique identifier
optional Qot_Common.ResearchRatingType rating = 3; // Rating, only returns Sell(1)/Hold(3)/Buy(4)
optional double targetPrice = 4; // Target price
optional int64 recommendationDate = 5; // Rating date timestamp (seconds)
optional string recommendationDateStr = 6; // Rating date string, format YYYY-MM-DD
optional string ratingUrl = 7; // Rating source URL
optional int64 updateTime = 8; // Update timestamp (seconds)
optional string updateTimeStr = 9; // Update time string, format YYYY-MM-DD
}
message InstRatingSummaryItem
{
optional InstInfo institutionInfo = 1; // Institution info
repeated RatingItem ratingItemList = 2; // Rating record list for this institution
}
message AnalystRatingSummaryItem
{
optional AnalystInfo analystInfo = 1; // Analyst info
repeated RatingItem ratingItemList = 2; // Rating record list for this analyst
}
message InstRatingDetail
{
optional InstInfo institutionInfo = 1; // Institution info
repeated AnalystInfo analystInfoList = 2; // Analyst list under this institution
repeated RatingItem ratingItemList = 3; // Rating record list under this institution
}
message AnalystRatingDetail
{
optional AnalystInfo analystInfo = 1; // Analyst info
repeated RatingItem ratingItemList = 2; // Rating record list for this analyst
}
message S2C
{
repeated InstRatingSummaryItem instRatingSummaryList = 1; // Institution rating summary list
repeated AnalystRatingSummaryItem analystRatingSummaryList = 2; // Analyst rating summary list
optional InstRatingDetail instRatingDetail = 3; // Institution rating detail
optional AnalystRatingDetail analystRatingDetail = 4; // Analyst rating detail
optional string nextKey = 5; // Pagination key, "-1" means no more data
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return result description
optional int32 errCode = 3; // Error code
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
- API call result structure see RetType
- Rating type see 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": "Wedbush",
"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
API Limits
- Maximum 30 requests per 30 seconds.
- Supports US stocks and REITs.