# 獲取評級匯總
- 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 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
介紹
獲取評級匯總
參數
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: "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);
介紹
獲取評級匯總
參數
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=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;
介紹
獲取評級匯總
參數
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: "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);
介紹
獲取評級匯總
參數
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": "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
接口限制
- 每 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 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
介紹
獲取評級匯總
參數
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: "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);
介紹
獲取評級匯總
參數
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=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;
介紹
獲取評級匯總
參數
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: "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);
介紹
獲取評級匯總
參數
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": "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
接口限制
- 每 30 秒內最多請求 30 次。
- 支援美股正股及 REIT。