# 獲取事件合約里程碑列表
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_event_contract_milestone_list(category=None, competition=None, related_event=None, next_page=None, count=None)
介紹
獲取事件合約里程碑列表。里程碑是賽事類事件合約的重要時間節點(如某場比賽),支援按分類、賽事、關聯事件過濾與分頁。
參數
參數 類型 說明 category str 一級分類,例如 'Sports'competition str 賽事名稱,來自 filter_competitionrelated_event str 關聯事件代碼 next_page str 翻頁標記,首頁傳 Nonecount int 返回數量上限 返回
參數 類型 說明 ret RET_CODE 介面調用結果 data pd.DataFrame 當 ret == RET_OK,返回里程碑列表 str 當 ret != RET_OK,返回錯誤描述 next_page str 下一頁翻頁標記,為空表示沒有下一頁 返回的 DataFrame 欄位如下:
欄位 類型 說明 milestone_code str 里程碑代碼 title str 里程碑名稱(多語言) category str 一級分類標識 type str 里程碑類型,參見 ECMilestoneType start_date str 開始時間 end_date str 結束時間 primary_event_code str 主事件代碼 related_events list 關聯事件代碼列表 notification_message str 通知訊息(多語言) Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data, next_page = quote_ctx.get_event_contract_milestone_list(
category='Sports', count=5
)
if ret == RET_OK:
print(data)
print('next_page:', next_page)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
- Output
milestone_code title category type start_date end_date primary_event_code related_events notification_message
0 EC.d8a4c769-6d6b-45b0-90c0-aaa40ffefbbe.MILESTONE France vs Spain Sports SOCCER_TOURNAMENT_MULTI_LEG 2026-07-14 N/A EC.KXWCADVANCE-26JUL14FRAESP.EVENT [EC.KXWCADVANCE-26JUL14FRAESP.EVENT, EC.KXWCGAME-26JUL14FRAESP.EVENT, ...] The game is about to begin.
1 EC.9ed9d180-9fa6-4a26-9b75-36e9bfb1081a.MILESTONE England vs Argentina Sports SOCCER_TOURNAMENT_MULTI_LEG 2026-07-15 N/A EC.KXWCADVANCE-26JUL15ENGARG.EVENT [EC.KXWCADVANCE-26JUL15ENGARG.EVENT, EC.KXWCGAME-26JUL15ENGARG.EVENT, ...] The game is about to begin.
next_page: 5
2
3
4
# Qot_GetEventContractMilestoneList.proto
介紹
獲取事件合約里程碑列表。
參數
// 里程碑項
message MilestoneItem {
required Qot_Common.Security milestoneSecurity = 1; // 里程碑標的
optional string title = 2; // 里程碑名稱(多語言)
optional string category = 3; // 一級分類標識
optional Qot_Common.EC_MilestoneType type = 4; // 里程碑類型
optional string startDate = 5; // 開始時間
optional string endDate = 6; // 結束時間
optional Qot_Common.Security primaryEventSecurity = 7; // 主事件標的
repeated Qot_Common.Security relatedEventList = 8; // 關聯事件標的列表
optional string notificationMessage = 9; // 通知訊息(多語言)
}
message C2S {
optional string category = 1; // 一級分類 ("SPORTS")
optional string competition = 2; // 賽事標識
optional Qot_Common.Security relatedEvent = 3; // 關聯事件標的,本地過濾
optional string nextPage = 4; // 翻頁標記(首頁不填)
optional int32 count = 5; // 單頁最大返回數(預設200)
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
- 股票結構參見 Security
- 返回
message S2C {
repeated MilestoneItem milestoneList = 1;
optional string nextPage = 2; // 為空表示沒有下一頁
}
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
- 里程碑類型枚舉參見 EC_MilestoneType
- 介面調用結果,結構參見 RetType
協議 ID
3439
數據類型
- 股票結構參見 Security
- 里程碑類型參見 ECMilestoneType
uint GetEventContractMilestoneList(GetEventContractMilestoneList.Request req);
virtual void OnReply_GetEventContractMilestoneList(FTAPI_Conn client, uint nSerialNo, GetEventContractMilestoneList.Response rsp);
介紹
獲取事件合約里程碑列表。
參數
message MilestoneItem {
required Qot_Common.Security milestoneSecurity = 1;
optional string title = 2;
optional string category = 3;
optional Qot_Common.EC_MilestoneType type = 4;
optional string startDate = 5;
optional string endDate = 6;
optional Qot_Common.Security primaryEventSecurity = 7;
repeated Qot_Common.Security relatedEventList = 8;
optional string notificationMessage = 9;
}
message C2S {
optional string category = 1;
optional string competition = 2;
optional Qot_Common.Security relatedEvent = 3;
optional string nextPage = 4;
optional int32 count = 5;
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
- 股票結構參見 Security
- 返回
message S2C {
repeated MilestoneItem milestoneList = 1;
optional string nextPage = 2;
}
message Response {
required int32 retType = 1 [default = -400];
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
- 里程碑類型枚舉參見 EC_MilestoneType
- 介面調用結果,結構參見 RetType
- 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)
{
if (errCode != 0) return;
var c2s = GetEventContractMilestoneList.C2S.CreateBuilder()
.SetCategory("Sports").SetCount(5).Build();
var req = GetEventContractMilestoneList.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetEventContractMilestoneList(req);
Console.Write("Send GetEventContractMilestoneList: {0}\n", seqNo);
}
public void OnReply_GetEventContractMilestoneList(FTAPI_Conn client, uint nSerialNo, GetEventContractMilestoneList.Response rsp)
{
Console.Write("Reply: {0} {1}\n", nSerialNo, rsp.ToString());
}
public static void Main(String[] args)
{
FTAPI.Init();
new 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
int getEventContractMilestoneList(QotGetEventContractMilestoneList.Request req);
void onReply_GetEventContractMilestoneList(FTAPI_Conn client, int nSerialNo, QotGetEventContractMilestoneList.Response rsp);
介紹
獲取事件合約里程碑列表。
參數
message C2S {
optional string category = 1;
optional string competition = 2;
optional Qot_Common.Security relatedEvent = 3;
optional string nextPage = 4;
optional int32 count = 5;
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- 股票結構參見 Security
- 返回
message S2C {
repeated MilestoneItem milestoneList = 1;
optional string nextPage = 2;
}
message Response {
required int32 retType = 1 [default = -400];
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
- 里程碑類型枚舉參見 EC_MilestoneType
- 介面調用結果,結構參見 RetType
- Example
public class Program implements FTSPI_Qot, FTSPI_Conn {
private FTAPI_Conn_Qot qot = new FTAPI_Conn_Qot();
public Program() {
qot.setClientInfo("java", 1);
qot.setConnCallback(this);
qot.setQotCallback(this);
}
public void start() {
qot.initConnect("127.0.0.1", (short) 11111, false);
}
@Override
public void onInitConnect(FTAPI_Conn client, long errCode, String desc) {
if (errCode != 0) return;
QotGetEventContractMilestoneList.C2S c2s = QotGetEventContractMilestoneList.C2S.newBuilder()
.setCategory("Sports").setCount(5).build();
QotGetEventContractMilestoneList.Request req = QotGetEventContractMilestoneList.Request.newBuilder()
.setC2S(c2s).build();
int seqNo = qot.getEventContractMilestoneList(req);
System.out.println("Send GetEventContractMilestoneList: " + seqNo);
}
@Override
public void onReply_GetEventContractMilestoneList(FTAPI_Conn client, int nSerialNo, QotGetEventContractMilestoneList.Response rsp) {
System.out.println("Reply: " + nSerialNo + " " + rsp.toString());
}
public static void main(String[] args) {
FTAPI.init();
new Program().start();
while (true) {
try { Thread.sleep(1000 * 600); } catch (InterruptedException e) {}
}
}
}
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
Futu::u32_t GetEventContractMilestoneList(const Qot_GetEventContractMilestoneList::Request &stReq);
virtual void OnReply_GetEventContractMilestoneList(Futu::u32_t nSerialNo, const Qot_GetEventContractMilestoneList::Response &stRsp) = 0;
介紹
獲取事件合約里程碑列表。
參數
// 里程碑項
message MilestoneItem {
required Qot_Common.Security milestoneSecurity = 1; // 里程碑標的
optional string title = 2; // 里程碑名稱(多語言)
optional string category = 3; // 一級分類標識
optional Qot_Common.EC_MilestoneType type = 4; // 里程碑類型
optional string startDate = 5; // 開始時間
optional string endDate = 6; // 結束時間
optional Qot_Common.Security primaryEventSecurity = 7; // 主事件標的
repeated Qot_Common.Security relatedEventList = 8; // 關聯事件標的列表
optional string notificationMessage = 9; // 通知訊息(多語言)
}
message C2S {
optional string category = 1; // 一級分類 ("SPORTS")
optional string competition = 2; // 賽事標識
optional Qot_Common.Security relatedEvent = 3; // 關聯事件標的,本地過濾
optional string nextPage = 4; // 翻頁標記(首頁不填)
optional int32 count = 5; // 單頁最大返回數(預設200)
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
- 股票結構參見 Security
- 返回
message S2C {
repeated MilestoneItem milestoneList = 1;
optional string nextPage = 2; // 為空表示沒有下一頁
}
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
- 里程碑類型枚舉參見 EC_MilestoneType
- 介面調用結果,結構參見 RetType
- Example
class Program : public FTSPI_Qot, public FTSPI_Trd, public FTSPI_Conn
{
public:
Program() {
m_pQotApi = FTAPI::CreateQotApi();
m_pQotApi->RegisterQotSpi(this);
m_pQotApi->RegisterConnSpi(this);
}
~Program() {
if (m_pQotApi != nullptr)
{
m_pQotApi->UnregisterQotSpi();
m_pQotApi->UnregisterConnSpi();
FTAPI::ReleaseQotApi(m_pQotApi);
m_pQotApi = nullptr;
}
}
void Start() {
m_pQotApi->InitConnect("127.0.0.1", 11111, false);
}
virtual void OnInitConnect(FTAPI_Conn* pConn, Futu::i64_t nErrCode, const char* strDesc) {
cout << "connect" << endl;
// 組包
Qot_GetEventContractMilestoneList::Request req;
Qot_GetEventContractMilestoneList::C2S *c2s = req.mutable_c2s();
c2s->set_category("Sports");
c2s->set_count(5);
m_GetEventContractMilestoneListSerialNo = m_pQotApi->GetEventContractMilestoneList(req);
cout << "Request GetEventContractMilestoneList SerialNo: " << m_GetEventContractMilestoneListSerialNo << endl;
}
virtual void OnReply_GetEventContractMilestoneList(Futu::u32_t nSerialNo, const Qot_GetEventContractMilestoneList::Response &stRsp) {
if (nSerialNo == m_GetEventContractMilestoneListSerialNo)
{
cout << "OnReply_GetEventContractMilestoneList SerialNo: " << nSerialNo << endl;
// 解析內部結構打印出來
// ProtoBufToBodyData和UTF8ToLocal函數的定義參見Sample中的tool.h文件
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
}
protected:
FTAPI_Qot *m_pQotApi;
Futu::u32_t m_GetEventContractMilestoneListSerialNo;
};
int32_t main(int32_t argc, char** argv)
{
FTAPI::Init();
{
Program program;
program.Start();
getchar();
}
protobuf::ShutdownProtobufLibrary();
FTAPI::UnInit();
return 0;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
- Output
connect
Request GetEventContractMilestoneList SerialNo: 1
OnReply_GetEventContractMilestoneList SerialNo: 1
{
"retType": 0,
"retMsg": "",
"errCode": 0,
"s2c": {
"milestoneList": [
{
"milestoneSecurity": {"market": 101, "code": "EC.d8a4c769-6d6b-45b0-90c0-aaa40ffefbbe.MILESTONE"},
"title": "France vs Spain",
"category": "Sports",
"type": 3,
"startDate": "2026-07-14",
"primaryEventSecurity": {"market": 101, "code": "EC.KXWCADVANCE-26JUL14FRAESP.EVENT"},
"relatedEventList": [
{"market": 101, "code": "EC.KXWCADVANCE-26JUL14FRAESP.EVENT"},
{"market": 101, "code": "EC.KXWCGAME-26JUL14FRAESP.EVENT"},
{"market": 101, "code": "EC.KXWCSPREAD-26JUL14FRAESP.EVENT"}
],
"notificationMessage": "The game is about to begin."
},
{
"milestoneSecurity": {"market": 101, "code": "EC.9ed9d180-9fa6-4a26-9b75-36e9bfb1081a.MILESTONE"},
"title": "England vs Argentina",
"category": "Sports",
"type": 3,
"startDate": "2026-07-15",
"primaryEventSecurity": {"market": 101, "code": "EC.KXWCADVANCE-26JUL15ENGARG.EVENT"},
"relatedEventList": [
{"market": 101, "code": "EC.KXWCADVANCE-26JUL15ENGARG.EVENT"},
{"market": 101, "code": "EC.KXWCGAME-26JUL15ENGARG.EVENT"},
{"market": 101, "code": "EC.KXWCSPREAD-26JUL15ENGARG.EVENT"}
],
"notificationMessage": "The game is about to begin."
}
],
"nextPage": "5"
}
}
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
GetEventContractMilestoneList(req);
介紹
獲取事件合約的里程碑列表,可按分類、賽事、關聯事件過濾。
參數
// 里程碑項
message MilestoneItem {
required Qot_Common.Security milestoneSecurity = 1; // 里程碑標的
optional string title = 2; // 里程碑名稱(多語言)
optional string category = 3; // 一級分類標識
optional Qot_Common.EC_MilestoneType type = 4; // 里程碑類型
optional string startDate = 5; // 開始時間
optional string endDate = 6; // 結束時間
optional Qot_Common.Security primaryEventSecurity = 7; // 主事件標的
repeated Qot_Common.Security relatedEventList = 8; // 關聯事件標的列表
optional string notificationMessage = 9; // 通知訊息(多語言)
}
message C2S {
optional string category = 1; // 一級分類 ("SPORTS")
optional string competition = 2; // 賽事標識
optional Qot_Common.Security relatedEvent = 3; // 關聯事件標的,本地過濾
optional string nextPage = 4; // 翻頁標記(首頁不填)
optional int32 count = 5; // 單頁最大返回數(預設200)
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
- 股票結構參見 Security
- 返回
message S2C {
repeated MilestoneItem milestoneList = 1;
optional string nextPage = 2; // 為空表示沒有下一頁
}
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
- 里程碑類型枚舉參見 EC_MilestoneType
- 介面調用結果,結構參見 RetType
- Example
import ftWebsocket from "futu-api";
import { Common, Qot_Common } from "futu-api/proto";
import beautify from "js-beautify";
function GetEventContractMilestoneList() {
const { RetType } = Common;
let [addr, port, enable_ssl, key] = ["127.0.0.1", 11111, false, ""];
let websocket = new ftWebsocket();
websocket.onlogin = async (ret, msg) => {
if (!ret) { console.log("start error", msg); return; }
try {
const req = { c2s: { category: "Sports", count: 5 } };
let { errCode, retMsg, retType, s2c } = await websocket.GetEventContractMilestoneList(req);
console.log("GetEventContractMilestoneList: errCode %d, retMsg %s, retType %d", errCode, retMsg, retType);
if (retType == RetType.RetType_Succeed) {
console.log(beautify(JSON.stringify(s2c), { indent_size: 2, space_in_empty_paren: true }));
}
} catch (error) {
console.log("error:", error);
}
};
websocket.start(addr, port, enable_ssl, key);
setTimeout(() => { websocket.stop(); console.log("stop"); }, 5000);
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
- Output
GetEventContractMilestoneList: errCode 0, retMsg , retType 0
{
"milestoneList": [{
"milestoneSecurity": {
"market": 101,
"code": "EC.d8a4c769-6d6b-45b0-90c0-aaa40ffefbbe.MILESTONE"
},
"title": "France vs Spain",
"category": "Sports",
"type": 3,
"startDate": "2026-07-14",
"primaryEventSecurity": {
"market": 101,
"code": "EC.KXWCADVANCE-26JUL14FRAESP.EVENT"
},
"relatedEventList": [
{ "market": 101, "code": "EC.KXWCADVANCE-26JUL14FRAESP.EVENT" },
{ "market": 101, "code": "EC.KXWCGAME-26JUL14FRAESP.EVENT" },
{ "market": 101, "code": "EC.KXWCSPREAD-26JUL14FRAESP.EVENT" }
],
"notificationMessage": "The game is about to begin."
}, {
"milestoneSecurity": {
"market": 101,
"code": "EC.9ed9d180-9fa6-4a26-9b75-36e9bfb1081a.MILESTONE"
},
"title": "England vs Argentina",
"category": "Sports",
"type": 3,
"startDate": "2026-07-15",
"primaryEventSecurity": {
"market": 101,
"code": "EC.KXWCADVANCE-26JUL15ENGARG.EVENT"
},
"relatedEventList": [
{ "market": 101, "code": "EC.KXWCADVANCE-26JUL15ENGARG.EVENT" },
{ "market": 101, "code": "EC.KXWCGAME-26JUL15ENGARG.EVENT" },
{ "market": 101, "code": "EC.KXWCSPREAD-26JUL15ENGARG.EVENT" }
],
"notificationMessage": "The game is about to begin."
}],
"nextPage": "5"
}
stop
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
介面限制
- 每 30 秒內最多請求 10 次獲取事件合約里程碑列表介面
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_event_contract_milestone_list(category=None, competition=None, related_event=None, next_page=None, count=None)
介紹
獲取事件合約里程碑列表。里程碑是賽事類事件合約的重要時間節點(如某場比賽),支援按分類、賽事、關聯事件過濾與分頁。
參數
參數 類型 說明 category str 一級分類,例如 'Sports'competition str 賽事名稱,來自 filter_competitionrelated_event str 關聯事件代碼 next_page str 翻頁標記,首頁傳 Nonecount int 返回數量上限 返回
參數 類型 說明 ret RET_CODE 介面調用結果 data pd.DataFrame 當 ret == RET_OK,返回里程碑列表 str 當 ret != RET_OK,返回錯誤描述 next_page str 下一頁翻頁標記,為空表示沒有下一頁 返回的 DataFrame 欄位如下:
欄位 類型 說明 milestone_code str 里程碑代碼 title str 里程碑名稱(多語言) category str 一級分類標識 type str 里程碑類型,參見 ECMilestoneType start_date str 開始時間 end_date str 結束時間 primary_event_code str 主事件代碼 related_events list 關聯事件代碼列表 notification_message str 通知訊息(多語言) Example
from moomoo import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data, next_page = quote_ctx.get_event_contract_milestone_list(
category='Sports', count=5
)
if ret == RET_OK:
print(data)
print('next_page:', next_page)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
- Output
milestone_code title category type start_date end_date primary_event_code related_events notification_message
0 EC.d8a4c769-6d6b-45b0-90c0-aaa40ffefbbe.MILESTONE France vs Spain Sports SOCCER_TOURNAMENT_MULTI_LEG 2026-07-14 N/A EC.KXWCADVANCE-26JUL14FRAESP.EVENT [EC.KXWCADVANCE-26JUL14FRAESP.EVENT, EC.KXWCGAME-26JUL14FRAESP.EVENT, ...] The game is about to begin.
1 EC.9ed9d180-9fa6-4a26-9b75-36e9bfb1081a.MILESTONE England vs Argentina Sports SOCCER_TOURNAMENT_MULTI_LEG 2026-07-15 N/A EC.KXWCADVANCE-26JUL15ENGARG.EVENT [EC.KXWCADVANCE-26JUL15ENGARG.EVENT, EC.KXWCGAME-26JUL15ENGARG.EVENT, ...] The game is about to begin.
next_page: 5
2
3
4
# Qot_GetEventContractMilestoneList.proto
介紹
獲取事件合約里程碑列表。
參數
// 里程碑項
message MilestoneItem {
required Qot_Common.Security milestoneSecurity = 1; // 里程碑標的
optional string title = 2; // 里程碑名稱(多語言)
optional string category = 3; // 一級分類標識
optional Qot_Common.EC_MilestoneType type = 4; // 里程碑類型
optional string startDate = 5; // 開始時間
optional string endDate = 6; // 結束時間
optional Qot_Common.Security primaryEventSecurity = 7; // 主事件標的
repeated Qot_Common.Security relatedEventList = 8; // 關聯事件標的列表
optional string notificationMessage = 9; // 通知訊息(多語言)
}
message C2S {
optional string category = 1; // 一級分類 ("SPORTS")
optional string competition = 2; // 賽事標識
optional Qot_Common.Security relatedEvent = 3; // 關聯事件標的,本地過濾
optional string nextPage = 4; // 翻頁標記(首頁不填)
optional int32 count = 5; // 單頁最大返回數(預設200)
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
- 股票結構參見 Security
- 返回
message S2C {
repeated MilestoneItem milestoneList = 1;
optional string nextPage = 2; // 為空表示沒有下一頁
}
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
- 里程碑類型枚舉參見 EC_MilestoneType
- 介面調用結果,結構參見 RetType
協議 ID
3439
數據類型
- 股票結構參見 Security
- 里程碑類型參見 ECMilestoneType
uint GetEventContractMilestoneList(GetEventContractMilestoneList.Request req);
virtual void OnReply_GetEventContractMilestoneList(MMAPI_Conn client, uint nSerialNo, GetEventContractMilestoneList.Response rsp);
介紹
獲取事件合約里程碑列表。
參數
message MilestoneItem {
required Qot_Common.Security milestoneSecurity = 1;
optional string title = 2;
optional string category = 3;
optional Qot_Common.EC_MilestoneType type = 4;
optional string startDate = 5;
optional string endDate = 6;
optional Qot_Common.Security primaryEventSecurity = 7;
repeated Qot_Common.Security relatedEventList = 8;
optional string notificationMessage = 9;
}
message C2S {
optional string category = 1;
optional string competition = 2;
optional Qot_Common.Security relatedEvent = 3;
optional string nextPage = 4;
optional int32 count = 5;
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
- 股票結構參見 Security
- 返回
message S2C {
repeated MilestoneItem milestoneList = 1;
optional string nextPage = 2;
}
message Response {
required int32 retType = 1 [default = -400];
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
- 里程碑類型枚舉參見 EC_MilestoneType
- 介面調用結果,結構參見 RetType
- 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)
{
if (errCode != 0) return;
var c2s = GetEventContractMilestoneList.C2S.CreateBuilder()
.SetCategory("Sports").SetCount(5).Build();
var req = GetEventContractMilestoneList.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetEventContractMilestoneList(req);
Console.Write("Send GetEventContractMilestoneList: {0}\n", seqNo);
}
public void OnReply_GetEventContractMilestoneList(MMAPI_Conn client, uint nSerialNo, GetEventContractMilestoneList.Response rsp)
{
Console.Write("Reply: {0} {1}\n", nSerialNo, rsp.ToString());
}
public static void Main(String[] args)
{
MMAPI.Init();
new 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
int getEventContractMilestoneList(QotGetEventContractMilestoneList.Request req);
void onReply_GetEventContractMilestoneList(MMAPI_Conn client, int nSerialNo, QotGetEventContractMilestoneList.Response rsp);
介紹
獲取事件合約里程碑列表。
參數
message C2S {
optional string category = 1;
optional string competition = 2;
optional Qot_Common.Security relatedEvent = 3;
optional string nextPage = 4;
optional int32 count = 5;
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- 股票結構參見 Security
- 返回
message S2C {
repeated MilestoneItem milestoneList = 1;
optional string nextPage = 2;
}
message Response {
required int32 retType = 1 [default = -400];
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
- 里程碑類型枚舉參見 EC_MilestoneType
- 介面調用結果,結構參見 RetType
- Example
public class Program implements MMSPI_Qot, MMSPI_Conn {
private MMAPI_Conn_Qot qot = new MMAPI_Conn_Qot();
public Program() {
qot.setClientInfo("java", 1);
qot.setConnCallback(this);
qot.setQotCallback(this);
}
public void start() {
qot.initConnect("127.0.0.1", (short) 11111, false);
}
@Override
public void onInitConnect(MMAPI_Conn client, long errCode, String desc) {
if (errCode != 0) return;
QotGetEventContractMilestoneList.C2S c2s = QotGetEventContractMilestoneList.C2S.newBuilder()
.setCategory("Sports").setCount(5).build();
QotGetEventContractMilestoneList.Request req = QotGetEventContractMilestoneList.Request.newBuilder()
.setC2S(c2s).build();
int seqNo = qot.getEventContractMilestoneList(req);
System.out.println("Send GetEventContractMilestoneList: " + seqNo);
}
@Override
public void onReply_GetEventContractMilestoneList(MMAPI_Conn client, int nSerialNo, QotGetEventContractMilestoneList.Response rsp) {
System.out.println("Reply: " + nSerialNo + " " + rsp.toString());
}
public static void main(String[] args) {
MMAPI.init();
new Program().start();
while (true) {
try { Thread.sleep(1000 * 600); } catch (InterruptedException e) {}
}
}
}
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
moomoo::u32_t GetEventContractMilestoneList(const Qot_GetEventContractMilestoneList::Request &stReq);
virtual void OnReply_GetEventContractMilestoneList(moomoo::u32_t nSerialNo, const Qot_GetEventContractMilestoneList::Response &stRsp) = 0;
介紹
獲取事件合約里程碑列表。
參數
// 里程碑項
message MilestoneItem {
required Qot_Common.Security milestoneSecurity = 1; // 里程碑標的
optional string title = 2; // 里程碑名稱(多語言)
optional string category = 3; // 一級分類標識
optional Qot_Common.EC_MilestoneType type = 4; // 里程碑類型
optional string startDate = 5; // 開始時間
optional string endDate = 6; // 結束時間
optional Qot_Common.Security primaryEventSecurity = 7; // 主事件標的
repeated Qot_Common.Security relatedEventList = 8; // 關聯事件標的列表
optional string notificationMessage = 9; // 通知訊息(多語言)
}
message C2S {
optional string category = 1; // 一級分類 ("SPORTS")
optional string competition = 2; // 賽事標識
optional Qot_Common.Security relatedEvent = 3; // 關聯事件標的,本地過濾
optional string nextPage = 4; // 翻頁標記(首頁不填)
optional int32 count = 5; // 單頁最大返回數(預設200)
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
- 股票結構參見 Security
- 返回
message S2C {
repeated MilestoneItem milestoneList = 1;
optional string nextPage = 2; // 為空表示沒有下一頁
}
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
- 里程碑類型枚舉參見 EC_MilestoneType
- 介面調用結果,結構參見 RetType
- Example
class Program : public MMSPI_Qot, public MMSPI_Trd, public MMSPI_Conn
{
public:
Program() {
m_pQotApi = MMAPI::CreateQotApi();
m_pQotApi->RegisterQotSpi(this);
m_pQotApi->RegisterConnSpi(this);
}
~Program() {
if (m_pQotApi != nullptr)
{
m_pQotApi->UnregisterQotSpi();
m_pQotApi->UnregisterConnSpi();
MMAPI::ReleaseQotApi(m_pQotApi);
m_pQotApi = nullptr;
}
}
void Start() {
m_pQotApi->InitConnect("127.0.0.1", 11111, false);
}
virtual void OnInitConnect(MMAPI_Conn* pConn, moomoo::i64_t nErrCode, const char* strDesc) {
cout << "connect" << endl;
// 組包
Qot_GetEventContractMilestoneList::Request req;
Qot_GetEventContractMilestoneList::C2S *c2s = req.mutable_c2s();
c2s->set_category("Sports");
c2s->set_count(5);
m_GetEventContractMilestoneListSerialNo = m_pQotApi->GetEventContractMilestoneList(req);
cout << "Request GetEventContractMilestoneList SerialNo: " << m_GetEventContractMilestoneListSerialNo << endl;
}
virtual void OnReply_GetEventContractMilestoneList(moomoo::u32_t nSerialNo, const Qot_GetEventContractMilestoneList::Response &stRsp) {
if (nSerialNo == m_GetEventContractMilestoneListSerialNo)
{
cout << "OnReply_GetEventContractMilestoneList SerialNo: " << nSerialNo << endl;
// 解析內部結構打印出來
// ProtoBufToBodyData和UTF8ToLocal函數的定義參見Sample中的tool.h文件
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
}
protected:
MMAPI_Qot *m_pQotApi;
moomoo::u32_t m_GetEventContractMilestoneListSerialNo;
};
int32_t main(int32_t argc, char** argv)
{
MMAPI::Init();
{
Program program;
program.Start();
getchar();
}
protobuf::ShutdownProtobufLibrary();
MMAPI::UnInit();
return 0;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
- Output
connect
Request GetEventContractMilestoneList SerialNo: 1
OnReply_GetEventContractMilestoneList SerialNo: 1
{
"retType": 0,
"retMsg": "",
"errCode": 0,
"s2c": {
"milestoneList": [
{
"milestoneSecurity": {"market": 101, "code": "EC.d8a4c769-6d6b-45b0-90c0-aaa40ffefbbe.MILESTONE"},
"title": "France vs Spain",
"category": "Sports",
"type": 3,
"startDate": "2026-07-14",
"primaryEventSecurity": {"market": 101, "code": "EC.KXWCADVANCE-26JUL14FRAESP.EVENT"},
"relatedEventList": [
{"market": 101, "code": "EC.KXWCADVANCE-26JUL14FRAESP.EVENT"},
{"market": 101, "code": "EC.KXWCGAME-26JUL14FRAESP.EVENT"},
{"market": 101, "code": "EC.KXWCSPREAD-26JUL14FRAESP.EVENT"}
],
"notificationMessage": "The game is about to begin."
},
{
"milestoneSecurity": {"market": 101, "code": "EC.9ed9d180-9fa6-4a26-9b75-36e9bfb1081a.MILESTONE"},
"title": "England vs Argentina",
"category": "Sports",
"type": 3,
"startDate": "2026-07-15",
"primaryEventSecurity": {"market": 101, "code": "EC.KXWCADVANCE-26JUL15ENGARG.EVENT"},
"relatedEventList": [
{"market": 101, "code": "EC.KXWCADVANCE-26JUL15ENGARG.EVENT"},
{"market": 101, "code": "EC.KXWCGAME-26JUL15ENGARG.EVENT"},
{"market": 101, "code": "EC.KXWCSPREAD-26JUL15ENGARG.EVENT"}
],
"notificationMessage": "The game is about to begin."
}
],
"nextPage": "5"
}
}
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
GetEventContractMilestoneList(req);
介紹
獲取事件合約的里程碑列表,可按分類、賽事、關聯事件過濾。
參數
// 里程碑項
message MilestoneItem {
required Qot_Common.Security milestoneSecurity = 1; // 里程碑標的
optional string title = 2; // 里程碑名稱(多語言)
optional string category = 3; // 一級分類標識
optional Qot_Common.EC_MilestoneType type = 4; // 里程碑類型
optional string startDate = 5; // 開始時間
optional string endDate = 6; // 結束時間
optional Qot_Common.Security primaryEventSecurity = 7; // 主事件標的
repeated Qot_Common.Security relatedEventList = 8; // 關聯事件標的列表
optional string notificationMessage = 9; // 通知訊息(多語言)
}
message C2S {
optional string category = 1; // 一級分類 ("SPORTS")
optional string competition = 2; // 賽事標識
optional Qot_Common.Security relatedEvent = 3; // 關聯事件標的,本地過濾
optional string nextPage = 4; // 翻頁標記(首頁不填)
optional int32 count = 5; // 單頁最大返回數(預設200)
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
- 股票結構參見 Security
- 返回
message S2C {
repeated MilestoneItem milestoneList = 1;
optional string nextPage = 2; // 為空表示沒有下一頁
}
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
- 里程碑類型枚舉參見 EC_MilestoneType
- 介面調用結果,結構參見 RetType
- Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_Common } from "moomoo-api/proto";
import beautify from "js-beautify";
function GetEventContractMilestoneList() {
const { RetType } = Common;
let [addr, port, enable_ssl, key] = ["127.0.0.1", 11111, false, ""];
let websocket = new mmWebsocket();
websocket.onlogin = async (ret, msg) => {
if (!ret) { console.log("start error", msg); return; }
try {
const req = { c2s: { category: "Sports", count: 5 } };
let { errCode, retMsg, retType, s2c } = await websocket.GetEventContractMilestoneList(req);
console.log("GetEventContractMilestoneList: errCode %d, retMsg %s, retType %d", errCode, retMsg, retType);
if (retType == RetType.RetType_Succeed) {
console.log(beautify(JSON.stringify(s2c), { indent_size: 2, space_in_empty_paren: true }));
}
} catch (error) {
console.log("error:", error);
}
};
websocket.start(addr, port, enable_ssl, key);
setTimeout(() => { websocket.stop(); console.log("stop"); }, 5000);
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
- Output
GetEventContractMilestoneList: errCode 0, retMsg , retType 0
{
"milestoneList": [{
"milestoneSecurity": {
"market": 101,
"code": "EC.d8a4c769-6d6b-45b0-90c0-aaa40ffefbbe.MILESTONE"
},
"title": "France vs Spain",
"category": "Sports",
"type": 3,
"startDate": "2026-07-14",
"primaryEventSecurity": {
"market": 101,
"code": "EC.KXWCADVANCE-26JUL14FRAESP.EVENT"
},
"relatedEventList": [
{ "market": 101, "code": "EC.KXWCADVANCE-26JUL14FRAESP.EVENT" },
{ "market": 101, "code": "EC.KXWCGAME-26JUL14FRAESP.EVENT" },
{ "market": 101, "code": "EC.KXWCSPREAD-26JUL14FRAESP.EVENT" }
],
"notificationMessage": "The game is about to begin."
}, {
"milestoneSecurity": {
"market": 101,
"code": "EC.9ed9d180-9fa6-4a26-9b75-36e9bfb1081a.MILESTONE"
},
"title": "England vs Argentina",
"category": "Sports",
"type": 3,
"startDate": "2026-07-15",
"primaryEventSecurity": {
"market": 101,
"code": "EC.KXWCADVANCE-26JUL15ENGARG.EVENT"
},
"relatedEventList": [
{ "market": 101, "code": "EC.KXWCADVANCE-26JUL15ENGARG.EVENT" },
{ "market": 101, "code": "EC.KXWCGAME-26JUL15ENGARG.EVENT" },
{ "market": 101, "code": "EC.KXWCSPREAD-26JUL15ENGARG.EVENT" }
],
"notificationMessage": "The game is about to begin."
}],
"nextPage": "5"
}
stop
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
介面限制
- 每 30 秒內最多請求 10 次獲取事件合約里程碑列表介面
← 獲取事件合約 獲取事件合約可Combo列表 →