# イベントコントラクトの取得
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_event_contract(event_code, next_page=None, count=None)
説明
Event コードに基づき配下のイベントコントラクト(Contract)リストを取得します。コントラクトタイプ、時間、ステータス、結果、取引属性などの完全な情報を含み、推奨コントラクトも返します。ページネーションをサポートします。
パラメータ
パラメータ 型 説明 event_code str Event コード、例: 'EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT'next_page str ページネーションマーカー、先頭ページは省略 count int 1ページあたりの最大返却数、デフォルト 100、最大 1000 戻り値
パラメータ 型 説明 ret RET_CODE API呼出結果 data dict ret == RET_OK の場合、イベントコントラクトデータを返します。contract_list と recommend_contracts を含みます str ret != RET_OK の場合、エラーの説明を返します next_page str ページネーションマーカー、空は次ページなしを示します data の dict 構造は以下の通りです:
キー 型 説明 contract_list pd.DataFrame イベントコントラクトリスト(フィールドは下記) recommend_contracts list[dict] 推奨コントラクトリスト、各項目に contract_code を含む contract_list の DataFrame フィールドは以下の通りです:
フィールド 型 説明 contract_code str コントラクトコード event_code str 所属 Event コード series_code str 所属 Series コード contract_type str コントラクトタイプ、ECContractType 参照 title str コントラクトタイトル(多言語) yes_sub_title str YES サブタイトル(多言語) open_time str コントラクト開始時間(UTC ISO8601) close_time str コントラクト終了時間(UTC ISO8601) determination_time str 結果確定時間 settled_time str 決済完了時間 latest_expiration_time str 最新満了時間 status str コントラクトステータス、ECStatus 参照 result str コントラクト結果 settlement_value str コントラクト決済価値 expiration_value str コントラクト満了結果 volume str コントラクト出来高 can_close_early bool 早期決済可否 tick_size str 呼値 category str 一級カテゴリ識別子 tag str 二級カテゴリ識別子 Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data, next_page = quote_ctx.get_event_contract(
'EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT', count=5
)
if ret == RET_OK:
print(data['contract_list'])
print('推荐合约:', data['recommend_contracts'])
print('next_page:', next_page)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
- Output
contract_code event_code series_code contract_type title yes_sub_title open_time close_time determination_time settled_time latest_expiration_time status result settlement_value expiration_value volume can_close_early tick_size category tag
0 EC.KXUFCVICROUND-26JUL11SAIPIM-SAI1 EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT EC.KXUFCVICROUND.SERIES BINARY Will Benoit Saint-Denis win the Benoit Saint-Denis vs. Paddy Pimblett 329 fight in Round 1 N/A 2026-07-08 12:29:00 2026-07-11 23:19:55 2026-07-11 23:20:54 2026-07-11 23:27:06 2026-07-25 22:00:00 FINALIZED No N/A Paddy Pimblett to win in Round 1 N/A True 0.010000000 Hot N/A
1 EC.KXUFCVICROUND-26JUL11SAIPIM-PIM2 EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT EC.KXUFCVICROUND.SERIES BINARY Will Paddy Pimblett win the Benoit Saint-Denis vs. Paddy Pimblett 329 fight in Round 2 N/A 2026-07-08 12:29:00 2026-07-11 23:19:55 2026-07-11 23:20:54 2026-07-11 23:27:06 2026-07-25 22:00:00 FINALIZED No N/A Paddy Pimblett to win in Round 1 N/A True 0.010000000 Hot N/A
2 EC.KXUFCVICROUND-26JUL11SAIPIM-PIM3 EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT EC.KXUFCVICROUND.SERIES BINARY Will Paddy Pimblett win the Benoit Saint-Denis vs. Paddy Pimblett 329 fight in Round 3 N/A 2026-07-08 12:29:00 2026-07-11 23:19:55 2026-07-11 23:20:54 2026-07-11 23:27:06 2026-07-25 22:00:00 FINALIZED No N/A Paddy Pimblett to win in Round 1 N/A True 0.010000000 Hot N/A
3 EC.KXUFCVICROUND-26JUL11SAIPIM-SAI3 EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT EC.KXUFCVICROUND.SERIES BINARY Will Benoit Saint-Denis win the Benoit Saint-Denis vs. Paddy Pimblett 329 fight in Round 3 N/A 2026-07-08 12:29:00 2026-07-11 23:19:55 2026-07-11 23:20:54 2026-07-11 23:27:06 2026-07-25 22:00:00 FINALIZED No N/A Paddy Pimblett to win in Round 1 N/A True 0.010000000 Hot N/A
4 EC.KXUFCVICROUND-26JUL11SAIPIM-PIM1 EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT EC.KXUFCVICROUND.SERIES BINARY Will Paddy Pimblett win the Benoit Saint-Denis vs. Paddy Pimblett 329 fight in Round 1 N/A 2026-07-08 12:29:00 2026-07-11 23:19:55 2026-07-11 23:20:54 2026-07-11 23:27:06 2026-07-25 22:00:00 FINALIZED Yes 1.000000000 Paddy Pimblett to win in Round 1 N/A True 0.010000000 Hot N/A
推荐合约: [{'contract_code': 'EC.KXUFCVICROUND-26JUL11SAIPIM-SAI1'}, {'contract_code': 'EC.KXUFCVICROUND-26JUL11SAIPIM-PIM2'}, {'contract_code': 'EC.KXUFCVICROUND-26JUL11SAIPIM-PIM3'}]
next_page: 5
2
3
4
5
6
7
8
# Qot_GetEventContract.proto
説明
Event コードに基づき配下のイベントコントラクトリストを取得します。
パラメータ
// コントラクト項目
message ContractItem {
// ===== 識別子 =====
required Qot_Common.Security contractSecurity = 1; // コントラクト銘柄
optional Qot_Common.Security eventSecurity = 2; // 所属 Event
optional Qot_Common.Security seriesSecurity = 3; // 所属 Series
optional Qot_Common.EC_ContractType contractType = 4; // コントラクトタイプ (Binary/Scalar)
// ===== 名称 =====
optional string title = 5; // コントラクトタイトル(多言語)
optional string yesSubTitle = 6; // YES のサブタイトル(多言語)
// ===== 時間(UTC ISO8601 文字列、例:2025-09-26T18:30:00Z)=====
optional string openTime = 7; // コントラクト開始時間
optional string closeTime = 8; // コントラクト終了時間
optional string determinationTime = 9; // 結果確定時間
optional string settledTime = 10; // 決済完了時間
optional string latestExpirationTime = 11; // 最新満了時間
// ===== ステータスと結果 =====
optional Qot_Common.EC_Status status = 12; // コントラクトステータス
optional string result = 13; // コントラクト結果
optional string settlementValue = 14; // コントラクト決済価値
optional string expirationValue = 15; // コントラクト満了結果
// ===== 取引属性 =====
optional string notionalValue = 16; // コントラクト名義価値
optional string liquidity = 17; // コントラクト流動性
optional string volume = 18; // コントラクト出来高
optional bool canCloseEarly = 19; // 早期決済可否
optional string tickSize = 20; // 呼値
// ===== カテゴリ =====
optional string category = 21; // 一級カテゴリ識別子
optional string tag = 22; // 二級カテゴリ識別子
}
// 推奨コントラクト
message RecommendContract {
required Qot_Common.Security contractSecurity = 1;
}
message C2S {
required Qot_Common.Security event = 1; // Event 銘柄
optional string nextPage = 2; // ページネーションマーカー(先頭ページは省略)
optional int32 count = 3; // 1ページ最大返却数(デフォルト100、最大1000)
}
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
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
- 株式構造は Security 参照
- イベントコントラクトタイプは EC_ContractType 参照
- 戻り値
message S2C {
repeated ContractItem contractList = 1; // コントラクトリスト
repeated RecommendContract recommendContracts = 2; // 推奨コントラクト
optional string nextPage = 3; // 空は次ページなしを示す
}
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
プロトコル ID
3438
データ型
- 株式構造は Security 参照
- イベントコントラクトタイプは EC_ContractType 参照
- イベントコントラクトステータスは EC_Status 参照
uint GetEventContract(GetEventContract.Request req);
virtual void OnReply_GetEventContract(FTAPI_Conn client, uint nSerialNo, GetEventContract.Response rsp);
説明
Event コードに基づき配下のイベントコントラクトリストを取得します。
パラメータ
message ContractItem {
required Qot_Common.Security contractSecurity = 1;
optional Qot_Common.Security eventSecurity = 2;
optional Qot_Common.Security seriesSecurity = 3;
optional Qot_Common.EC_ContractType contractType = 4;
optional string title = 5;
optional string yesSubTitle = 6;
optional string openTime = 7;
optional string closeTime = 8;
optional string determinationTime = 9;
optional string settledTime = 10;
optional string latestExpirationTime = 11;
optional Qot_Common.EC_Status status = 12;
optional string result = 13;
optional string settlementValue = 14;
optional string expirationValue = 15;
optional string notionalValue = 16;
optional string liquidity = 17;
optional string volume = 18;
optional bool canCloseEarly = 19;
optional string tickSize = 20;
optional string category = 21;
optional string tag = 22;
}
message RecommendContract {
required Qot_Common.Security contractSecurity = 1;
}
message C2S {
required Qot_Common.Security event = 1;
optional string nextPage = 2;
optional int32 count = 3;
}
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
- 株式構造は Security 参照
- 戻り値
message S2C {
repeated ContractItem contractList = 1;
repeated RecommendContract recommendContracts = 2;
optional string nextPage = 3;
}
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
12
- API呼出結果、構造は 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;
QotCommon.Security evt = QotCommon.Security.CreateBuilder()
.SetMarket((int)QotCommon.QotMarket.QotMarket_EventContract)
.SetCode("EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT").Build();
var c2s = GetEventContract.C2S.CreateBuilder()
.SetEvent(evt).SetCount(5).Build();
var req = GetEventContract.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetEventContract(req);
Console.Write("Send GetEventContract: {0}\n", seqNo);
}
public void OnReply_GetEventContract(FTAPI_Conn client, uint nSerialNo, GetEventContract.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
34
35
36
int getEventContract(QotGetEventContract.Request req);
void onReply_GetEventContract(FTAPI_Conn client, int nSerialNo, QotGetEventContract.Response rsp);
説明
Event コードに基づき配下のイベントコントラクトリストを取得します。
パラメータ
message C2S {
required Qot_Common.Security event = 1;
optional string nextPage = 2;
optional int32 count = 3;
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
- 株式構造は Security 参照
- 戻り値
message ContractItem {
required Qot_Common.Security contractSecurity = 1;
optional Qot_Common.Security eventSecurity = 2;
optional Qot_Common.Security seriesSecurity = 3;
optional Qot_Common.EC_ContractType contractType = 4;
optional string title = 5;
optional string yesSubTitle = 6;
optional string openTime = 7;
optional string closeTime = 8;
optional string determinationTime = 9;
optional string settledTime = 10;
optional string latestExpirationTime = 11;
optional Qot_Common.EC_Status status = 12;
optional string result = 13;
optional string settlementValue = 14;
optional string expirationValue = 15;
optional string notionalValue = 16;
optional string liquidity = 17;
optional string volume = 18;
optional bool canCloseEarly = 19;
optional string tickSize = 20;
optional string category = 21;
optional string tag = 22;
}
message RecommendContract {
required Qot_Common.Security contractSecurity = 1;
}
message S2C {
repeated ContractItem contractList = 1;
repeated RecommendContract recommendContracts = 2;
optional string nextPage = 3;
}
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
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
- API呼出結果、構造は 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;
QotCommon.Security evt = QotCommon.Security.newBuilder()
.setMarket(QotCommon.QotMarket.QotMarket_EventContract_VALUE)
.setCode("EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT").build();
QotGetEventContract.C2S c2s = QotGetEventContract.C2S.newBuilder()
.setEvent(evt).setCount(5).build();
QotGetEventContract.Request req = QotGetEventContract.Request.newBuilder()
.setC2S(c2s).build();
int seqNo = qot.getEventContract(req);
System.out.println("Send GetEventContract: " + seqNo);
}
@Override
public void onReply_GetEventContract(FTAPI_Conn client, int nSerialNo, QotGetEventContract.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
39
40
41
Futu::u32_t GetEventContract(const Qot_GetEventContract::Request &stReq);
virtual void OnReply_GetEventContract(Futu::u32_t nSerialNo, const Qot_GetEventContract::Response &stRsp) = 0;
説明
Event コードに基づき配下のイベントコントラクトリストを取得します。
パラメータ
// コントラクト項目
message ContractItem {
// ===== 識別子 =====
required Qot_Common.Security contractSecurity = 1; // コントラクト銘柄
optional Qot_Common.Security eventSecurity = 2; // 所属 Event
optional Qot_Common.Security seriesSecurity = 3; // 所属 Series
optional Qot_Common.EC_ContractType contractType = 4; // コントラクトタイプ (Binary/Scalar)
// ===== 名称 =====
optional string title = 5; // コントラクトタイトル(多言語)
optional string yesSubTitle = 6; // YES のサブタイトル(多言語)
// ===== 時間(UTC ISO8601 文字列、例:2025-09-26T18:30:00Z)=====
optional string openTime = 7; // コントラクト開始時間
optional string closeTime = 8; // コントラクト終了時間
optional string determinationTime = 9; // 結果確定時間
optional string settledTime = 10; // 決済完了時間
optional string latestExpirationTime = 11; // 最新満了時間
// ===== ステータスと結果 =====
optional Qot_Common.EC_Status status = 12; // コントラクトステータス
optional string result = 13; // コントラクト結果
optional string settlementValue = 14; // コントラクト決済価値
optional string expirationValue = 15; // コントラクト満了結果
// ===== 取引属性 =====
optional string notionalValue = 16; // コントラクト名義価値
optional string liquidity = 17; // コントラクト流動性
optional string volume = 18; // コントラクト出来高
optional bool canCloseEarly = 19; // 早期決済可否
optional string tickSize = 20; // 呼値
// ===== カテゴリ =====
optional string category = 21; // 一級カテゴリ識別子
optional string tag = 22; // 二級カテゴリ識別子
}
// 推奨コントラクト
message RecommendContract {
required Qot_Common.Security contractSecurity = 1;
}
message C2S {
required Qot_Common.Security event = 1; // Event 銘柄
optional string nextPage = 2; // ページネーションマーカー(先頭ページは省略)
optional int32 count = 3; // 1ページ最大返却数(デフォルト100、最大1000)
}
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
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
- 株式構造は Security 参照
- イベントコントラクトタイプは EC_ContractType 参照
- 戻り値
message S2C {
repeated ContractItem contractList = 1; // コントラクトリスト
repeated RecommendContract recommendContracts = 2; // 推奨コントラクト
optional string nextPage = 3; // 空は次ページなしを示す
}
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
- 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_GetEventContract::Request req;
Qot_GetEventContract::C2S *c2s = req.mutable_c2s();
Qot_Common::Security *evt = c2s->mutable_event();
evt->set_code("EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT");
evt->set_market(Qot_Common::QotMarket::QotMarket_EventContract);
c2s->set_count(5);
m_GetEventContractSerialNo = m_pQotApi->GetEventContract(req);
cout << "Request GetEventContract SerialNo: " << m_GetEventContractSerialNo << endl;
}
virtual void OnReply_GetEventContract(Futu::u32_t nSerialNo, const Qot_GetEventContract::Response &stRsp) {
if (nSerialNo == m_GetEventContractSerialNo)
{
cout << "OnReply_GetEventContract 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_GetEventContractSerialNo;
};
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
70
71
- Output
connect
Request GetEventContract SerialNo: 1
OnReply_GetEventContract SerialNo: 1
{
"retType": 0,
"retMsg": "",
"errCode": 0,
"s2c": {
"contractList": [
{
"contractSecurity": {"market": 101, "code": "EC.KXUFCVICROUND-26JUL11SAIPIM-SAI1"},
"eventSecurity": {"market": 101, "code": "EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT"},
"seriesSecurity": {"market": 101, "code": "EC.KXUFCVICROUND.SERIES"},
"contractType": 1,
"title": "Will Benoit Saint-Denis win the Benoit Saint-Denis vs. Paddy Pimblett 329 fight in Round 1",
"yesSubTitle": "N/A",
"openTime": "2026-07-08T12:29:00Z",
"closeTime": "2026-07-11T23:19:55Z",
"determinationTime": "2026-07-11T23:20:54Z",
"settledTime": "2026-07-11T23:27:06Z",
"latestExpirationTime": "2026-07-25T22:00:00Z",
"status": 9,
"result": "No",
"settlementValue": "N/A",
"expirationValue": "Paddy Pimblett to win in Round 1",
"notionalValue": "N/A",
"liquidity": "N/A",
"volume": "N/A",
"canCloseEarly": true,
"tickSize": "0.010000000",
"category": "Hot",
"tag": "N/A"
}
],
"recommendContracts": [
{"contractSecurity": {"market": 101, "code": "EC.KXUFCVICROUND-26JUL11SAIPIM-SAI1"}},
{"contractSecurity": {"market": 101, "code": "EC.KXUFCVICROUND-26JUL11SAIPIM-PIM2"}},
{"contractSecurity": {"market": 101, "code": "EC.KXUFCVICROUND-26JUL11SAIPIM-PIM3"}}
],
"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
42
GetEventContract(req);
説明
Event コードに基づき配下のイベントコントラクトリストを取得します。ページネーションをサポートします。
パラメータ
// コントラクト項目
message ContractItem {
// ===== 識別子 =====
required Qot_Common.Security contractSecurity = 1; // コントラクト銘柄
optional Qot_Common.Security eventSecurity = 2; // 所属 Event
optional Qot_Common.Security seriesSecurity = 3; // 所属 Series
optional Qot_Common.EC_ContractType contractType = 4; // コントラクトタイプ (Binary/Scalar)
// ===== 名称 =====
optional string title = 5; // コントラクトタイトル(多言語)
optional string yesSubTitle = 6; // YES のサブタイトル(多言語)
// ===== 時間(UTC ISO8601 文字列、例:2025-09-26T18:30:00Z)=====
optional string openTime = 7; // コントラクト開始時間
optional string closeTime = 8; // コントラクト終了時間
optional string determinationTime = 9; // 結果確定時間
optional string settledTime = 10; // 決済完了時間
optional string latestExpirationTime = 11; // 最新満了時間
// ===== ステータスと結果 =====
optional Qot_Common.EC_Status status = 12; // コントラクトステータス
optional string result = 13; // コントラクト結果
optional string settlementValue = 14; // コントラクト決済価値
optional string expirationValue = 15; // コントラクト満了結果
// ===== 取引属性 =====
optional string notionalValue = 16; // コントラクト名義価値
optional string liquidity = 17; // コントラクト流動性
optional string volume = 18; // コントラクト出来高
optional bool canCloseEarly = 19; // 早期決済可否
optional string tickSize = 20; // 呼値
// ===== カテゴリ =====
optional string category = 21; // 一級カテゴリ識別子
optional string tag = 22; // 二級カテゴリ識別子
}
// 推奨コントラクト
message RecommendContract {
required Qot_Common.Security contractSecurity = 1;
}
message C2S {
required Qot_Common.Security event = 1; // Event 銘柄
optional string nextPage = 2; // ページネーションマーカー(先頭ページは省略)
optional int32 count = 3; // 1ページ最大返却数(デフォルト100、最大1000)
}
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
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
- 戻り値
message S2C {
repeated ContractItem contractList = 1; // コントラクトリスト
repeated RecommendContract recommendContracts = 2; // 推奨コントラクト
optional string nextPage = 3; // 空は次ページなしを示す
}
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
- API呼出結果、構造は RetType 参照
- Example
import ftWebsocket from "futu-api";
import { Common, Qot_Common } from "futu-api/proto";
import beautify from "js-beautify";
function GetEventContract() {
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: { event: { market: QotMarket.QotMarket_EventContract, code: "EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT" }, count: 5 } };
let { errCode, retMsg, retType, s2c } = await websocket.GetEventContract(req);
console.log("GetEventContract: 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
GetEventContract: errCode 0, retMsg , retType 0
{
"contractList": [{
"contractSecurity": {
"market": 101,
"code": "EC.KXUFCVICROUND-26JUL11SAIPIM-SAI1"
},
"eventSecurity": {
"market": 101,
"code": "EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT"
},
"seriesSecurity": {
"market": 101,
"code": "EC.KXUFCVICROUND.SERIES"
},
"contractType": 1,
"title": "Will Benoit Saint-Denis win the Benoit Saint-Denis vs. Paddy Pimblett 329 fight in Round 1",
"status": 9,
"result": "No",
"volume": "N/A",
"canCloseEarly": true,
"tickSize": "0.010000000",
"category": "Hot",
"tag": "N/A"
}],
"recommendContracts": [{
"contractSecurity": {
"market": 101,
"code": "EC.KXUFCVICROUND-26JUL11SAIPIM-SAI1"
}
}, {
"contractSecurity": {
"market": 101,
"code": "EC.KXUFCVICROUND-26JUL11SAIPIM-PIM2"
}
}, {
"contractSecurity": {
"market": 101,
"code": "EC.KXUFCVICROUND-26JUL11SAIPIM-PIM3"
}
}],
"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
APIレート制限
- 30 秒以内に最大 10 回イベントコントラクト取得API
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_event_contract(event_code, next_page=None, count=None)
説明
Event コードに基づき配下のイベントコントラクト(Contract)リストを取得します。コントラクトタイプ、時間、ステータス、結果、取引属性などの完全な情報を含み、推奨コントラクトも返します。ページネーションをサポートします。
パラメータ
パラメータ 型 説明 event_code str Event コード、例: 'EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT'next_page str ページネーションマーカー、先頭ページは省略 count int 1ページあたりの最大返却数、デフォルト 100、最大 1000 戻り値
パラメータ 型 説明 ret RET_CODE API呼出結果 data dict ret == RET_OK の場合、イベントコントラクトデータを返します。contract_list と recommend_contracts を含みます str ret != RET_OK の場合、エラーの説明を返します next_page str ページネーションマーカー、空は次ページなしを示します data の dict 構造は以下の通りです:
キー 型 説明 contract_list pd.DataFrame イベントコントラクトリスト(フィールドは下記) recommend_contracts list[dict] 推奨コントラクトリスト、各項目に contract_code を含む contract_list の DataFrame フィールドは以下の通りです:
フィールド 型 説明 contract_code str コントラクトコード event_code str 所属 Event コード series_code str 所属 Series コード contract_type str コントラクトタイプ、ECContractType 参照 title str コントラクトタイトル(多言語) yes_sub_title str YES サブタイトル(多言語) open_time str コントラクト開始時間(UTC ISO8601) close_time str コントラクト終了時間(UTC ISO8601) determination_time str 結果確定時間 settled_time str 決済完了時間 latest_expiration_time str 最新満了時間 status str コントラクトステータス、ECStatus 参照 result str コントラクト結果 settlement_value str コントラクト決済価値 expiration_value str コントラクト満了結果 volume str コントラクト出来高 can_close_early bool 早期決済可否 tick_size str 呼値 category str 一級カテゴリ識別子 tag str 二級カテゴリ識別子 Example
from moomoo import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data, next_page = quote_ctx.get_event_contract(
'EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT', count=5
)
if ret == RET_OK:
print(data['contract_list'])
print('推荐合约:', data['recommend_contracts'])
print('next_page:', next_page)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
- Output
contract_code event_code series_code contract_type title yes_sub_title open_time close_time determination_time settled_time latest_expiration_time status result settlement_value expiration_value volume can_close_early tick_size category tag
0 EC.KXUFCVICROUND-26JUL11SAIPIM-SAI1 EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT EC.KXUFCVICROUND.SERIES BINARY Will Benoit Saint-Denis win the Benoit Saint-Denis vs. Paddy Pimblett 329 fight in Round 1 N/A 2026-07-08 12:29:00 2026-07-11 23:19:55 2026-07-11 23:20:54 2026-07-11 23:27:06 2026-07-25 22:00:00 FINALIZED No N/A Paddy Pimblett to win in Round 1 N/A True 0.010000000 Hot N/A
1 EC.KXUFCVICROUND-26JUL11SAIPIM-PIM2 EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT EC.KXUFCVICROUND.SERIES BINARY Will Paddy Pimblett win the Benoit Saint-Denis vs. Paddy Pimblett 329 fight in Round 2 N/A 2026-07-08 12:29:00 2026-07-11 23:19:55 2026-07-11 23:20:54 2026-07-11 23:27:06 2026-07-25 22:00:00 FINALIZED No N/A Paddy Pimblett to win in Round 1 N/A True 0.010000000 Hot N/A
2 EC.KXUFCVICROUND-26JUL11SAIPIM-PIM3 EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT EC.KXUFCVICROUND.SERIES BINARY Will Paddy Pimblett win the Benoit Saint-Denis vs. Paddy Pimblett 329 fight in Round 3 N/A 2026-07-08 12:29:00 2026-07-11 23:19:55 2026-07-11 23:20:54 2026-07-11 23:27:06 2026-07-25 22:00:00 FINALIZED No N/A Paddy Pimblett to win in Round 1 N/A True 0.010000000 Hot N/A
3 EC.KXUFCVICROUND-26JUL11SAIPIM-SAI3 EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT EC.KXUFCVICROUND.SERIES BINARY Will Benoit Saint-Denis win the Benoit Saint-Denis vs. Paddy Pimblett 329 fight in Round 3 N/A 2026-07-08 12:29:00 2026-07-11 23:19:55 2026-07-11 23:20:54 2026-07-11 23:27:06 2026-07-25 22:00:00 FINALIZED No N/A Paddy Pimblett to win in Round 1 N/A True 0.010000000 Hot N/A
4 EC.KXUFCVICROUND-26JUL11SAIPIM-PIM1 EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT EC.KXUFCVICROUND.SERIES BINARY Will Paddy Pimblett win the Benoit Saint-Denis vs. Paddy Pimblett 329 fight in Round 1 N/A 2026-07-08 12:29:00 2026-07-11 23:19:55 2026-07-11 23:20:54 2026-07-11 23:27:06 2026-07-25 22:00:00 FINALIZED Yes 1.000000000 Paddy Pimblett to win in Round 1 N/A True 0.010000000 Hot N/A
推荐合约: [{'contract_code': 'EC.KXUFCVICROUND-26JUL11SAIPIM-SAI1'}, {'contract_code': 'EC.KXUFCVICROUND-26JUL11SAIPIM-PIM2'}, {'contract_code': 'EC.KXUFCVICROUND-26JUL11SAIPIM-PIM3'}]
next_page: 5
2
3
4
5
6
7
8
# Qot_GetEventContract.proto
説明
Event コードに基づき配下のイベントコントラクトリストを取得します。
パラメータ
// コントラクト項目
message ContractItem {
// ===== 識別子 =====
required Qot_Common.Security contractSecurity = 1; // コントラクト銘柄
optional Qot_Common.Security eventSecurity = 2; // 所属 Event
optional Qot_Common.Security seriesSecurity = 3; // 所属 Series
optional Qot_Common.EC_ContractType contractType = 4; // コントラクトタイプ (Binary/Scalar)
// ===== 名称 =====
optional string title = 5; // コントラクトタイトル(多言語)
optional string yesSubTitle = 6; // YES のサブタイトル(多言語)
// ===== 時間(UTC ISO8601 文字列、例:2025-09-26T18:30:00Z)=====
optional string openTime = 7; // コントラクト開始時間
optional string closeTime = 8; // コントラクト終了時間
optional string determinationTime = 9; // 結果確定時間
optional string settledTime = 10; // 決済完了時間
optional string latestExpirationTime = 11; // 最新満了時間
// ===== ステータスと結果 =====
optional Qot_Common.EC_Status status = 12; // コントラクトステータス
optional string result = 13; // コントラクト結果
optional string settlementValue = 14; // コントラクト決済価値
optional string expirationValue = 15; // コントラクト満了結果
// ===== 取引属性 =====
optional string notionalValue = 16; // コントラクト名義価値
optional string liquidity = 17; // コントラクト流動性
optional string volume = 18; // コントラクト出来高
optional bool canCloseEarly = 19; // 早期決済可否
optional string tickSize = 20; // 呼値
// ===== カテゴリ =====
optional string category = 21; // 一級カテゴリ識別子
optional string tag = 22; // 二級カテゴリ識別子
}
// 推奨コントラクト
message RecommendContract {
required Qot_Common.Security contractSecurity = 1;
}
message C2S {
required Qot_Common.Security event = 1; // Event 銘柄
optional string nextPage = 2; // ページネーションマーカー(先頭ページは省略)
optional int32 count = 3; // 1ページ最大返却数(デフォルト100、最大1000)
}
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
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
- 株式構造は Security 参照
- イベントコントラクトタイプは EC_ContractType 参照
- 戻り値
message S2C {
repeated ContractItem contractList = 1; // コントラクトリスト
repeated RecommendContract recommendContracts = 2; // 推奨コントラクト
optional string nextPage = 3; // 空は次ページなしを示す
}
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
プロトコル ID
3438
データ型
- 株式構造は Security 参照
- イベントコントラクトタイプは EC_ContractType 参照
- イベントコントラクトステータスは EC_Status 参照
uint GetEventContract(GetEventContract.Request req);
virtual void OnReply_GetEventContract(MMAPI_Conn client, uint nSerialNo, GetEventContract.Response rsp);
説明
Event コードに基づき配下のイベントコントラクトリストを取得します。
パラメータ
message ContractItem {
required Qot_Common.Security contractSecurity = 1;
optional Qot_Common.Security eventSecurity = 2;
optional Qot_Common.Security seriesSecurity = 3;
optional Qot_Common.EC_ContractType contractType = 4;
optional string title = 5;
optional string yesSubTitle = 6;
optional string openTime = 7;
optional string closeTime = 8;
optional string determinationTime = 9;
optional string settledTime = 10;
optional string latestExpirationTime = 11;
optional Qot_Common.EC_Status status = 12;
optional string result = 13;
optional string settlementValue = 14;
optional string expirationValue = 15;
optional string notionalValue = 16;
optional string liquidity = 17;
optional string volume = 18;
optional bool canCloseEarly = 19;
optional string tickSize = 20;
optional string category = 21;
optional string tag = 22;
}
message RecommendContract {
required Qot_Common.Security contractSecurity = 1;
}
message C2S {
required Qot_Common.Security event = 1;
optional string nextPage = 2;
optional int32 count = 3;
}
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
- 株式構造は Security 参照
- 戻り値
message S2C {
repeated ContractItem contractList = 1;
repeated RecommendContract recommendContracts = 2;
optional string nextPage = 3;
}
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
12
- API呼出結果、構造は 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;
QotCommon.Security evt = QotCommon.Security.CreateBuilder()
.SetMarket((int)QotCommon.QotMarket.QotMarket_EventContract)
.SetCode("EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT").Build();
var c2s = GetEventContract.C2S.CreateBuilder()
.SetEvent(evt).SetCount(5).Build();
var req = GetEventContract.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetEventContract(req);
Console.Write("Send GetEventContract: {0}\n", seqNo);
}
public void OnReply_GetEventContract(MMAPI_Conn client, uint nSerialNo, GetEventContract.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
34
35
36
int getEventContract(QotGetEventContract.Request req);
void onReply_GetEventContract(MMAPI_Conn client, int nSerialNo, QotGetEventContract.Response rsp);
説明
Event コードに基づき配下のイベントコントラクトリストを取得します。
パラメータ
message C2S {
required Qot_Common.Security event = 1;
optional string nextPage = 2;
optional int32 count = 3;
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
- 株式構造は Security 参照
- 戻り値
message ContractItem {
required Qot_Common.Security contractSecurity = 1;
optional Qot_Common.Security eventSecurity = 2;
optional Qot_Common.Security seriesSecurity = 3;
optional Qot_Common.EC_ContractType contractType = 4;
optional string title = 5;
optional string yesSubTitle = 6;
optional string openTime = 7;
optional string closeTime = 8;
optional string determinationTime = 9;
optional string settledTime = 10;
optional string latestExpirationTime = 11;
optional Qot_Common.EC_Status status = 12;
optional string result = 13;
optional string settlementValue = 14;
optional string expirationValue = 15;
optional string notionalValue = 16;
optional string liquidity = 17;
optional string volume = 18;
optional bool canCloseEarly = 19;
optional string tickSize = 20;
optional string category = 21;
optional string tag = 22;
}
message RecommendContract {
required Qot_Common.Security contractSecurity = 1;
}
message S2C {
repeated ContractItem contractList = 1;
repeated RecommendContract recommendContracts = 2;
optional string nextPage = 3;
}
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
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
- API呼出結果、構造は 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;
QotCommon.Security evt = QotCommon.Security.newBuilder()
.setMarket(QotCommon.QotMarket.QotMarket_EventContract_VALUE)
.setCode("EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT").build();
QotGetEventContract.C2S c2s = QotGetEventContract.C2S.newBuilder()
.setEvent(evt).setCount(5).build();
QotGetEventContract.Request req = QotGetEventContract.Request.newBuilder()
.setC2S(c2s).build();
int seqNo = qot.getEventContract(req);
System.out.println("Send GetEventContract: " + seqNo);
}
@Override
public void onReply_GetEventContract(MMAPI_Conn client, int nSerialNo, QotGetEventContract.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
39
40
41
moomoo::u32_t GetEventContract(const Qot_GetEventContract::Request &stReq);
virtual void OnReply_GetEventContract(moomoo::u32_t nSerialNo, const Qot_GetEventContract::Response &stRsp) = 0;
説明
Event コードに基づき配下のイベントコントラクトリストを取得します。
パラメータ
// コントラクト項目
message ContractItem {
// ===== 識別子 =====
required Qot_Common.Security contractSecurity = 1; // コントラクト銘柄
optional Qot_Common.Security eventSecurity = 2; // 所属 Event
optional Qot_Common.Security seriesSecurity = 3; // 所属 Series
optional Qot_Common.EC_ContractType contractType = 4; // コントラクトタイプ (Binary/Scalar)
// ===== 名称 =====
optional string title = 5; // コントラクトタイトル(多言語)
optional string yesSubTitle = 6; // YES のサブタイトル(多言語)
// ===== 時間(UTC ISO8601 文字列、例:2025-09-26T18:30:00Z)=====
optional string openTime = 7; // コントラクト開始時間
optional string closeTime = 8; // コントラクト終了時間
optional string determinationTime = 9; // 結果確定時間
optional string settledTime = 10; // 決済完了時間
optional string latestExpirationTime = 11; // 最新満了時間
// ===== ステータスと結果 =====
optional Qot_Common.EC_Status status = 12; // コントラクトステータス
optional string result = 13; // コントラクト結果
optional string settlementValue = 14; // コントラクト決済価値
optional string expirationValue = 15; // コントラクト満了結果
// ===== 取引属性 =====
optional string notionalValue = 16; // コントラクト名義価値
optional string liquidity = 17; // コントラクト流動性
optional string volume = 18; // コントラクト出来高
optional bool canCloseEarly = 19; // 早期決済可否
optional string tickSize = 20; // 呼値
// ===== カテゴリ =====
optional string category = 21; // 一級カテゴリ識別子
optional string tag = 22; // 二級カテゴリ識別子
}
// 推奨コントラクト
message RecommendContract {
required Qot_Common.Security contractSecurity = 1;
}
message C2S {
required Qot_Common.Security event = 1; // Event 銘柄
optional string nextPage = 2; // ページネーションマーカー(先頭ページは省略)
optional int32 count = 3; // 1ページ最大返却数(デフォルト100、最大1000)
}
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
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
- 株式構造は Security 参照
- イベントコントラクトタイプは EC_ContractType 参照
- 戻り値
message S2C {
repeated ContractItem contractList = 1; // コントラクトリスト
repeated RecommendContract recommendContracts = 2; // 推奨コントラクト
optional string nextPage = 3; // 空は次ページなしを示す
}
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
- 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_GetEventContract::Request req;
Qot_GetEventContract::C2S *c2s = req.mutable_c2s();
Qot_Common::Security *evt = c2s->mutable_event();
evt->set_code("EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT");
evt->set_market(Qot_Common::QotMarket::QotMarket_EventContract);
c2s->set_count(5);
m_GetEventContractSerialNo = m_pQotApi->GetEventContract(req);
cout << "Request GetEventContract SerialNo: " << m_GetEventContractSerialNo << endl;
}
virtual void OnReply_GetEventContract(moomoo::u32_t nSerialNo, const Qot_GetEventContract::Response &stRsp) {
if (nSerialNo == m_GetEventContractSerialNo)
{
cout << "OnReply_GetEventContract 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_GetEventContractSerialNo;
};
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
70
71
- Output
connect
Request GetEventContract SerialNo: 1
OnReply_GetEventContract SerialNo: 1
{
"retType": 0,
"retMsg": "",
"errCode": 0,
"s2c": {
"contractList": [
{
"contractSecurity": {"market": 101, "code": "EC.KXUFCVICROUND-26JUL11SAIPIM-SAI1"},
"eventSecurity": {"market": 101, "code": "EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT"},
"seriesSecurity": {"market": 101, "code": "EC.KXUFCVICROUND.SERIES"},
"contractType": 1,
"title": "Will Benoit Saint-Denis win the Benoit Saint-Denis vs. Paddy Pimblett 329 fight in Round 1",
"yesSubTitle": "N/A",
"openTime": "2026-07-08T12:29:00Z",
"closeTime": "2026-07-11T23:19:55Z",
"determinationTime": "2026-07-11T23:20:54Z",
"settledTime": "2026-07-11T23:27:06Z",
"latestExpirationTime": "2026-07-25T22:00:00Z",
"status": 9,
"result": "No",
"settlementValue": "N/A",
"expirationValue": "Paddy Pimblett to win in Round 1",
"notionalValue": "N/A",
"liquidity": "N/A",
"volume": "N/A",
"canCloseEarly": true,
"tickSize": "0.010000000",
"category": "Hot",
"tag": "N/A"
}
],
"recommendContracts": [
{"contractSecurity": {"market": 101, "code": "EC.KXUFCVICROUND-26JUL11SAIPIM-SAI1"}},
{"contractSecurity": {"market": 101, "code": "EC.KXUFCVICROUND-26JUL11SAIPIM-PIM2"}},
{"contractSecurity": {"market": 101, "code": "EC.KXUFCVICROUND-26JUL11SAIPIM-PIM3"}}
],
"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
42
GetEventContract(req);
説明
Event コードに基づき配下のイベントコントラクトリストを取得します。ページネーションをサポートします。
パラメータ
// コントラクト項目
message ContractItem {
// ===== 識別子 =====
required Qot_Common.Security contractSecurity = 1; // コントラクト銘柄
optional Qot_Common.Security eventSecurity = 2; // 所属 Event
optional Qot_Common.Security seriesSecurity = 3; // 所属 Series
optional Qot_Common.EC_ContractType contractType = 4; // コントラクトタイプ (Binary/Scalar)
// ===== 名称 =====
optional string title = 5; // コントラクトタイトル(多言語)
optional string yesSubTitle = 6; // YES のサブタイトル(多言語)
// ===== 時間(UTC ISO8601 文字列、例:2025-09-26T18:30:00Z)=====
optional string openTime = 7; // コントラクト開始時間
optional string closeTime = 8; // コントラクト終了時間
optional string determinationTime = 9; // 結果確定時間
optional string settledTime = 10; // 決済完了時間
optional string latestExpirationTime = 11; // 最新満了時間
// ===== ステータスと結果 =====
optional Qot_Common.EC_Status status = 12; // コントラクトステータス
optional string result = 13; // コントラクト結果
optional string settlementValue = 14; // コントラクト決済価値
optional string expirationValue = 15; // コントラクト満了結果
// ===== 取引属性 =====
optional string notionalValue = 16; // コントラクト名義価値
optional string liquidity = 17; // コントラクト流動性
optional string volume = 18; // コントラクト出来高
optional bool canCloseEarly = 19; // 早期決済可否
optional string tickSize = 20; // 呼値
// ===== カテゴリ =====
optional string category = 21; // 一級カテゴリ識別子
optional string tag = 22; // 二級カテゴリ識別子
}
// 推奨コントラクト
message RecommendContract {
required Qot_Common.Security contractSecurity = 1;
}
message C2S {
required Qot_Common.Security event = 1; // Event 銘柄
optional string nextPage = 2; // ページネーションマーカー(先頭ページは省略)
optional int32 count = 3; // 1ページ最大返却数(デフォルト100、最大1000)
}
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
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
- 戻り値
message S2C {
repeated ContractItem contractList = 1; // コントラクトリスト
repeated RecommendContract recommendContracts = 2; // 推奨コントラクト
optional string nextPage = 3; // 空は次ページなしを示す
}
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
- API呼出結果、構造は RetType 参照
- Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_Common } from "moomoo-api/proto";
import beautify from "js-beautify";
function GetEventContract() {
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: { event: { market: QotMarket.QotMarket_EventContract, code: "EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT" }, count: 5 } };
let { errCode, retMsg, retType, s2c } = await websocket.GetEventContract(req);
console.log("GetEventContract: 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
GetEventContract: errCode 0, retMsg , retType 0
{
"contractList": [{
"contractSecurity": {
"market": 101,
"code": "EC.KXUFCVICROUND-26JUL11SAIPIM-SAI1"
},
"eventSecurity": {
"market": 101,
"code": "EC.KXUFCVICROUND-26JUL11SAIPIM.EVENT"
},
"seriesSecurity": {
"market": 101,
"code": "EC.KXUFCVICROUND.SERIES"
},
"contractType": 1,
"title": "Will Benoit Saint-Denis win the Benoit Saint-Denis vs. Paddy Pimblett 329 fight in Round 1",
"status": 9,
"result": "No",
"volume": "N/A",
"canCloseEarly": true,
"tickSize": "0.010000000",
"category": "Hot",
"tag": "N/A"
}],
"recommendContracts": [{
"contractSecurity": {
"market": 101,
"code": "EC.KXUFCVICROUND-26JUL11SAIPIM-SAI1"
}
}, {
"contractSecurity": {
"market": 101,
"code": "EC.KXUFCVICROUND-26JUL11SAIPIM-PIM2"
}
}, {
"contractSecurity": {
"market": 101,
"code": "EC.KXUFCVICROUND-26JUL11SAIPIM-PIM3"
}
}],
"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
APIレート制限
- 30 秒以内に最大 10 回イベントコントラクト取得API