# 获取热议榜
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_hot_list(market, sort_field=None, sort_dir=None, count=10, offset=None, filter_list=None)
介绍
获取热议榜,返回指定市场中热度排行的股票列表,支持按交易热度、搜索热度、资讯热度、综合热度排序,并可按市值筛选。
参数
参数 类型 说明 market Market 市场类型(HK/US)(必填) sort_field HotListSortField 排序字段,默认综合热度 sort_dir RankSortDir 排序方向,默认降序 count int 返回数量 [1, 200],默认 10 offset int 起始位置,默认 0 filter_list list[ HotListFilter]筛选条件列表(市值) 输入限制
filter_list筛选条件(HotListFilter):构造参数 说明 indicator_type筛选因子类型( HotListIndicatorType,必填)interval_min范围最小值(闭区间) interval_max范围最大值(闭区间)
返回
参数 类型 说明 ret RET_CODE 接口调用结果 data pd.DataFrame 当 ret == RET_OK,返回 (all_count, DataFrame) 元组 str 当 ret != RET_OK,返回错误描述 - 数据格式如下:
字段 类型 说明 security str 股票代码(如 'US.TSLA')name str 股票名称 trade_heat float 交易热度 trade_heat_change float 交易热度变化 search_heat float 搜索热度 search_heat_change float 搜索热度变化 news_heat float 资讯热度 news_heat_change float 资讯热度变化 average_heat float 综合热度 average_heat_change float 综合热度变化 news_type str 新闻类型("Community"=社区讨论, "News"=资讯) news_title str 新闻/讨论标题 news_url str 资讯 URL(news_type="News" 时有效)
- 数据格式如下:
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_hot_list(market=Market.US, count=2)
if ret == RET_OK:
all_count, df = data
print(f'总数据量: {all_count}')
print(df)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
- Output
总数据量: 6342
security name trade_heat trade_heat_change search_heat search_heat_change news_heat news_heat_change average_heat average_heat_change news_type news_title news_url
0 US.SPCX SpaceX 9999995.0 0.0 9999972.0 0.0 9999998.0 0.0 9999988.0 0.0 News SpaceX收涨1%,终结三连跌!首发债券获约3.6... https://news.futunn.com/post/55589925?lang=...
1 US.MU 美光科技 5578115.0 0.0 7923445.0 0.0 1835896.0 -2.0 5112485.0 0.0 N/A N/A N/A
2
3
4
# Qot_GetHotList.proto
介绍
获取热议榜,返回指定市场中热度排行的股票列表,支持按交易热度、搜索热度、资讯热度、综合热度排序,并可按市值筛选。
参数
// 排序方向
enum SortDir {
SortDir_Descending = 0; // 降序(默认)
SortDir_Ascending = 1; // 升序
}
// 排序字段
enum HotListSortField {
HotListSortField_Unknown = 0; // 默认(综合热度)
HotListSortField_TradeHeat = 1; // 交易热度
HotListSortField_SearchHeat = 2; // 搜索热度
HotListSortField_NewsHeat = 3; // 资讯热度
HotListSortField_AverageHeat = 4; // 综合热度
}
// 筛选条件类型
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_MarketCap = 1; // 市值区间
}
// 筛选条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.Interval indicatorValue = 2; // 筛选区间
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (HK=1, US=11)
optional int32 sortField = 2; // HotListSortField, 排序字段, 默认综合热度
optional int32 sortDir = 3; // SortDir, 排序方向, 默认降序
optional int32 offset = 4; // 起始位置, 默认0
optional int32 count = 5; // 返回数量 [1,200], 默认50
repeated Indicator filterList = 6; // 筛选条件(市值)
}
// 热议新闻信息
message HotNewsInfo {
optional int32 newsType = 1; // 1=社区讨论, 2=资讯
optional string title = 2; // 讨论/资讯标题
optional string newsUrl = 3; // 资讯URL(newsType=2时有效)
}
// 热议榜数据项
message HotListItem {
required Qot_Common.Security security = 1; // 股票
optional string name = 2; // 名称
optional double tradeHeat = 12; // 交易热度
optional double tradeHeatChange = 13; // 交易热度变化
optional double searchHeat = 14; // 搜索热度
optional double searchHeatChange = 15; // 搜索热度变化
optional double newsHeat = 16; // 资讯热度
optional double newsHeatChange = 17; // 资讯热度变化
optional double averageHeat = 18; // 综合热度
optional double averageHeatChange = 19; // 综合热度变化
optional HotNewsInfo newsInfo = 20; // 关联新闻
}
message S2C {
repeated HotListItem dataList = 1; // 数据列表
optional int32 allCount = 2; // 符合条件的总数据量
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType, 返回结果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
协议 ID
3414
uint GetHotList(Qot_GetHotList.Request req);
virtual void OnReply_GetHotList(FTAPI_Conn client, uint nSerialNo, Qot_GetHotList.Response rsp);
介绍
获取热议榜,返回指定市场中热度排行的股票列表,支持按交易热度、搜索热度、资讯热度、综合热度排序,并可按市值筛选。
参数
// 排序方向
enum SortDir {
SortDir_Descending = 0; // 降序(默认)
SortDir_Ascending = 1; // 升序
}
// 排序字段
enum HotListSortField {
HotListSortField_Unknown = 0; // 默认(综合热度)
HotListSortField_TradeHeat = 1; // 交易热度
HotListSortField_SearchHeat = 2; // 搜索热度
HotListSortField_NewsHeat = 3; // 资讯热度
HotListSortField_AverageHeat = 4; // 综合热度
}
// 筛选条件类型
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_MarketCap = 1; // 市值区间
}
// 筛选条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.Interval indicatorValue = 2; // 筛选区间
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (HK=1, US=11)
optional int32 sortField = 2; // HotListSortField, 排序字段, 默认综合热度
optional int32 sortDir = 3; // SortDir, 排序方向, 默认降序
optional int32 offset = 4; // 起始位置, 默认0
optional int32 count = 5; // 返回数量 [1,200], 默认50
repeated Indicator filterList = 6; // 筛选条件(市值)
}
// 热议新闻信息
message HotNewsInfo {
optional int32 newsType = 1; // 1=社区讨论, 2=资讯
optional string title = 2; // 讨论/资讯标题
optional string newsUrl = 3; // 资讯URL(newsType=2时有效)
}
// 热议榜数据项
message HotListItem {
required Qot_Common.Security security = 1; // 股票
optional string name = 2; // 名称
optional double tradeHeat = 12; // 交易热度
optional double tradeHeatChange = 13; // 交易热度变化
optional double searchHeat = 14; // 搜索热度
optional double searchHeatChange = 15; // 搜索热度变化
optional double newsHeat = 16; // 资讯热度
optional double newsHeatChange = 17; // 资讯热度变化
optional double averageHeat = 18; // 综合热度
optional double averageHeatChange = 19; // 综合热度变化
optional HotNewsInfo newsInfo = 20; // 关联新闻
}
message S2C {
repeated HotListItem dataList = 1; // 数据列表
optional int32 allCount = 2; // 符合条件的总数据量
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType, 返回结果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
- 接口调用结果,结构参见 RetType
协议 ID
3414
Example
public class Program : FTSPI_Qot, FTSPI_Conn {
FTAPI_Qot qot = new FTAPI_Qot();
public Program() {
qot.SetClientInfo("csharp", 1); //设置客户端信息
qot.SetConnCallback(this); //设置连接回调
qot.SetQotCallback(this); //设置行情回调
}
public void Start() {
qot.InitConnect("127.0.0.1", (ushort)11111, false);
}
public void OnInitConnect(FTAPI_Conn client, long errCode, String desc)
{
Console.Write("Qot onInitConnect: ret={0} desc={1} connID={2}
", errCode, desc, client.GetConnectID());
if (errCode != 0)
return;
QotGetHotList.C2S c2s = QotGetHotList.C2S.CreateBuilder()
.SetMarket(11)
.SetCount(3)
.Build();
QotGetHotList.Request req = QotGetHotList.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetHotList(req);
Console.Write("Send QotGetHotList: {0}
", seqNo);
}
public void OnDisconnect(FTAPI_Conn client, long errCode) {
Console.Write("Qot onDisConnect: {0}
", errCode);
}
public void OnReply_GetHotList(FTAPI_Conn client, uint nSerialNo, QotGetHotList.Response rsp)
{
Console.Write("Reply: QotGetHotList: {0}
", nSerialNo);
if (rsp.RetType == 0 && rsp.HasS2C)
Console.Write("{0}
", rsp.ToString());
}
public static void Main(String[] args) {
FTAPI.Init();
Program program = new Program();
program.Start();
while (true)
Thread.Sleep(1000 * 600);
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
- Output
Send QotGetHotList: 3
Reply: QotGetHotList: 3
GetHotList: errCode 0, retMsg , retType 0
{
"allCount": 4822,
"dataList": [
{ "security": { "market": 11, "code": "SPCX" }, "name": "SpaceX", "averageHeat": 9999954.0 },
{ "security": { "market": 11, "code": "MU" }, "name": "美光科技", "averageHeat": 5554652.0 },
{ "security": { "market": 11, "code": "INTC" }, "name": "英特尔", "averageHeat": 4650380.0 }
]
}
2
3
4
5
6
7
8
9
10
11
int getHotList(Qot_GetHotList.Request req);
onReply_GetHotList(FTAPI_Conn client, int nSerialNo, Qot_GetHotList.Response rsp)
介绍
获取热议榜,返回指定市场中热度排行的股票列表,支持按交易热度、搜索热度、资讯热度、综合热度排序,并可按市值筛选。
参数
// 排序方向
enum SortDir {
SortDir_Descending = 0; // 降序(默认)
SortDir_Ascending = 1; // 升序
}
// 排序字段
enum HotListSortField {
HotListSortField_Unknown = 0; // 默认(综合热度)
HotListSortField_TradeHeat = 1; // 交易热度
HotListSortField_SearchHeat = 2; // 搜索热度
HotListSortField_NewsHeat = 3; // 资讯热度
HotListSortField_AverageHeat = 4; // 综合热度
}
// 筛选条件类型
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_MarketCap = 1; // 市值区间
}
// 筛选条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.Interval indicatorValue = 2; // 筛选区间
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (HK=1, US=11)
optional int32 sortField = 2; // HotListSortField, 排序字段, 默认综合热度
optional int32 sortDir = 3; // SortDir, 排序方向, 默认降序
optional int32 offset = 4; // 起始位置, 默认0
optional int32 count = 5; // 返回数量 [1,200], 默认50
repeated Indicator filterList = 6; // 筛选条件(市值)
}
// 热议新闻信息
message HotNewsInfo {
optional int32 newsType = 1; // 1=社区讨论, 2=资讯
optional string title = 2; // 讨论/资讯标题
optional string newsUrl = 3; // 资讯URL(newsType=2时有效)
}
// 热议榜数据项
message HotListItem {
required Qot_Common.Security security = 1; // 股票
optional string name = 2; // 名称
optional double tradeHeat = 12; // 交易热度
optional double tradeHeatChange = 13; // 交易热度变化
optional double searchHeat = 14; // 搜索热度
optional double searchHeatChange = 15; // 搜索热度变化
optional double newsHeat = 16; // 资讯热度
optional double newsHeatChange = 17; // 资讯热度变化
optional double averageHeat = 18; // 综合热度
optional double averageHeatChange = 19; // 综合热度变化
optional HotNewsInfo newsInfo = 20; // 关联新闻
}
message S2C {
repeated HotListItem dataList = 1; // 数据列表
optional int32 allCount = 2; // 符合条件的总数据量
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType, 返回结果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
- 接口调用结果,结构参见 RetType
协议 ID
3414
Example
public class QotDemo implements FTSPI_Qot, FTSPI_Conn {
FTAPI_Conn_Qot qot = new FTAPI_Conn_Qot();
public QotDemo() {
qot.setClientInfo("javaclient", 1); //设置客户端信息
qot.setConnSpi(this); //设置连接回调
qot.setQotSpi(this); //设置行情回调
}
public void start() {
qot.initConnect("127.0.0.1", (short)11111, false);
}
@Override
public void onInitConnect(FTAPI_Conn client, long errCode, String desc)
{
System.out.printf("Qot onInitConnect: ret=%d desc=%s connID=%d
", errCode, desc, client.getConnectID());
if (errCode != 0)
return;
QotGetHotList.C2S c2s = QotGetHotList.C2S.newBuilder()
.setMarket(11)
.setCount(3)
.build();
QotGetHotList.Request req = QotGetHotList.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getHotList(req);
System.out.printf("Send QotGetHotList: %d
", seqNo);
}
@Override
public void onDisconnect(FTAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d
", errCode);
}
@Override
public void onReply_GetHotList(FTAPI_Conn client, int nSerialNo, QotGetHotList.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetHotList failed: %s
", rsp.getRetMsg());
} else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetHotList: %s
", json);
} catch (InvalidProtocolBufferException e) {
e.printStackTrace();
}
}
}
public static void main(String[] args) {
FTAPI.init();
QotDemo qot = new QotDemo();
qot.start();
while (true) {
try {
Thread.sleep(1000 * 600);
} catch (InterruptedException exc) {
}
}
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
- Output
Send QotGetHotList: 3
Receive QotGetHotList: {
"allCount": 4822,
"dataList": [
{ "security": { "market": 11, "code": "SPCX" }, "name": "SpaceX", "averageHeat": 9999954.0 },
{ "security": { "market": 11, "code": "MU" }, "name": "美光科技", "averageHeat": 5554652.0 },
{ "security": { "market": 11, "code": "INTC" }, "name": "英特尔", "averageHeat": 4650380.0 }
]
}
2
3
4
5
6
7
8
9
介绍
获取热议榜,返回指定市场中热度排行的股票列表,支持按交易热度、搜索热度、资讯热度、综合热度排序,并可按市值筛选。
参数
// 排序方向
enum SortDir {
SortDir_Descending = 0; // 降序(默认)
SortDir_Ascending = 1; // 升序
}
// 排序字段
enum HotListSortField {
HotListSortField_Unknown = 0; // 默认(综合热度)
HotListSortField_TradeHeat = 1; // 交易热度
HotListSortField_SearchHeat = 2; // 搜索热度
HotListSortField_NewsHeat = 3; // 资讯热度
HotListSortField_AverageHeat = 4; // 综合热度
}
// 筛选条件类型
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_MarketCap = 1; // 市值区间
}
// 筛选条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.Interval indicatorValue = 2; // 筛选区间
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (HK=1, US=11)
optional int32 sortField = 2; // HotListSortField, 排序字段, 默认综合热度
optional int32 sortDir = 3; // SortDir, 排序方向, 默认降序
optional int32 offset = 4; // 起始位置, 默认0
optional int32 count = 5; // 返回数量 [1,200], 默认50
repeated Indicator filterList = 6; // 筛选条件(市值)
}
// 热议新闻信息
message HotNewsInfo {
optional int32 newsType = 1; // 1=社区讨论, 2=资讯
optional string title = 2; // 讨论/资讯标题
optional string newsUrl = 3; // 资讯URL(newsType=2时有效)
}
// 热议榜数据项
message HotListItem {
required Qot_Common.Security security = 1; // 股票
optional string name = 2; // 名称
optional double tradeHeat = 12; // 交易热度
optional double tradeHeatChange = 13; // 交易热度变化
optional double searchHeat = 14; // 搜索热度
optional double searchHeatChange = 15; // 搜索热度变化
optional double newsHeat = 16; // 资讯热度
optional double newsHeatChange = 17; // 资讯热度变化
optional double averageHeat = 18; // 综合热度
optional double averageHeatChange = 19; // 综合热度变化
optional HotNewsInfo newsInfo = 20; // 关联新闻
}
message S2C {
repeated HotListItem dataList = 1; // 数据列表
optional int32 allCount = 2; // 符合条件的总数据量
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType, 返回结果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
- 接口调用结果,结构参见 RetType
协议 ID
3414
Example
class Program : public FTSPI_Qot, public FTSPI_Conn
{
public:
Program() {
m_pQotApi = FTAPI::CreateQotApi();
m_pQotApi->RegisterQotSpi(this);
m_pQotApi->RegisterConnSpi(this);
}
~Program() {
if (m_pQotApi != nullptr) {
m_pQotApi->UnregisterQotSpi();
m_pQotApi->UnregisterConnSpi();
FTAPI::ReleaseQotApi(m_pQotApi);
m_pQotApi = nullptr;
}
}
void Start() {
m_pQotApi->InitConnect("127.0.0.1", 11111, false);
}
virtual void OnInitConnect(FTAPI_Conn* pConn, Futu::i64_t nErrCode, const char* strDesc) {
Qot_GetHotList::Request req;
Qot_GetHotList::C2S *c2s = req.mutable_c2s();
c2s->set_market(Qot_Common::QotMarket::QotMarket_US_Security);
c2s->set_count(50);
m_GetHotListSerialNo = m_pQotApi->GetHotList(req);
}
virtual void OnReply_GetHotList(Futu::u32_t nSerialNo, const Qot_GetHotList::Response &stRsp) {
if (nSerialNo != m_GetHotListSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
FTAPI_Qot *m_pQotApi;
Futu::u32_t m_GetHotListSerialNo = 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
- Output
{
"retType": 0,
"retMsg": "",
"errCode": 0,
"s2c": {
"dataList": [
{
"security": {
"market": 11,
"code": "NVDA"
},
"name": "NVIDIA",
"tradeHeat": 98.5,
"tradeHeatChange": 2.3,
"searchHeat": 95.1,
"newsHeat": 92.8
}
],
"allCount": 50
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
getHotList(qotGetHotList)
介绍
协议请求与返回定义
参数
// 排序方向
enum SortDir {
SortDir_Descending = 0; // 降序(默认)
SortDir_Ascending = 1; // 升序
}
// 排序字段
enum HotListSortField {
HotListSortField_Unknown = 0; // 默认(综合热度)
HotListSortField_TradeHeat = 1; // 交易热度
HotListSortField_SearchHeat = 2; // 搜索热度
HotListSortField_NewsHeat = 3; // 资讯热度
HotListSortField_AverageHeat = 4; // 综合热度
}
// 筛选条件类型
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_MarketCap = 1; // 市值区间
}
// 筛选条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.Interval indicatorValue = 2; // 筛选区间
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (HK=1, US=11)
optional int32 sortField = 2; // HotListSortField, 排序字段, 默认综合热度
optional int32 sortDir = 3; // SortDir, 排序方向, 默认降序
optional int32 offset = 4; // 起始位置, 默认0
optional int32 count = 5; // 返回数量 [1,200], 默认50
repeated Indicator filterList = 6; // 筛选条件(市值)
}
// 热议新闻信息
message HotNewsInfo {
optional int32 newsType = 1; // 1=社区讨论, 2=资讯
optional string title = 2; // 讨论/资讯标题
optional string newsUrl = 3; // 资讯URL(newsType=2时有效)
}
// 热议榜数据项
message HotListItem {
required Qot_Common.Security security = 1; // 股票
optional string name = 2; // 名称
optional double tradeHeat = 12; // 交易热度
optional double tradeHeatChange = 13; // 交易热度变化
optional double searchHeat = 14; // 搜索热度
optional double searchHeatChange = 15; // 搜索热度变化
optional double newsHeat = 16; // 资讯热度
optional double newsHeatChange = 17; // 资讯热度变化
optional double averageHeat = 18; // 综合热度
optional double averageHeatChange = 19; // 综合热度变化
optional HotNewsInfo newsInfo = 20; // 关联新闻
}
message S2C {
repeated HotListItem dataList = 1; // 数据列表
optional int32 allCount = 2; // 符合条件的总数据量
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType, 返回结果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
- 接口调用结果,结构参见 RetType
协议 ID
3414
Example
import ftWebsocket from "futu-api";
import { Common, Qot_Common } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetHotList(){
const { RetType } = Common
let [addr, port, enable_ssl, key] = ["127.0.0.1", 11111, false, "xxxxxx"];
let websocket = new ftWebsocket();
websocket.onlogin = (ret, msg)=>{
if (ret) {
const req = {
c2s: { market: 11, count: 3 },
};
websocket.GetHotList(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetHotList: errCode %d, retMsg %s, retType %d", errCode, retMsg, retType);
if(retType == RetType.RetType_Succeed){
let data = beautify(JSON.stringify(s2c), { indent_size: 2, space_in_empty_paren: true });
console.log(data);
}
})
.catch((error)=>{ console.log("error:", error); });
} else {
console.log("start error", msg);
}
};
websocket.start(addr, port, enable_ssl, key);
setTimeout(()=>{ websocket.stop(); process.exit(); }, 5000);
}
QotGetHotList()
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
- Output
GetHotList: errCode 0, retMsg , retType 0
{
"allCount": 4822,
"dataList": [
{ "security": { "market": 11, "code": "SPCX" }, "name": "SpaceX", "averageHeat": 9999954.0 },
{ "security": { "market": 11, "code": "MU" }, "name": "美光科技", "averageHeat": 5554652.0 },
{ "security": { "market": 11, "code": "INTC" }, "name": "英特尔", "averageHeat": 4650380.0 }
]
}
2
3
4
5
6
7
8
9
接口限制
- 30 秒内最多 60 次请求
- 分页请求仅首页计入限频统计
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_hot_list(market, sort_field=None, sort_dir=None, count=10, offset=None, filter_list=None)
介绍
获取热议榜,返回指定市场中热度排行的股票列表,支持按交易热度、搜索热度、资讯热度、综合热度排序,并可按市值筛选。
参数
参数 类型 说明 market Market 市场类型(HK/US)(必填) sort_field HotListSortField 排序字段,默认综合热度 sort_dir RankSortDir 排序方向,默认降序 count int 返回数量 [1, 200],默认 10 offset int 起始位置,默认 0 filter_list list[ HotListFilter]筛选条件列表(市值) 输入限制
filter_list筛选条件(HotListFilter):构造参数 说明 indicator_type筛选因子类型( HotListIndicatorType,必填)interval_min范围最小值(闭区间) interval_max范围最大值(闭区间)
返回
参数 类型 说明 ret RET_CODE 接口调用结果 data pd.DataFrame 当 ret == RET_OK,返回 (all_count, DataFrame) 元组 str 当 ret != RET_OK,返回错误描述 - 数据格式如下:
字段 类型 说明 security str 股票代码(如 'US.TSLA')name str 股票名称 trade_heat float 交易热度 trade_heat_change float 交易热度变化 search_heat float 搜索热度 search_heat_change float 搜索热度变化 news_heat float 资讯热度 news_heat_change float 资讯热度变化 average_heat float 综合热度 average_heat_change float 综合热度变化 news_type str 新闻类型("Community"=社区讨论, "News"=资讯) news_title str 新闻/讨论标题 news_url str 资讯 URL(news_type="News" 时有效)
- 数据格式如下:
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_hot_list(market=Market.US, count=2)
if ret == RET_OK:
all_count, df = data
print(f'总数据量: {all_count}')
print(df)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
- Output
总数据量: 6342
security name trade_heat trade_heat_change search_heat search_heat_change news_heat news_heat_change average_heat average_heat_change news_type news_title news_url
0 US.SPCX SpaceX 9999995.0 0.0 9999972.0 0.0 9999998.0 0.0 9999988.0 0.0 News SpaceX收涨1%,终结三连跌!首发债券获约3.6... https://news.futunn.com/post/55589925?lang=...
1 US.MU 美光科技 5578115.0 0.0 7923445.0 0.0 1835896.0 -2.0 5112485.0 0.0 N/A N/A N/A
2
3
4
# Qot_GetHotList.proto
介绍
获取热议榜,返回指定市场中热度排行的股票列表,支持按交易热度、搜索热度、资讯热度、综合热度排序,并可按市值筛选。
参数
// 排序方向
enum SortDir {
SortDir_Descending = 0; // 降序(默认)
SortDir_Ascending = 1; // 升序
}
// 排序字段
enum HotListSortField {
HotListSortField_Unknown = 0; // 默认(综合热度)
HotListSortField_TradeHeat = 1; // 交易热度
HotListSortField_SearchHeat = 2; // 搜索热度
HotListSortField_NewsHeat = 3; // 资讯热度
HotListSortField_AverageHeat = 4; // 综合热度
}
// 筛选条件类型
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_MarketCap = 1; // 市值区间
}
// 筛选条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.Interval indicatorValue = 2; // 筛选区间
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (HK=1, US=11)
optional int32 sortField = 2; // HotListSortField, 排序字段, 默认综合热度
optional int32 sortDir = 3; // SortDir, 排序方向, 默认降序
optional int32 offset = 4; // 起始位置, 默认0
optional int32 count = 5; // 返回数量 [1,200], 默认50
repeated Indicator filterList = 6; // 筛选条件(市值)
}
// 热议新闻信息
message HotNewsInfo {
optional int32 newsType = 1; // 1=社区讨论, 2=资讯
optional string title = 2; // 讨论/资讯标题
optional string newsUrl = 3; // 资讯URL(newsType=2时有效)
}
// 热议榜数据项
message HotListItem {
required Qot_Common.Security security = 1; // 股票
optional string name = 2; // 名称
optional double tradeHeat = 12; // 交易热度
optional double tradeHeatChange = 13; // 交易热度变化
optional double searchHeat = 14; // 搜索热度
optional double searchHeatChange = 15; // 搜索热度变化
optional double newsHeat = 16; // 资讯热度
optional double newsHeatChange = 17; // 资讯热度变化
optional double averageHeat = 18; // 综合热度
optional double averageHeatChange = 19; // 综合热度变化
optional HotNewsInfo newsInfo = 20; // 关联新闻
}
message S2C {
repeated HotListItem dataList = 1; // 数据列表
optional int32 allCount = 2; // 符合条件的总数据量
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType, 返回结果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
协议 ID
3414
uint GetHotList(Qot_GetHotList.Request req);
virtual void OnReply_GetHotList(FTAPI_Conn client, uint nSerialNo, Qot_GetHotList.Response rsp);
介绍
获取热议榜,返回指定市场中热度排行的股票列表,支持按交易热度、搜索热度、资讯热度、综合热度排序,并可按市值筛选。
参数
// 排序方向
enum SortDir {
SortDir_Descending = 0; // 降序(默认)
SortDir_Ascending = 1; // 升序
}
// 排序字段
enum HotListSortField {
HotListSortField_Unknown = 0; // 默认(综合热度)
HotListSortField_TradeHeat = 1; // 交易热度
HotListSortField_SearchHeat = 2; // 搜索热度
HotListSortField_NewsHeat = 3; // 资讯热度
HotListSortField_AverageHeat = 4; // 综合热度
}
// 筛选条件类型
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_MarketCap = 1; // 市值区间
}
// 筛选条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.Interval indicatorValue = 2; // 筛选区间
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (HK=1, US=11)
optional int32 sortField = 2; // HotListSortField, 排序字段, 默认综合热度
optional int32 sortDir = 3; // SortDir, 排序方向, 默认降序
optional int32 offset = 4; // 起始位置, 默认0
optional int32 count = 5; // 返回数量 [1,200], 默认50
repeated Indicator filterList = 6; // 筛选条件(市值)
}
// 热议新闻信息
message HotNewsInfo {
optional int32 newsType = 1; // 1=社区讨论, 2=资讯
optional string title = 2; // 讨论/资讯标题
optional string newsUrl = 3; // 资讯URL(newsType=2时有效)
}
// 热议榜数据项
message HotListItem {
required Qot_Common.Security security = 1; // 股票
optional string name = 2; // 名称
optional double tradeHeat = 12; // 交易热度
optional double tradeHeatChange = 13; // 交易热度变化
optional double searchHeat = 14; // 搜索热度
optional double searchHeatChange = 15; // 搜索热度变化
optional double newsHeat = 16; // 资讯热度
optional double newsHeatChange = 17; // 资讯热度变化
optional double averageHeat = 18; // 综合热度
optional double averageHeatChange = 19; // 综合热度变化
optional HotNewsInfo newsInfo = 20; // 关联新闻
}
message S2C {
repeated HotListItem dataList = 1; // 数据列表
optional int32 allCount = 2; // 符合条件的总数据量
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType, 返回结果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
- 接口调用结果,结构参见 RetType
协议 ID
3414
Example
public class Program : MMSPI_Qot, MMSPI_Conn {
MMAPI_Qot qot = new MMAPI_Qot();
public Program() {
qot.SetClientInfo("csharp", 1); //设置客户端信息
qot.SetConnCallback(this); //设置连接回调
qot.SetQotCallback(this); //设置行情回调
}
public void Start() {
qot.InitConnect("127.0.0.1", (ushort)11111, false);
}
public void OnInitConnect(MMAPI_Conn client, long errCode, String desc)
{
Console.Write("Qot onInitConnect: ret={0} desc={1} connID={2}
", errCode, desc, client.GetConnectID());
if (errCode != 0)
return;
QotGetHotList.C2S c2s = QotGetHotList.C2S.CreateBuilder()
.SetMarket(11)
.SetCount(3)
.Build();
QotGetHotList.Request req = QotGetHotList.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetHotList(req);
Console.Write("Send QotGetHotList: {0}
", seqNo);
}
public void OnDisconnect(MMAPI_Conn client, long errCode) {
Console.Write("Qot onDisConnect: {0}
", errCode);
}
public void OnReply_GetHotList(MMAPI_Conn client, uint nSerialNo, QotGetHotList.Response rsp)
{
Console.Write("Reply: QotGetHotList: {0}
", nSerialNo);
if (rsp.RetType == 0 && rsp.HasS2C)
Console.Write("{0}
", rsp.ToString());
}
public static void Main(String[] args) {
MMAPI.Init();
Program program = new Program();
program.Start();
while (true)
Thread.Sleep(1000 * 600);
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
- Output
Send QotGetHotList: 3
Reply: QotGetHotList: 3
GetHotList: errCode 0, retMsg , retType 0
{
"allCount": 4822,
"dataList": [
{ "security": { "market": 11, "code": "SPCX" }, "name": "SpaceX", "averageHeat": 9999954.0 },
{ "security": { "market": 11, "code": "MU" }, "name": "美光科技", "averageHeat": 5554652.0 },
{ "security": { "market": 11, "code": "INTC" }, "name": "英特尔", "averageHeat": 4650380.0 }
]
}
2
3
4
5
6
7
8
9
10
11
int getHotList(Qot_GetHotList.Request req);
onReply_GetHotList(FTAPI_Conn client, int nSerialNo, Qot_GetHotList.Response rsp)
介绍
获取热议榜,返回指定市场中热度排行的股票列表,支持按交易热度、搜索热度、资讯热度、综合热度排序,并可按市值筛选。
参数
// 排序方向
enum SortDir {
SortDir_Descending = 0; // 降序(默认)
SortDir_Ascending = 1; // 升序
}
// 排序字段
enum HotListSortField {
HotListSortField_Unknown = 0; // 默认(综合热度)
HotListSortField_TradeHeat = 1; // 交易热度
HotListSortField_SearchHeat = 2; // 搜索热度
HotListSortField_NewsHeat = 3; // 资讯热度
HotListSortField_AverageHeat = 4; // 综合热度
}
// 筛选条件类型
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_MarketCap = 1; // 市值区间
}
// 筛选条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.Interval indicatorValue = 2; // 筛选区间
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (HK=1, US=11)
optional int32 sortField = 2; // HotListSortField, 排序字段, 默认综合热度
optional int32 sortDir = 3; // SortDir, 排序方向, 默认降序
optional int32 offset = 4; // 起始位置, 默认0
optional int32 count = 5; // 返回数量 [1,200], 默认50
repeated Indicator filterList = 6; // 筛选条件(市值)
}
// 热议新闻信息
message HotNewsInfo {
optional int32 newsType = 1; // 1=社区讨论, 2=资讯
optional string title = 2; // 讨论/资讯标题
optional string newsUrl = 3; // 资讯URL(newsType=2时有效)
}
// 热议榜数据项
message HotListItem {
required Qot_Common.Security security = 1; // 股票
optional string name = 2; // 名称
optional double tradeHeat = 12; // 交易热度
optional double tradeHeatChange = 13; // 交易热度变化
optional double searchHeat = 14; // 搜索热度
optional double searchHeatChange = 15; // 搜索热度变化
optional double newsHeat = 16; // 资讯热度
optional double newsHeatChange = 17; // 资讯热度变化
optional double averageHeat = 18; // 综合热度
optional double averageHeatChange = 19; // 综合热度变化
optional HotNewsInfo newsInfo = 20; // 关联新闻
}
message S2C {
repeated HotListItem dataList = 1; // 数据列表
optional int32 allCount = 2; // 符合条件的总数据量
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType, 返回结果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
- 接口调用结果,结构参见 RetType
协议 ID
3414
Example
public class QotDemo implements MMSPI_Qot, MMSPI_Conn {
MMAPI_Conn_Qot qot = new MMAPI_Conn_Qot();
public QotDemo() {
qot.setClientInfo("javaclient", 1); //设置客户端信息
qot.setConnSpi(this); //设置连接回调
qot.setQotSpi(this); //设置行情回调
}
public void start() {
qot.initConnect("127.0.0.1", (short)11111, false);
}
@Override
public void onInitConnect(MMAPI_Conn client, long errCode, String desc)
{
System.out.printf("Qot onInitConnect: ret=%d desc=%s connID=%d
", errCode, desc, client.getConnectID());
if (errCode != 0)
return;
QotGetHotList.C2S c2s = QotGetHotList.C2S.newBuilder()
.setMarket(11)
.setCount(3)
.build();
QotGetHotList.Request req = QotGetHotList.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getHotList(req);
System.out.printf("Send QotGetHotList: %d
", seqNo);
}
@Override
public void onDisconnect(MMAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d
", errCode);
}
@Override
public void onReply_GetHotList(MMAPI_Conn client, int nSerialNo, QotGetHotList.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetHotList failed: %s
", rsp.getRetMsg());
} else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetHotList: %s
", json);
} catch (InvalidProtocolBufferException e) {
e.printStackTrace();
}
}
}
public static void main(String[] args) {
MMAPI.init();
QotDemo qot = new QotDemo();
qot.start();
while (true) {
try {
Thread.sleep(1000 * 600);
} catch (InterruptedException exc) {
}
}
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
- Output
Send QotGetHotList: 3
Receive QotGetHotList: {
"allCount": 4822,
"dataList": [
{ "security": { "market": 11, "code": "SPCX" }, "name": "SpaceX", "averageHeat": 9999954.0 },
{ "security": { "market": 11, "code": "MU" }, "name": "美光科技", "averageHeat": 5554652.0 },
{ "security": { "market": 11, "code": "INTC" }, "name": "英特尔", "averageHeat": 4650380.0 }
]
}
2
3
4
5
6
7
8
9
介绍
获取热议榜,返回指定市场中热度排行的股票列表,支持按交易热度、搜索热度、资讯热度、综合热度排序,并可按市值筛选。
参数
// 排序方向
enum SortDir {
SortDir_Descending = 0; // 降序(默认)
SortDir_Ascending = 1; // 升序
}
// 排序字段
enum HotListSortField {
HotListSortField_Unknown = 0; // 默认(综合热度)
HotListSortField_TradeHeat = 1; // 交易热度
HotListSortField_SearchHeat = 2; // 搜索热度
HotListSortField_NewsHeat = 3; // 资讯热度
HotListSortField_AverageHeat = 4; // 综合热度
}
// 筛选条件类型
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_MarketCap = 1; // 市值区间
}
// 筛选条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.Interval indicatorValue = 2; // 筛选区间
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (HK=1, US=11)
optional int32 sortField = 2; // HotListSortField, 排序字段, 默认综合热度
optional int32 sortDir = 3; // SortDir, 排序方向, 默认降序
optional int32 offset = 4; // 起始位置, 默认0
optional int32 count = 5; // 返回数量 [1,200], 默认50
repeated Indicator filterList = 6; // 筛选条件(市值)
}
// 热议新闻信息
message HotNewsInfo {
optional int32 newsType = 1; // 1=社区讨论, 2=资讯
optional string title = 2; // 讨论/资讯标题
optional string newsUrl = 3; // 资讯URL(newsType=2时有效)
}
// 热议榜数据项
message HotListItem {
required Qot_Common.Security security = 1; // 股票
optional string name = 2; // 名称
optional double tradeHeat = 12; // 交易热度
optional double tradeHeatChange = 13; // 交易热度变化
optional double searchHeat = 14; // 搜索热度
optional double searchHeatChange = 15; // 搜索热度变化
optional double newsHeat = 16; // 资讯热度
optional double newsHeatChange = 17; // 资讯热度变化
optional double averageHeat = 18; // 综合热度
optional double averageHeatChange = 19; // 综合热度变化
optional HotNewsInfo newsInfo = 20; // 关联新闻
}
message S2C {
repeated HotListItem dataList = 1; // 数据列表
optional int32 allCount = 2; // 符合条件的总数据量
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType, 返回结果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
- 接口调用结果,结构参见 RetType
协议 ID
3414
Example
class Program : public MMSPI_Qot, public MMSPI_Conn
{
public:
Program() {
m_pQotApi = MMAPI::CreateQotApi();
m_pQotApi->RegisterQotSpi(this);
m_pQotApi->RegisterConnSpi(this);
}
~Program() {
if (m_pQotApi != nullptr) {
m_pQotApi->UnregisterQotSpi();
m_pQotApi->UnregisterConnSpi();
MMAPI::ReleaseQotApi(m_pQotApi);
m_pQotApi = nullptr;
}
}
void Start() {
m_pQotApi->InitConnect("127.0.0.1", 11111, false);
}
virtual void OnInitConnect(MMAPI_Conn* pConn, moomoo::i64_t nErrCode, const char* strDesc) {
Qot_GetHotList::Request req;
Qot_GetHotList::C2S *c2s = req.mutable_c2s();
c2s->set_market(Qot_Common::QotMarket::QotMarket_US_Security);
c2s->set_count(50);
m_GetHotListSerialNo = m_pQotApi->GetHotList(req);
}
virtual void OnReply_GetHotList(moomoo::u32_t nSerialNo, const Qot_GetHotList::Response &stRsp) {
if (nSerialNo != m_GetHotListSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
MMAPI_Qot *m_pQotApi;
moomoo::u32_t m_GetHotListSerialNo = 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
- Output
{
"retType": 0,
"retMsg": "",
"errCode": 0,
"s2c": {
"dataList": [
{
"security": {
"market": 11,
"code": "NVDA"
},
"name": "NVIDIA",
"tradeHeat": 98.5,
"tradeHeatChange": 2.3,
"searchHeat": 95.1,
"newsHeat": 92.8
}
],
"allCount": 50
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
getHotList(qotGetHotList)
介绍
协议请求与返回定义
参数
// 排序方向
enum SortDir {
SortDir_Descending = 0; // 降序(默认)
SortDir_Ascending = 1; // 升序
}
// 排序字段
enum HotListSortField {
HotListSortField_Unknown = 0; // 默认(综合热度)
HotListSortField_TradeHeat = 1; // 交易热度
HotListSortField_SearchHeat = 2; // 搜索热度
HotListSortField_NewsHeat = 3; // 资讯热度
HotListSortField_AverageHeat = 4; // 综合热度
}
// 筛选条件类型
enum IndicatorType {
IndicatorType_Unknown = 0;
IndicatorType_MarketCap = 1; // 市值区间
}
// 筛选条件
message Indicator {
required int32 indicatorType = 1; // IndicatorType
optional Qot_OptionCommon.Interval indicatorValue = 2; // 筛选区间
}
message C2S {
required int32 market = 1; // Qot_Common.QotMarket (HK=1, US=11)
optional int32 sortField = 2; // HotListSortField, 排序字段, 默认综合热度
optional int32 sortDir = 3; // SortDir, 排序方向, 默认降序
optional int32 offset = 4; // 起始位置, 默认0
optional int32 count = 5; // 返回数量 [1,200], 默认50
repeated Indicator filterList = 6; // 筛选条件(市值)
}
// 热议新闻信息
message HotNewsInfo {
optional int32 newsType = 1; // 1=社区讨论, 2=资讯
optional string title = 2; // 讨论/资讯标题
optional string newsUrl = 3; // 资讯URL(newsType=2时有效)
}
// 热议榜数据项
message HotListItem {
required Qot_Common.Security security = 1; // 股票
optional string name = 2; // 名称
optional double tradeHeat = 12; // 交易热度
optional double tradeHeatChange = 13; // 交易热度变化
optional double searchHeat = 14; // 搜索热度
optional double searchHeatChange = 15; // 搜索热度变化
optional double newsHeat = 16; // 资讯热度
optional double newsHeatChange = 17; // 资讯热度变化
optional double averageHeat = 18; // 综合热度
optional double averageHeatChange = 19; // 综合热度变化
optional HotNewsInfo newsInfo = 20; // 关联新闻
}
message S2C {
repeated HotListItem dataList = 1; // 数据列表
optional int32 allCount = 2; // 符合条件的总数据量
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; // RetType, 返回结果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
- 接口调用结果,结构参见 RetType
协议 ID
3414
Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_Common } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetHotList(){
const { RetType } = Common
let [addr, port, enable_ssl, key] = ["127.0.0.1", 11111, false, "xxxxxx"];
let websocket = new mmWebsocket();
websocket.onlogin = (ret, msg)=>{
if (ret) {
const req = {
c2s: { market: 11, count: 3 },
};
websocket.GetHotList(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetHotList: errCode %d, retMsg %s, retType %d", errCode, retMsg, retType);
if(retType == RetType.RetType_Succeed){
let data = beautify(JSON.stringify(s2c), { indent_size: 2, space_in_empty_paren: true });
console.log(data);
}
})
.catch((error)=>{ console.log("error:", error); });
} else {
console.log("start error", msg);
}
};
websocket.start(addr, port, enable_ssl, key);
setTimeout(()=>{ websocket.stop(); process.exit(); }, 5000);
}
QotGetHotList()
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
- Output
GetHotList: errCode 0, retMsg , retType 0
{
"allCount": 4822,
"dataList": [
{ "security": { "market": 11, "code": "SPCX" }, "name": "SpaceX", "averageHeat": 9999954.0 },
{ "security": { "market": 11, "code": "MU" }, "name": "美光科技", "averageHeat": 5554652.0 },
{ "security": { "market": 11, "code": "INTC" }, "name": "英特尔", "averageHeat": 4650380.0 }
]
}
2
3
4
5
6
7
8
9
接口限制
- 30 秒内最多 60 次请求
- 分页请求仅首页计入限频统计