# 获取经济事件日历
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_economic_calendar(begin_date, end_date=None, market_list=None, importance=None, count=None, next_page=None)
介绍
获取经济事件日历,返回指定日期范围内的经济数据发布事件,包含事件标题、发布时间、国家、重要性星级、前值、预测值和实际公布值。支持按市场和重要性筛选,支持分页查询。
参数
参数 类型 说明 begin_date str 开始日期,格式 "yyyy-MM-dd"(必填) end_date str 结束日期,格式 "yyyy-MM-dd";不传则仅查 begin_date 当天 market_list list[Market] 市场筛选(多选,支持 HK/US/SH/SG/JP/AU/MY/CA),不传返回所有市场 importance EconomicImportance 事件重要性筛选,默认 ALL(全部) count int 每页数量,默认 50,最大 100 next_page str 翻页标记,首次不传,后续传上次返回的 next_page 返回
参数 类型 说明 ret RET_CODE 接口调用结果 data pd.DataFrame 当 ret == RET_OK,返回数据 str 当 ret != RET_OK,返回错误描述 - 数据格式如下:
字段 类型 说明 title str 事件标题(如"非农就业人数") timestamp float 发布时间戳(秒) country str 国家名称 star str 重要性星级("LOW"/"MEDIUM"/"HIGH") previous str 前值(未返回时为 "--") consensus str 预测值(未返回时为 "--") actual str 实际公布值(未返回时为 "--")
- 数据格式如下:
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data, next_page, has_more = quote_ctx.get_economic_calendar(begin_date='2026-06-23', end_date='2026-06-24', count=2)
if ret == RET_OK:
print(data)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
- Output
title timestamp country star previous consensus actual
0 日本6月综合PMI初值 1.782175e+09 日本 MEDIUM
1 日本6月制造业PMI初值 1.782175e+09 日本 MEDIUM
2
3
# Qot_GetEconomicCalendar.proto
介绍
获取经济事件日历,返回指定日期范围内的经济数据发布事件,包含事件标题、发布时间、国家、重要性星级、前值、预测值和实际公布值。支持按市场和重要性筛选,支持分页查询。
参数
// 事件重要性(星级)
enum Importance {
Importance_All = 0; //全部(默认)
Importance_Low = 1; //一星(低)
Importance_Medium = 2; //二星(中)
Importance_High = 3; //三星(高)
}
// 经济数据事件
message EconomicCalendarItem {
optional string title = 1; // 标题(如"非农就业人数")
optional double timestamp = 2; // 发布时间戳(秒)
optional string country = 3; // 国家名称
optional int32 star = 4; // 星级(重要性 1-3)
optional string previous = 5; // 前值
optional string consensus = 6; // 预测值
optional string actual = 7; // 实际值(公布值)
}
message C2S {
required string beginDate = 1; // 开始日期,格式"yyyy-MM-dd",按本机系统时区解释
optional string endDate = 2; // 结束日期,格式"yyyy-MM-dd",不传则仅查beginDate当天
repeated int32 marketList = 3; // Qot_Common.QotMarket,市场筛选(多选,支持HK/US/CNSH/SG/JP/AU/MY/CA)
optional int32 importance = 4; // Importance,事件重要性筛选,默认All
optional int32 count = 5; // 每页数量,默认50,最大100
optional string nextPage = 6; // 翻页标记,首次不传,后续带上S2C返回的nextPage
}
message S2C {
repeated EconomicCalendarItem itemList = 1; // 经济数据事件列表
optional string nextPage = 2; // 下一页翻页标记
optional bool hasMore = 3; // 是否还有更多数据
}
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
协议 ID
3409
uint GetEconomicCalendar(Qot_GetEconomicCalendar.Request req);
virtual void OnReply_GetEconomicCalendar(FTAPI_Conn client, uint nSerialNo, Qot_GetEconomicCalendar.Response rsp);
介绍
获取经济事件日历,返回指定日期范围内的经济数据发布事件,包含事件标题、发布时间、国家、重要性星级、前值、预测值和实际公布值。支持按市场和重要性筛选,支持分页查询。
参数
// 事件重要性(星级)
enum Importance {
Importance_All = 0; //全部(默认)
Importance_Low = 1; //一星(低)
Importance_Medium = 2; //二星(中)
Importance_High = 3; //三星(高)
}
// 经济数据事件
message EconomicCalendarItem {
optional string title = 1; // 标题(如"非农就业人数")
optional double timestamp = 2; // 发布时间戳(秒)
optional string country = 3; // 国家名称
optional int32 star = 4; // 星级(重要性 1-3)
optional string previous = 5; // 前值
optional string consensus = 6; // 预测值
optional string actual = 7; // 实际值(公布值)
}
message C2S {
required string beginDate = 1; // 开始日期,格式"yyyy-MM-dd",按本机系统时区解释
optional string endDate = 2; // 结束日期,格式"yyyy-MM-dd",不传则仅查beginDate当天
repeated int32 marketList = 3; // Qot_Common.QotMarket,市场筛选(多选,支持HK/US/CNSH/SG/JP/AU/MY/CA)
optional int32 importance = 4; // Importance,事件重要性筛选,默认All
optional int32 count = 5; // 每页数量,默认50,最大100
optional string nextPage = 6; // 翻页标记,首次不传,后续带上S2C返回的nextPage
}
message S2C {
repeated EconomicCalendarItem itemList = 1; // 经济数据事件列表
optional string nextPage = 2; // 下一页翻页标记
optional bool hasMore = 3; // 是否还有更多数据
}
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
- 接口调用结果,结构参见 RetType
协议 ID
3409
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;
QotGetEconomicCalendar.C2S c2s = QotGetEconomicCalendar.C2S.CreateBuilder()
.SetBeginDate("2026-06-22")
.SetEndDate("2026-06-22")
.SetCount(3)
.Build();
QotGetEconomicCalendar.Request req = QotGetEconomicCalendar.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetEconomicCalendar(req);
Console.Write("Send QotGetEconomicCalendar: {0}
", seqNo);
}
public void OnDisconnect(FTAPI_Conn client, long errCode) {
Console.Write("Qot onDisConnect: {0}
", errCode);
}
public void OnReply_GetEconomicCalendar(FTAPI_Conn client, uint nSerialNo, QotGetEconomicCalendar.Response rsp)
{
Console.Write("Reply: QotGetEconomicCalendar: {0}
", nSerialNo);
if (rsp.RetType == 0 && rsp.HasS2C)
Console.Write("{0}
", rsp.ToString());
}
public static void Main(String[] args) {
FTAPI.Init();
Program program = new Program();
program.Start();
while (true)
Thread.Sleep(1000 * 600);
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
- Output
Send QotGetEconomicCalendar: 3
Reply: QotGetEconomicCalendar: 3
GetEconomicCalendar: errCode 0, retMsg , retType 0
{
"hasMore": false,
"itemList": [
{ "title": "中国至6月22日一年期贷款市场报价利率", "timestamp": 1782090000, "country": "中国", "star": "HIGH" },
{ "title": "中国至6月22日五年期贷款市场报价利率", "timestamp": 1782090000, "country": "中国", "star": "MEDIUM" },
{ "title": "美国至6月22日6个月国债竞拍-投标倍数", "timestamp": 1782142000, "country": "美国", "star": "LOW" }
]
}
2
3
4
5
6
7
8
9
10
11
int getEconomicCalendar(Qot_GetEconomicCalendar.Request req);
onReply_GetEconomicCalendar(FTAPI_Conn client, int nSerialNo, Qot_GetEconomicCalendar.Response rsp)
介绍
获取经济事件日历,返回指定日期范围内的经济数据发布事件,包含事件标题、发布时间、国家、重要性星级、前值、预测值和实际公布值。支持按市场和重要性筛选,支持分页查询。
参数
// 事件重要性(星级)
enum Importance {
Importance_All = 0; //全部(默认)
Importance_Low = 1; //一星(低)
Importance_Medium = 2; //二星(中)
Importance_High = 3; //三星(高)
}
// 经济数据事件
message EconomicCalendarItem {
optional string title = 1; // 标题(如"非农就业人数")
optional double timestamp = 2; // 发布时间戳(秒)
optional string country = 3; // 国家名称
optional int32 star = 4; // 星级(重要性 1-3)
optional string previous = 5; // 前值
optional string consensus = 6; // 预测值
optional string actual = 7; // 实际值(公布值)
}
message C2S {
required string beginDate = 1; // 开始日期,格式"yyyy-MM-dd",按本机系统时区解释
optional string endDate = 2; // 结束日期,格式"yyyy-MM-dd",不传则仅查beginDate当天
repeated int32 marketList = 3; // Qot_Common.QotMarket,市场筛选(多选,支持HK/US/CNSH/SG/JP/AU/MY/CA)
optional int32 importance = 4; // Importance,事件重要性筛选,默认All
optional int32 count = 5; // 每页数量,默认50,最大100
optional string nextPage = 6; // 翻页标记,首次不传,后续带上S2C返回的nextPage
}
message S2C {
repeated EconomicCalendarItem itemList = 1; // 经济数据事件列表
optional string nextPage = 2; // 下一页翻页标记
optional bool hasMore = 3; // 是否还有更多数据
}
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
- 接口调用结果,结构参见 RetType
协议 ID
3409
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;
QotGetEconomicCalendar.C2S c2s = QotGetEconomicCalendar.C2S.newBuilder()
.setBeginDate("2026-06-22")
.setEndDate("2026-06-22")
.setCount(3)
.build();
QotGetEconomicCalendar.Request req = QotGetEconomicCalendar.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getEconomicCalendar(req);
System.out.printf("Send QotGetEconomicCalendar: %d
", seqNo);
}
@Override
public void onDisconnect(FTAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d
", errCode);
}
@Override
public void onReply_GetEconomicCalendar(FTAPI_Conn client, int nSerialNo, QotGetEconomicCalendar.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetEconomicCalendar failed: %s
", rsp.getRetMsg());
} else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetEconomicCalendar: %s
", json);
} catch (InvalidProtocolBufferException e) {
e.printStackTrace();
}
}
}
public static void main(String[] args) {
FTAPI.init();
QotDemo qot = new QotDemo();
qot.start();
while (true) {
try {
Thread.sleep(1000 * 600);
} catch (InterruptedException exc) {
}
}
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
- Output
Send QotGetEconomicCalendar: 3
Receive QotGetEconomicCalendar: {
"hasMore": false,
"itemList": [
{ "title": "中国至6月22日一年期贷款市场报价利率", "timestamp": 1782090000, "country": "中国", "star": "HIGH" },
{ "title": "中国至6月22日五年期贷款市场报价利率", "timestamp": 1782090000, "country": "中国", "star": "MEDIUM" },
{ "title": "美国至6月22日6个月国债竞拍-投标倍数", "timestamp": 1782142000, "country": "美国", "star": "LOW" }
]
}
2
3
4
5
6
7
8
9
介绍
获取经济事件日历,返回指定日期范围内的经济数据发布事件,包含事件标题、发布时间、国家、重要性星级、前值、预测值和实际公布值。支持按市场和重要性筛选,支持分页查询。
参数
// 事件重要性(星级)
enum Importance {
Importance_All = 0; //全部(默认)
Importance_Low = 1; //一星(低)
Importance_Medium = 2; //二星(中)
Importance_High = 3; //三星(高)
}
// 经济数据事件
message EconomicCalendarItem {
optional string title = 1; // 标题(如"非农就业人数")
optional double timestamp = 2; // 发布时间戳(秒)
optional string country = 3; // 国家名称
optional int32 star = 4; // 星级(重要性 1-3)
optional string previous = 5; // 前值
optional string consensus = 6; // 预测值
optional string actual = 7; // 实际值(公布值)
}
message C2S {
required string beginDate = 1; // 开始日期,格式"yyyy-MM-dd",按本机系统时区解释
optional string endDate = 2; // 结束日期,格式"yyyy-MM-dd",不传则仅查beginDate当天
repeated int32 marketList = 3; // Qot_Common.QotMarket,市场筛选(多选,支持HK/US/CNSH/SG/JP/AU/MY/CA)
optional int32 importance = 4; // Importance,事件重要性筛选,默认All
optional int32 count = 5; // 每页数量,默认50,最大100
optional string nextPage = 6; // 翻页标记,首次不传,后续带上S2C返回的nextPage
}
message S2C {
repeated EconomicCalendarItem itemList = 1; // 经济数据事件列表
optional string nextPage = 2; // 下一页翻页标记
optional bool hasMore = 3; // 是否还有更多数据
}
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
- 接口调用结果,结构参见 RetType
协议 ID
3409
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_GetEconomicCalendar::Request req;
Qot_GetEconomicCalendar::C2S *c2s = req.mutable_c2s();
c2s->set_begindate("2024-06-01");
c2s->set_enddate("2024-06-07");
m_GetEconomicCalendarSerialNo = m_pQotApi->GetEconomicCalendar(req);
}
virtual void OnReply_GetEconomicCalendar(Futu::u32_t nSerialNo, const Qot_GetEconomicCalendar::Response &stRsp) {
if (nSerialNo != m_GetEconomicCalendarSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
FTAPI_Qot *m_pQotApi;
Futu::u32_t m_GetEconomicCalendarSerialNo = 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": {
"itemList": [
{
"title": "Non-Farm Payrolls",
"timestamp": 1717430400.0,
"country": "US",
"star": 3,
"previous": "175K",
"consensus": "185K",
"actual": "272K"
}
],
"hasMore": false
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
getEconomicCalendar(qotGetEconomicCalendar)
介绍
协议请求与返回定义
参数
// 事件重要性(星级)
enum Importance {
Importance_All = 0; //全部(默认)
Importance_Low = 1; //一星(低)
Importance_Medium = 2; //二星(中)
Importance_High = 3; //三星(高)
}
// 经济数据事件
message EconomicCalendarItem {
optional string title = 1; // 标题(如"非农就业人数")
optional double timestamp = 2; // 发布时间戳(秒)
optional string country = 3; // 国家名称
optional int32 star = 4; // 星级(重要性 1-3)
optional string previous = 5; // 前值
optional string consensus = 6; // 预测值
optional string actual = 7; // 实际值(公布值)
}
message C2S {
required string beginDate = 1; // 开始日期,格式"yyyy-MM-dd",按本机系统时区解释
optional string endDate = 2; // 结束日期,格式"yyyy-MM-dd",不传则仅查beginDate当天
repeated int32 marketList = 3; // Qot_Common.QotMarket,市场筛选(多选,支持HK/US/CNSH/SG/JP/AU/MY/CA)
optional int32 importance = 4; // Importance,事件重要性筛选,默认All
optional int32 count = 5; // 每页数量,默认50,最大100
optional string nextPage = 6; // 翻页标记,首次不传,后续带上S2C返回的nextPage
}
message S2C {
repeated EconomicCalendarItem itemList = 1; // 经济数据事件列表
optional string nextPage = 2; // 下一页翻页标记
optional bool hasMore = 3; // 是否还有更多数据
}
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
- 接口调用结果,结构参见 RetType
协议 ID
3409
Example
import ftWebsocket from "futu-api";
import { Common, Qot_Common } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetEconomicCalendar(){
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: {
beginDate: "2026-06-22",
endDate: "2026-06-22",
count: 3,
},
};
websocket.GetEconomicCalendar(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetEconomicCalendar: 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);
}
QotGetEconomicCalendar()
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
- Output
GetEconomicCalendar: errCode 0, retMsg , retType 0
{
"hasMore": false,
"itemList": [
{ "title": "中国至6月22日一年期贷款市场报价利率", "timestamp": 1782090000, "country": "中国", "star": "HIGH" },
{ "title": "中国至6月22日五年期贷款市场报价利率", "timestamp": 1782090000, "country": "中国", "star": "MEDIUM" },
{ "title": "美国至6月22日6个月国债竞拍-投标倍数", "timestamp": 1782142000, "country": "美国", "star": "LOW" }
]
}
2
3
4
5
6
7
8
9
接口限制
- 30 秒内最多 60 次请求
- 分页请求仅首页计入限频统计
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_economic_calendar(begin_date, end_date=None, market_list=None, importance=None, count=None, next_page=None)
介绍
获取经济事件日历,返回指定日期范围内的经济数据发布事件,包含事件标题、发布时间、国家、重要性星级、前值、预测值和实际公布值。支持按市场和重要性筛选,支持分页查询。
参数
参数 类型 说明 begin_date str 开始日期,格式 "yyyy-MM-dd"(必填) end_date str 结束日期,格式 "yyyy-MM-dd";不传则仅查 begin_date 当天 market_list list[Market] 市场筛选(多选,支持 HK/US/SH/SG/JP/AU/MY/CA),不传返回所有市场 importance EconomicImportance 事件重要性筛选,默认 ALL(全部) count int 每页数量,默认 50,最大 100 next_page str 翻页标记,首次不传,后续传上次返回的 next_page 返回
参数 类型 说明 ret RET_CODE 接口调用结果 data pd.DataFrame 当 ret == RET_OK,返回数据 str 当 ret != RET_OK,返回错误描述 - 数据格式如下:
字段 类型 说明 title str 事件标题(如"非农就业人数") timestamp float 发布时间戳(秒) country str 国家名称 star str 重要性星级("LOW"/"MEDIUM"/"HIGH") previous str 前值(未返回时为 "--") consensus str 预测值(未返回时为 "--") actual str 实际公布值(未返回时为 "--")
- 数据格式如下:
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data, next_page, has_more = quote_ctx.get_economic_calendar(begin_date='2026-06-23', end_date='2026-06-24', count=2)
if ret == RET_OK:
print(data)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
- Output
title timestamp country star previous consensus actual
0 日本6月综合PMI初值 1.782175e+09 日本 MEDIUM
1 日本6月制造业PMI初值 1.782175e+09 日本 MEDIUM
2
3
# Qot_GetEconomicCalendar.proto
介绍
获取经济事件日历,返回指定日期范围内的经济数据发布事件,包含事件标题、发布时间、国家、重要性星级、前值、预测值和实际公布值。支持按市场和重要性筛选,支持分页查询。
参数
// 事件重要性(星级)
enum Importance {
Importance_All = 0; //全部(默认)
Importance_Low = 1; //一星(低)
Importance_Medium = 2; //二星(中)
Importance_High = 3; //三星(高)
}
// 经济数据事件
message EconomicCalendarItem {
optional string title = 1; // 标题(如"非农就业人数")
optional double timestamp = 2; // 发布时间戳(秒)
optional string country = 3; // 国家名称
optional int32 star = 4; // 星级(重要性 1-3)
optional string previous = 5; // 前值
optional string consensus = 6; // 预测值
optional string actual = 7; // 实际值(公布值)
}
message C2S {
required string beginDate = 1; // 开始日期,格式"yyyy-MM-dd",按本机系统时区解释
optional string endDate = 2; // 结束日期,格式"yyyy-MM-dd",不传则仅查beginDate当天
repeated int32 marketList = 3; // Qot_Common.QotMarket,市场筛选(多选,支持HK/US/CNSH/SG/JP/AU/MY/CA)
optional int32 importance = 4; // Importance,事件重要性筛选,默认All
optional int32 count = 5; // 每页数量,默认50,最大100
optional string nextPage = 6; // 翻页标记,首次不传,后续带上S2C返回的nextPage
}
message S2C {
repeated EconomicCalendarItem itemList = 1; // 经济数据事件列表
optional string nextPage = 2; // 下一页翻页标记
optional bool hasMore = 3; // 是否还有更多数据
}
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
协议 ID
3409
uint GetEconomicCalendar(Qot_GetEconomicCalendar.Request req);
virtual void OnReply_GetEconomicCalendar(FTAPI_Conn client, uint nSerialNo, Qot_GetEconomicCalendar.Response rsp);
介绍
获取经济事件日历,返回指定日期范围内的经济数据发布事件,包含事件标题、发布时间、国家、重要性星级、前值、预测值和实际公布值。支持按市场和重要性筛选,支持分页查询。
参数
// 事件重要性(星级)
enum Importance {
Importance_All = 0; //全部(默认)
Importance_Low = 1; //一星(低)
Importance_Medium = 2; //二星(中)
Importance_High = 3; //三星(高)
}
// 经济数据事件
message EconomicCalendarItem {
optional string title = 1; // 标题(如"非农就业人数")
optional double timestamp = 2; // 发布时间戳(秒)
optional string country = 3; // 国家名称
optional int32 star = 4; // 星级(重要性 1-3)
optional string previous = 5; // 前值
optional string consensus = 6; // 预测值
optional string actual = 7; // 实际值(公布值)
}
message C2S {
required string beginDate = 1; // 开始日期,格式"yyyy-MM-dd",按本机系统时区解释
optional string endDate = 2; // 结束日期,格式"yyyy-MM-dd",不传则仅查beginDate当天
repeated int32 marketList = 3; // Qot_Common.QotMarket,市场筛选(多选,支持HK/US/CNSH/SG/JP/AU/MY/CA)
optional int32 importance = 4; // Importance,事件重要性筛选,默认All
optional int32 count = 5; // 每页数量,默认50,最大100
optional string nextPage = 6; // 翻页标记,首次不传,后续带上S2C返回的nextPage
}
message S2C {
repeated EconomicCalendarItem itemList = 1; // 经济数据事件列表
optional string nextPage = 2; // 下一页翻页标记
optional bool hasMore = 3; // 是否还有更多数据
}
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
- 接口调用结果,结构参见 RetType
协议 ID
3409
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;
QotGetEconomicCalendar.C2S c2s = QotGetEconomicCalendar.C2S.CreateBuilder()
.SetBeginDate("2026-06-22")
.SetEndDate("2026-06-22")
.SetCount(3)
.Build();
QotGetEconomicCalendar.Request req = QotGetEconomicCalendar.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetEconomicCalendar(req);
Console.Write("Send QotGetEconomicCalendar: {0}
", seqNo);
}
public void OnDisconnect(MMAPI_Conn client, long errCode) {
Console.Write("Qot onDisConnect: {0}
", errCode);
}
public void OnReply_GetEconomicCalendar(MMAPI_Conn client, uint nSerialNo, QotGetEconomicCalendar.Response rsp)
{
Console.Write("Reply: QotGetEconomicCalendar: {0}
", nSerialNo);
if (rsp.RetType == 0 && rsp.HasS2C)
Console.Write("{0}
", rsp.ToString());
}
public static void Main(String[] args) {
MMAPI.Init();
Program program = new Program();
program.Start();
while (true)
Thread.Sleep(1000 * 600);
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
- Output
Send QotGetEconomicCalendar: 3
Reply: QotGetEconomicCalendar: 3
GetEconomicCalendar: errCode 0, retMsg , retType 0
{
"hasMore": false,
"itemList": [
{ "title": "中国至6月22日一年期贷款市场报价利率", "timestamp": 1782090000, "country": "中国", "star": "HIGH" },
{ "title": "中国至6月22日五年期贷款市场报价利率", "timestamp": 1782090000, "country": "中国", "star": "MEDIUM" },
{ "title": "美国至6月22日6个月国债竞拍-投标倍数", "timestamp": 1782142000, "country": "美国", "star": "LOW" }
]
}
2
3
4
5
6
7
8
9
10
11
int getEconomicCalendar(Qot_GetEconomicCalendar.Request req);
onReply_GetEconomicCalendar(FTAPI_Conn client, int nSerialNo, Qot_GetEconomicCalendar.Response rsp)
介绍
获取经济事件日历,返回指定日期范围内的经济数据发布事件,包含事件标题、发布时间、国家、重要性星级、前值、预测值和实际公布值。支持按市场和重要性筛选,支持分页查询。
参数
// 事件重要性(星级)
enum Importance {
Importance_All = 0; //全部(默认)
Importance_Low = 1; //一星(低)
Importance_Medium = 2; //二星(中)
Importance_High = 3; //三星(高)
}
// 经济数据事件
message EconomicCalendarItem {
optional string title = 1; // 标题(如"非农就业人数")
optional double timestamp = 2; // 发布时间戳(秒)
optional string country = 3; // 国家名称
optional int32 star = 4; // 星级(重要性 1-3)
optional string previous = 5; // 前值
optional string consensus = 6; // 预测值
optional string actual = 7; // 实际值(公布值)
}
message C2S {
required string beginDate = 1; // 开始日期,格式"yyyy-MM-dd",按本机系统时区解释
optional string endDate = 2; // 结束日期,格式"yyyy-MM-dd",不传则仅查beginDate当天
repeated int32 marketList = 3; // Qot_Common.QotMarket,市场筛选(多选,支持HK/US/CNSH/SG/JP/AU/MY/CA)
optional int32 importance = 4; // Importance,事件重要性筛选,默认All
optional int32 count = 5; // 每页数量,默认50,最大100
optional string nextPage = 6; // 翻页标记,首次不传,后续带上S2C返回的nextPage
}
message S2C {
repeated EconomicCalendarItem itemList = 1; // 经济数据事件列表
optional string nextPage = 2; // 下一页翻页标记
optional bool hasMore = 3; // 是否还有更多数据
}
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
- 接口调用结果,结构参见 RetType
协议 ID
3409
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;
QotGetEconomicCalendar.C2S c2s = QotGetEconomicCalendar.C2S.newBuilder()
.setBeginDate("2026-06-22")
.setEndDate("2026-06-22")
.setCount(3)
.build();
QotGetEconomicCalendar.Request req = QotGetEconomicCalendar.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getEconomicCalendar(req);
System.out.printf("Send QotGetEconomicCalendar: %d
", seqNo);
}
@Override
public void onDisconnect(MMAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d
", errCode);
}
@Override
public void onReply_GetEconomicCalendar(MMAPI_Conn client, int nSerialNo, QotGetEconomicCalendar.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetEconomicCalendar failed: %s
", rsp.getRetMsg());
} else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetEconomicCalendar: %s
", json);
} catch (InvalidProtocolBufferException e) {
e.printStackTrace();
}
}
}
public static void main(String[] args) {
MMAPI.init();
QotDemo qot = new QotDemo();
qot.start();
while (true) {
try {
Thread.sleep(1000 * 600);
} catch (InterruptedException exc) {
}
}
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
- Output
Send QotGetEconomicCalendar: 3
Receive QotGetEconomicCalendar: {
"hasMore": false,
"itemList": [
{ "title": "中国至6月22日一年期贷款市场报价利率", "timestamp": 1782090000, "country": "中国", "star": "HIGH" },
{ "title": "中国至6月22日五年期贷款市场报价利率", "timestamp": 1782090000, "country": "中国", "star": "MEDIUM" },
{ "title": "美国至6月22日6个月国债竞拍-投标倍数", "timestamp": 1782142000, "country": "美国", "star": "LOW" }
]
}
2
3
4
5
6
7
8
9
介绍
获取经济事件日历,返回指定日期范围内的经济数据发布事件,包含事件标题、发布时间、国家、重要性星级、前值、预测值和实际公布值。支持按市场和重要性筛选,支持分页查询。
参数
// 事件重要性(星级)
enum Importance {
Importance_All = 0; //全部(默认)
Importance_Low = 1; //一星(低)
Importance_Medium = 2; //二星(中)
Importance_High = 3; //三星(高)
}
// 经济数据事件
message EconomicCalendarItem {
optional string title = 1; // 标题(如"非农就业人数")
optional double timestamp = 2; // 发布时间戳(秒)
optional string country = 3; // 国家名称
optional int32 star = 4; // 星级(重要性 1-3)
optional string previous = 5; // 前值
optional string consensus = 6; // 预测值
optional string actual = 7; // 实际值(公布值)
}
message C2S {
required string beginDate = 1; // 开始日期,格式"yyyy-MM-dd",按本机系统时区解释
optional string endDate = 2; // 结束日期,格式"yyyy-MM-dd",不传则仅查beginDate当天
repeated int32 marketList = 3; // Qot_Common.QotMarket,市场筛选(多选,支持HK/US/CNSH/SG/JP/AU/MY/CA)
optional int32 importance = 4; // Importance,事件重要性筛选,默认All
optional int32 count = 5; // 每页数量,默认50,最大100
optional string nextPage = 6; // 翻页标记,首次不传,后续带上S2C返回的nextPage
}
message S2C {
repeated EconomicCalendarItem itemList = 1; // 经济数据事件列表
optional string nextPage = 2; // 下一页翻页标记
optional bool hasMore = 3; // 是否还有更多数据
}
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
- 接口调用结果,结构参见 RetType
协议 ID
3409
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_GetEconomicCalendar::Request req;
Qot_GetEconomicCalendar::C2S *c2s = req.mutable_c2s();
c2s->set_begindate("2024-06-01");
c2s->set_enddate("2024-06-07");
m_GetEconomicCalendarSerialNo = m_pQotApi->GetEconomicCalendar(req);
}
virtual void OnReply_GetEconomicCalendar(moomoo::u32_t nSerialNo, const Qot_GetEconomicCalendar::Response &stRsp) {
if (nSerialNo != m_GetEconomicCalendarSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
MMAPI_Qot *m_pQotApi;
moomoo::u32_t m_GetEconomicCalendarSerialNo = 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": {
"itemList": [
{
"title": "Non-Farm Payrolls",
"timestamp": 1717430400.0,
"country": "US",
"star": 3,
"previous": "175K",
"consensus": "185K",
"actual": "272K"
}
],
"hasMore": false
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
getEconomicCalendar(qotGetEconomicCalendar)
介绍
协议请求与返回定义
参数
// 事件重要性(星级)
enum Importance {
Importance_All = 0; //全部(默认)
Importance_Low = 1; //一星(低)
Importance_Medium = 2; //二星(中)
Importance_High = 3; //三星(高)
}
// 经济数据事件
message EconomicCalendarItem {
optional string title = 1; // 标题(如"非农就业人数")
optional double timestamp = 2; // 发布时间戳(秒)
optional string country = 3; // 国家名称
optional int32 star = 4; // 星级(重要性 1-3)
optional string previous = 5; // 前值
optional string consensus = 6; // 预测值
optional string actual = 7; // 实际值(公布值)
}
message C2S {
required string beginDate = 1; // 开始日期,格式"yyyy-MM-dd",按本机系统时区解释
optional string endDate = 2; // 结束日期,格式"yyyy-MM-dd",不传则仅查beginDate当天
repeated int32 marketList = 3; // Qot_Common.QotMarket,市场筛选(多选,支持HK/US/CNSH/SG/JP/AU/MY/CA)
optional int32 importance = 4; // Importance,事件重要性筛选,默认All
optional int32 count = 5; // 每页数量,默认50,最大100
optional string nextPage = 6; // 翻页标记,首次不传,后续带上S2C返回的nextPage
}
message S2C {
repeated EconomicCalendarItem itemList = 1; // 经济数据事件列表
optional string nextPage = 2; // 下一页翻页标记
optional bool hasMore = 3; // 是否还有更多数据
}
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
- 接口调用结果,结构参见 RetType
协议 ID
3409
Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_Common } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetEconomicCalendar(){
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: {
beginDate: "2026-06-22",
endDate: "2026-06-22",
count: 3,
},
};
websocket.GetEconomicCalendar(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetEconomicCalendar: 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);
}
QotGetEconomicCalendar()
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
- Output
GetEconomicCalendar: errCode 0, retMsg , retType 0
{
"hasMore": false,
"itemList": [
{ "title": "中国至6月22日一年期贷款市场报价利率", "timestamp": 1782090000, "country": "中国", "star": "HIGH" },
{ "title": "中国至6月22日五年期贷款市场报价利率", "timestamp": 1782090000, "country": "中国", "star": "MEDIUM" },
{ "title": "美国至6月22日6个月国债竞拍-投标倍数", "timestamp": 1782142000, "country": "美国", "star": "LOW" }
]
}
2
3
4
5
6
7
8
9
接口限制
- 30 秒内最多 60 次请求
- 分页请求仅首页计入限频统计