# Get Economic Calendar
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_economic_calendar(begin_date, end_date=None, market_list=None, importance=None, count=None, next_page=None)
Description
Get economic event calendar, returning economic data release events within a specified date range, including event title, release time, country, importance star rating, previous value, forecast value, and actual published value. Supports filtering by market and importance, and supports pagination.
Parameters
Parameter Type Description begin_date str Start date, format "yyyy-MM-dd" (required) end_date str End date, format "yyyy-MM-dd"; if not provided, only queries begin_date market_list list[Market] Market filter (multi-select, supports HK/US/SH/SG/JP/AU/MY/CA), if not provided returns all markets importance EconomicImportance Event importance filter, default ALL count int Per page count, default 50, max 100 next_page str Page marker, do not provide for first request, pass the next_page from previous response afterwards Return
Parameter Type Description ret RET_CODE API call result data pd.DataFrame When ret == RET_OK, returns data str When ret != RET_OK, returns error description - Data format:
Field Type Description title str Event title (e.g. "Non-Farm Payrolls") timestamp float Release timestamp (seconds) country str Country name star str Importance star rating ("LOW"/"MEDIUM"/"HIGH") previous str Previous value ("--" if not available) consensus str Forecast value ("--" if not available) actual str Actual published value ("--" if not available)
- Data format:
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
Description
Get economic event calendar, returning economic data release events within a specified date range, including event title, release time, country, importance star rating, previous value, forecast value, and actual published value. Supports filtering by market and importance, and supports pagination.
Parameters
// Event importance (star rating)
enum Importance {
Importance_All = 0; //All (default)
Importance_Low = 1; //One star (low)
Importance_Medium = 2; //Two stars (medium)
Importance_High = 3; //Three stars (high)
}
// Economic data event
message EconomicCalendarItem {
optional string title = 1; // Title (e.g. "Non-Farm Payrolls")
optional double timestamp = 2; // Publish timestamp (seconds)
optional string country = 3; // Country name
optional int32 star = 4; // Star rating (importance 1-3)
optional string previous = 5; // Previous value
optional string consensus = 6; // Forecast value
optional string actual = 7; // Actual value (published)
}
message C2S {
required string beginDate = 1; // Start date, format "yyyy-MM-dd", interpreted by local system timezone
optional string endDate = 2; // End date, format "yyyy-MM-dd", queries beginDate only if omitted
repeated int32 marketList = 3; // Qot_Common.QotMarket, market filter (multi-select, supports HK/US/CNSH/SG/JP/AU/MY/CA)
optional int32 importance = 4; // Importance, event importance filter, default All
optional int32 count = 5; // Per page count, default 50, max 100
optional string nextPage = 6; // Page marker, omit for first request, pass nextPage from S2C afterwards
}
message S2C {
repeated EconomicCalendarItem itemList = 1; // Economic data event list
optional string nextPage = 2; // Next page marker
optional bool hasMore = 3; // Whether there is more data
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; //RetType, return result
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
Protocol ID
3409
uint GetEconomicCalendar(Qot_GetEconomicCalendar.Request req);
virtual void OnReply_GetEconomicCalendar(FTAPI_Conn client, uint nSerialNo, Qot_GetEconomicCalendar.Response rsp);
Description
Get economic event calendar, returning economic data release events within a specified date range, including event title, release time, country, importance star rating, previous value, forecast value, and actual published value. Supports filtering by market and importance, and supports pagination.
Parameters
// Event importance (star rating)
enum Importance {
Importance_All = 0; //All (default)
Importance_Low = 1; //One star (low)
Importance_Medium = 2; //Two stars (medium)
Importance_High = 3; //Three stars (high)
}
// Economic data event
message EconomicCalendarItem {
optional string title = 1; // Title (e.g. "Non-Farm Payrolls")
optional double timestamp = 2; // Publish timestamp (seconds)
optional string country = 3; // Country name
optional int32 star = 4; // Star rating (importance 1-3)
optional string previous = 5; // Previous value
optional string consensus = 6; // Forecast value
optional string actual = 7; // Actual value (published)
}
message C2S {
required string beginDate = 1; // Start date, format "yyyy-MM-dd", interpreted by local system timezone
optional string endDate = 2; // End date, format "yyyy-MM-dd", queries beginDate only if omitted
repeated int32 marketList = 3; // Qot_Common.QotMarket, market filter (multi-select, supports HK/US/CNSH/SG/JP/AU/MY/CA)
optional int32 importance = 4; // Importance, event importance filter, default All
optional int32 count = 5; // Per page count, default 50, max 100
optional string nextPage = 6; // Page marker, omit for first request, pass nextPage from S2C afterwards
}
message S2C {
repeated EconomicCalendarItem itemList = 1; // Economic data event list
optional string nextPage = 2; // Next page marker
optional bool hasMore = 3; // Whether there is more data
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; //RetType, return result
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
- For interface result, refer to RetType
Protocol 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)
Description
Get economic event calendar, returning economic data release events within a specified date range, including event title, release time, country, importance star rating, previous value, forecast value, and actual published value. Supports filtering by market and importance, and supports pagination.
Parameters
// Event importance (star rating)
enum Importance {
Importance_All = 0; //All (default)
Importance_Low = 1; //One star (low)
Importance_Medium = 2; //Two stars (medium)
Importance_High = 3; //Three stars (high)
}
// Economic data event
message EconomicCalendarItem {
optional string title = 1; // Title (e.g. "Non-Farm Payrolls")
optional double timestamp = 2; // Publish timestamp (seconds)
optional string country = 3; // Country name
optional int32 star = 4; // Star rating (importance 1-3)
optional string previous = 5; // Previous value
optional string consensus = 6; // Forecast value
optional string actual = 7; // Actual value (published)
}
message C2S {
required string beginDate = 1; // Start date, format "yyyy-MM-dd", interpreted by local system timezone
optional string endDate = 2; // End date, format "yyyy-MM-dd", queries beginDate only if omitted
repeated int32 marketList = 3; // Qot_Common.QotMarket, market filter (multi-select, supports HK/US/CNSH/SG/JP/AU/MY/CA)
optional int32 importance = 4; // Importance, event importance filter, default All
optional int32 count = 5; // Per page count, default 50, max 100
optional string nextPage = 6; // Page marker, omit for first request, pass nextPage from S2C afterwards
}
message S2C {
repeated EconomicCalendarItem itemList = 1; // Economic data event list
optional string nextPage = 2; // Next page marker
optional bool hasMore = 3; // Whether there is more data
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; //RetType, return result
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
- For interface result, refer to RetType
Protocol 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
Futu::u32_t GetEconomicCalendar(const Qot_GetEconomicCalendar::Request &stReq);
virtual void OnReply_GetEconomicCalendar(Futu::u32_t nSerialNo, const Qot_GetEconomicCalendar::Response &stRsp) = 0;
Description
Protocol request and response definition
Parameters
// Event importance (star rating)
enum Importance {
Importance_All = 0; //All (default)
Importance_Low = 1; //One star (low)
Importance_Medium = 2; //Two stars (medium)
Importance_High = 3; //Three stars (high)
}
// Economic data event
message EconomicCalendarItem {
optional string title = 1; // Title (e.g. "Non-Farm Payrolls")
optional double timestamp = 2; // Publish timestamp (seconds)
optional string country = 3; // Country name
optional int32 star = 4; // Star rating (importance 1-3)
optional string previous = 5; // Previous value
optional string consensus = 6; // Forecast value
optional string actual = 7; // Actual value (published)
}
message C2S {
required string beginDate = 1; // Start date, format "yyyy-MM-dd", interpreted by local system timezone
optional string endDate = 2; // End date, format "yyyy-MM-dd", queries beginDate only if omitted
repeated int32 marketList = 3; // Qot_Common.QotMarket, market filter (multi-select, supports HK/US/CNSH/SG/JP/AU/MY/CA)
optional int32 importance = 4; // Importance, event importance filter, default All
optional int32 count = 5; // Per page count, default 50, max 100
optional string nextPage = 6; // Page marker, omit for first request, pass nextPage from S2C afterwards
}
message S2C {
repeated EconomicCalendarItem itemList = 1; // Economic data event list
optional string nextPage = 2; // Next page marker
optional bool hasMore = 3; // Whether there is more data
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; //RetType, return result
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
- For interface result, refer to RetType
Protocol 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)
Description
Get economic event calendar, returning economic data release events within a specified date range, including event title, release time, country, importance star rating, previous value, forecast value, and actual published value. Supports filtering by market and importance, and supports pagination.
Parameters
// Event importance (star rating)
enum Importance {
Importance_All = 0; //All (default)
Importance_Low = 1; //One star (low)
Importance_Medium = 2; //Two stars (medium)
Importance_High = 3; //Three stars (high)
}
// Economic data event
message EconomicCalendarItem {
optional string title = 1; // Title (e.g. "Non-Farm Payrolls")
optional double timestamp = 2; // Publish timestamp (seconds)
optional string country = 3; // Country name
optional int32 star = 4; // Star rating (importance 1-3)
optional string previous = 5; // Previous value
optional string consensus = 6; // Forecast value
optional string actual = 7; // Actual value (published)
}
message C2S {
required string beginDate = 1; // Start date, format "yyyy-MM-dd", interpreted by local system timezone
optional string endDate = 2; // End date, format "yyyy-MM-dd", queries beginDate only if omitted
repeated int32 marketList = 3; // Qot_Common.QotMarket, market filter (multi-select, supports HK/US/CNSH/SG/JP/AU/MY/CA)
optional int32 importance = 4; // Importance, event importance filter, default All
optional int32 count = 5; // Per page count, default 50, max 100
optional string nextPage = 6; // Page marker, omit for first request, pass nextPage from S2C afterwards
}
message S2C {
repeated EconomicCalendarItem itemList = 1; // Economic data event list
optional string nextPage = 2; // Next page marker
optional bool hasMore = 3; // Whether there is more data
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; //RetType, return result
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
- For interface result, refer to RetType
Protocol 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
API Limits
- Maximum 60 requests within 30 seconds
- Only the first page of paginated requests counts toward rate limiting
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_economic_calendar(begin_date, end_date=None, market_list=None, importance=None, count=None, next_page=None)
Description
Get economic event calendar, returning economic data release events within a specified date range, including event title, release time, country, importance star rating, previous value, forecast value, and actual published value. Supports filtering by market and importance, and supports pagination.
Parameters
Parameter Type Description begin_date str Start date, format "yyyy-MM-dd" (required) end_date str End date, format "yyyy-MM-dd"; if not provided, only queries begin_date market_list list[Market] Market filter (multi-select, supports HK/US/SH/SG/JP/AU/MY/CA), if not provided returns all markets importance EconomicImportance Event importance filter, default ALL count int Per page count, default 50, max 100 next_page str Page marker, do not provide for first request, pass the next_page from previous response afterwards Return
Parameter Type Description ret RET_CODE API call result data pd.DataFrame When ret == RET_OK, returns data str When ret != RET_OK, returns error description - Data format:
Field Type Description title str Event title (e.g. "Non-Farm Payrolls") timestamp float Release timestamp (seconds) country str Country name star str Importance star rating ("LOW"/"MEDIUM"/"HIGH") previous str Previous value ("--" if not available) consensus str Forecast value ("--" if not available) actual str Actual published value ("--" if not available)
- Data format:
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
Description
Get economic event calendar, returning economic data release events within a specified date range, including event title, release time, country, importance star rating, previous value, forecast value, and actual published value. Supports filtering by market and importance, and supports pagination.
Parameters
// Event importance (star rating)
enum Importance {
Importance_All = 0; //All (default)
Importance_Low = 1; //One star (low)
Importance_Medium = 2; //Two stars (medium)
Importance_High = 3; //Three stars (high)
}
// Economic data event
message EconomicCalendarItem {
optional string title = 1; // Title (e.g. "Non-Farm Payrolls")
optional double timestamp = 2; // Publish timestamp (seconds)
optional string country = 3; // Country name
optional int32 star = 4; // Star rating (importance 1-3)
optional string previous = 5; // Previous value
optional string consensus = 6; // Forecast value
optional string actual = 7; // Actual value (published)
}
message C2S {
required string beginDate = 1; // Start date, format "yyyy-MM-dd", interpreted by local system timezone
optional string endDate = 2; // End date, format "yyyy-MM-dd", queries beginDate only if omitted
repeated int32 marketList = 3; // Qot_Common.QotMarket, market filter (multi-select, supports HK/US/CNSH/SG/JP/AU/MY/CA)
optional int32 importance = 4; // Importance, event importance filter, default All
optional int32 count = 5; // Per page count, default 50, max 100
optional string nextPage = 6; // Page marker, omit for first request, pass nextPage from S2C afterwards
}
message S2C {
repeated EconomicCalendarItem itemList = 1; // Economic data event list
optional string nextPage = 2; // Next page marker
optional bool hasMore = 3; // Whether there is more data
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; //RetType, return result
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
Protocol ID
3409
uint GetEconomicCalendar(Qot_GetEconomicCalendar.Request req);
virtual void OnReply_GetEconomicCalendar(FTAPI_Conn client, uint nSerialNo, Qot_GetEconomicCalendar.Response rsp);
Description
Get economic event calendar, returning economic data release events within a specified date range, including event title, release time, country, importance star rating, previous value, forecast value, and actual published value. Supports filtering by market and importance, and supports pagination.
Parameters
// Event importance (star rating)
enum Importance {
Importance_All = 0; //All (default)
Importance_Low = 1; //One star (low)
Importance_Medium = 2; //Two stars (medium)
Importance_High = 3; //Three stars (high)
}
// Economic data event
message EconomicCalendarItem {
optional string title = 1; // Title (e.g. "Non-Farm Payrolls")
optional double timestamp = 2; // Publish timestamp (seconds)
optional string country = 3; // Country name
optional int32 star = 4; // Star rating (importance 1-3)
optional string previous = 5; // Previous value
optional string consensus = 6; // Forecast value
optional string actual = 7; // Actual value (published)
}
message C2S {
required string beginDate = 1; // Start date, format "yyyy-MM-dd", interpreted by local system timezone
optional string endDate = 2; // End date, format "yyyy-MM-dd", queries beginDate only if omitted
repeated int32 marketList = 3; // Qot_Common.QotMarket, market filter (multi-select, supports HK/US/CNSH/SG/JP/AU/MY/CA)
optional int32 importance = 4; // Importance, event importance filter, default All
optional int32 count = 5; // Per page count, default 50, max 100
optional string nextPage = 6; // Page marker, omit for first request, pass nextPage from S2C afterwards
}
message S2C {
repeated EconomicCalendarItem itemList = 1; // Economic data event list
optional string nextPage = 2; // Next page marker
optional bool hasMore = 3; // Whether there is more data
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; //RetType, return result
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
- For interface result, refer to RetType
Protocol 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)
Description
Get economic event calendar, returning economic data release events within a specified date range, including event title, release time, country, importance star rating, previous value, forecast value, and actual published value. Supports filtering by market and importance, and supports pagination.
Parameters
// Event importance (star rating)
enum Importance {
Importance_All = 0; //All (default)
Importance_Low = 1; //One star (low)
Importance_Medium = 2; //Two stars (medium)
Importance_High = 3; //Three stars (high)
}
// Economic data event
message EconomicCalendarItem {
optional string title = 1; // Title (e.g. "Non-Farm Payrolls")
optional double timestamp = 2; // Publish timestamp (seconds)
optional string country = 3; // Country name
optional int32 star = 4; // Star rating (importance 1-3)
optional string previous = 5; // Previous value
optional string consensus = 6; // Forecast value
optional string actual = 7; // Actual value (published)
}
message C2S {
required string beginDate = 1; // Start date, format "yyyy-MM-dd", interpreted by local system timezone
optional string endDate = 2; // End date, format "yyyy-MM-dd", queries beginDate only if omitted
repeated int32 marketList = 3; // Qot_Common.QotMarket, market filter (multi-select, supports HK/US/CNSH/SG/JP/AU/MY/CA)
optional int32 importance = 4; // Importance, event importance filter, default All
optional int32 count = 5; // Per page count, default 50, max 100
optional string nextPage = 6; // Page marker, omit for first request, pass nextPage from S2C afterwards
}
message S2C {
repeated EconomicCalendarItem itemList = 1; // Economic data event list
optional string nextPage = 2; // Next page marker
optional bool hasMore = 3; // Whether there is more data
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; //RetType, return result
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
- For interface result, refer to RetType
Protocol 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
moomoo::u32_t GetEconomicCalendar(const Qot_GetEconomicCalendar::Request &stReq);
virtual void OnReply_GetEconomicCalendar(moomoo::u32_t nSerialNo, const Qot_GetEconomicCalendar::Response &stRsp) = 0;
Description
Protocol request and response definition
Parameters
// Event importance (star rating)
enum Importance {
Importance_All = 0; //All (default)
Importance_Low = 1; //One star (low)
Importance_Medium = 2; //Two stars (medium)
Importance_High = 3; //Three stars (high)
}
// Economic data event
message EconomicCalendarItem {
optional string title = 1; // Title (e.g. "Non-Farm Payrolls")
optional double timestamp = 2; // Publish timestamp (seconds)
optional string country = 3; // Country name
optional int32 star = 4; // Star rating (importance 1-3)
optional string previous = 5; // Previous value
optional string consensus = 6; // Forecast value
optional string actual = 7; // Actual value (published)
}
message C2S {
required string beginDate = 1; // Start date, format "yyyy-MM-dd", interpreted by local system timezone
optional string endDate = 2; // End date, format "yyyy-MM-dd", queries beginDate only if omitted
repeated int32 marketList = 3; // Qot_Common.QotMarket, market filter (multi-select, supports HK/US/CNSH/SG/JP/AU/MY/CA)
optional int32 importance = 4; // Importance, event importance filter, default All
optional int32 count = 5; // Per page count, default 50, max 100
optional string nextPage = 6; // Page marker, omit for first request, pass nextPage from S2C afterwards
}
message S2C {
repeated EconomicCalendarItem itemList = 1; // Economic data event list
optional string nextPage = 2; // Next page marker
optional bool hasMore = 3; // Whether there is more data
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; //RetType, return result
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
- For interface result, refer to RetType
Protocol 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)
Description
Get economic event calendar, returning economic data release events within a specified date range, including event title, release time, country, importance star rating, previous value, forecast value, and actual published value. Supports filtering by market and importance, and supports pagination.
Parameters
// Event importance (star rating)
enum Importance {
Importance_All = 0; //All (default)
Importance_Low = 1; //One star (low)
Importance_Medium = 2; //Two stars (medium)
Importance_High = 3; //Three stars (high)
}
// Economic data event
message EconomicCalendarItem {
optional string title = 1; // Title (e.g. "Non-Farm Payrolls")
optional double timestamp = 2; // Publish timestamp (seconds)
optional string country = 3; // Country name
optional int32 star = 4; // Star rating (importance 1-3)
optional string previous = 5; // Previous value
optional string consensus = 6; // Forecast value
optional string actual = 7; // Actual value (published)
}
message C2S {
required string beginDate = 1; // Start date, format "yyyy-MM-dd", interpreted by local system timezone
optional string endDate = 2; // End date, format "yyyy-MM-dd", queries beginDate only if omitted
repeated int32 marketList = 3; // Qot_Common.QotMarket, market filter (multi-select, supports HK/US/CNSH/SG/JP/AU/MY/CA)
optional int32 importance = 4; // Importance, event importance filter, default All
optional int32 count = 5; // Per page count, default 50, max 100
optional string nextPage = 6; // Page marker, omit for first request, pass nextPage from S2C afterwards
}
message S2C {
repeated EconomicCalendarItem itemList = 1; // Economic data event list
optional string nextPage = 2; // Next page marker
optional bool hasMore = 3; // Whether there is more data
}
message Request {
required C2S c2s = 1;
}
message Response {
required int32 retType = 1 [default = -400]; //RetType, return result
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
- For interface result, refer to RetType
Protocol 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
API Limits
- Maximum 60 requests within 30 seconds
- Only the first page of paginated requests counts toward rate limiting