# イベントコントラクト Series リスト取得
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_event_contract_series_list(category=None, tag=None)
説明
イベントコントラクトの Series リストを取得します。Series は関連する Event の集合体(例:ある銘柄の GDP データ公表など)であり、一次カテゴリと二次タグによるフィルタリングに対応しています。
パラメータ
パラメータ 型 説明 category str 一次カテゴリ識別子、任意、例: 'Sports'tag str 二次カテゴリ識別子、任意、例: 'Baseball'戻り値
パラメータ 型 説明 ret RET_CODE API呼出結果 data pd.DataFrame ret == RET_OK の場合、Series リストを返します str ret != RET_OK の場合、エラーの説明を返します 返される DataFrame のフィールドは以下の通りです:
フィールド 型 説明 series_code str Series コントラクトコード series_name str Series 名称(多言語) category str 一次カテゴリ識別子 tags list 二次カテゴリ識別子リスト(1 つの series は複数の tag に属することができます) frequency str 頻度、ECFrequency を参照 Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_event_contract_series_list(category='Sports')
if ret == RET_OK:
print(data)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
- Output
series_code series_name category tags frequency
0 EC.KXUFCVICROUND.SERIES UFC Round of Victory Sports [] CUSTOM
1 EC.KXNBASERIESSPREAD.SERIES NBA Series Game Spread Sports [] CUSTOM
2 EC.KXWCUSAOPPONENT.SERIES World Cup USA Opponent Sports [] CUSTOM
3 EC.KXNFLSBMVP.SERIES Pro Football Championship MVP Sports [Football] ANNUAL
4 EC.KXUCLTCORNERS.SERIES Champions League Team Corners Sports [] CUSTOM
2
3
4
5
6
Sports カテゴリでは合計 433 個の Series が返されます。上記は最初の 5 行の例です。
# Qot_GetEventContractSeriesList.proto
説明
イベントコントラクトの Series リストを取得します。
パラメータ
// Series 項目
message SeriesItem {
required Qot_Common.Security seriesSecurity = 1; // {market=101, code="EC.KXRATECUTCOUNT"}
optional string seriesName = 2; // Series 名称(多言語)
optional string category = 3; // 一次カテゴリ識別子
repeated string tags = 4; // 二次カテゴリ識別子リスト(1 つの series は複数の tag に属することができます)
optional Qot_Common.EC_Frequency frequency = 5; // 頻度
}
message C2S {
optional string category = 1; // 一次カテゴリ識別子 ("SPORTS")
optional string tag = 2; // 二次カテゴリ識別子 ("BASEBALL")
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
- 銘柄構造については Security を参照
- 戻り値
message S2C {
repeated SeriesItem seriesList = 1;
}
message Response {
required int32 retType = 1 [default = -400]; //RetType,結果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
- 頻度列挙については ECFrequency を参照
- API呼出結果の構造については RetType を参照
プロトコル ID
3436
データ型
- 銘柄構造については Security を参照
- 頻度列挙については ECFrequency を参照
uint GetEventContractSeriesList(GetEventContractSeriesList.Request req);
virtual void OnReply_GetEventContractSeriesList(FTAPI_Conn client, uint nSerialNo, GetEventContractSeriesList.Response rsp);
説明
イベントコントラクトの Series リストを取得します。
パラメータ
message SeriesItem {
required Qot_Common.Security seriesSecurity = 1;
optional string seriesName = 2;
optional string category = 3;
repeated string tags = 4;
optional Qot_Common.EC_Frequency frequency = 5;
}
message C2S {
optional string category = 1;
optional string tag = 2;
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
- 銘柄構造については Security を参照
- 戻り値
message S2C {
repeated SeriesItem seriesList = 1;
}
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
- 頻度列挙については ECFrequency を参照
- 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;
var c2s = GetEventContractSeriesList.C2S.CreateBuilder()
.SetCategory("Sports").Build();
var req = GetEventContractSeriesList.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetEventContractSeriesList(req);
Console.Write("Send GetEventContractSeriesList: {0}\n", seqNo);
}
public void OnReply_GetEventContractSeriesList(FTAPI_Conn client, uint nSerialNo, GetEventContractSeriesList.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 getEventContractSeriesList(QotGetEventContractSeriesList.Request req);
void onReply_GetEventContractSeriesList(FTAPI_Conn client, int nSerialNo, QotGetEventContractSeriesList.Response rsp);
説明
イベントコントラクトの Series リストを取得します。
パラメータ
message C2S {
optional string category = 1;
optional string tag = 2;
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
- 銘柄構造については Security を参照
- 戻り値
message S2C {
repeated SeriesItem seriesList = 1;
}
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
- 頻度列挙については ECFrequency を参照
- 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;
QotGetEventContractSeriesList.C2S c2s = QotGetEventContractSeriesList.C2S.newBuilder()
.setCategory("Sports").build();
QotGetEventContractSeriesList.Request req = QotGetEventContractSeriesList.Request.newBuilder()
.setC2S(c2s).build();
int seqNo = qot.getEventContractSeriesList(req);
System.out.println("Send GetEventContractSeriesList: " + seqNo);
}
@Override
public void onReply_GetEventContractSeriesList(FTAPI_Conn client, int nSerialNo, QotGetEventContractSeriesList.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 GetEventContractSeriesList(const Qot_GetEventContractSeriesList::Request &stReq);
virtual void OnReply_GetEventContractSeriesList(Futu::u32_t nSerialNo, const Qot_GetEventContractSeriesList::Response &stRsp) = 0;
説明
イベントコントラクトの Series リストを取得します。
パラメータ
// Series 項目
message SeriesItem {
required Qot_Common.Security seriesSecurity = 1; // {market=101, code="EC.KXRATECUTCOUNT"}
optional string seriesName = 2; // Series 名称(多言語)
optional string category = 3; // 一次カテゴリ識別子
repeated string tags = 4; // 二次カテゴリ識別子リスト(1 つの series は複数の tag に属することができます)
optional Qot_Common.EC_Frequency frequency = 5; // 頻度
}
message C2S {
optional string category = 1; // 一次カテゴリ識別子 ("SPORTS")
optional string tag = 2; // 二次カテゴリ識別子 ("BASEBALL")
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
- 銘柄構造については Security を参照
- 戻り値
message S2C {
repeated SeriesItem seriesList = 1;
}
message Response {
required int32 retType = 1 [default = -400]; //RetType,結果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
- 頻度列挙については ECFrequency を参照
- API呼出結果の構造については 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_GetEventContractSeriesList::Request req;
Qot_GetEventContractSeriesList::C2S *c2s = req.mutable_c2s();
c2s->set_category("Sports");
m_GetEventContractSeriesListSerialNo = m_pQotApi->GetEventContractSeriesList(req);
cout << "Request GetEventContractSeriesList SerialNo: " << m_GetEventContractSeriesListSerialNo << endl;
}
virtual void OnReply_GetEventContractSeriesList(Futu::u32_t nSerialNo, const Qot_GetEventContractSeriesList::Response &stRsp) {
if (nSerialNo == m_GetEventContractSeriesListSerialNo)
{
cout << "OnReply_GetEventContractSeriesList 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_GetEventContractSeriesListSerialNo;
};
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
- Output
connect
Request GetEventContractSeriesList SerialNo: 1
OnReply_GetEventContractSeriesList SerialNo: 1
{
"retType": 0,
"retMsg": "",
"errCode": 0,
"s2c": {
"seriesList": [
{
"seriesSecurity": {"market": 101, "code": "EC.KXUFCVICROUND.SERIES"},
"seriesName": "UFC Round of Victory",
"category": "Sports",
"tags": [],
"frequency": 6
},
{
"seriesSecurity": {"market": 101, "code": "EC.KXNBASERIESSPREAD.SERIES"},
"seriesName": "NBA Series Game Spread",
"category": "Sports",
"tags": [],
"frequency": 6
}
]
}
}
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
GetEventContractSeriesList(req);
説明
イベントコントラクトの Series リストを取得します。一次カテゴリまたは二次タグでフィルタリング可能です。
パラメータ
// Series 項目
message SeriesItem {
required Qot_Common.Security seriesSecurity = 1; // Series 銘柄 {market=101, code="EC.KXRATECUTCOUNT"}
optional string seriesName = 2; // Series 名称(多言語)
optional string category = 3; // 一次カテゴリ識別子
repeated string tags = 4; // 二次カテゴリ識別子リスト
optional Qot_Common.EC_Frequency frequency = 5; // 頻度
}
message C2S {
optional string category = 1; // 一次カテゴリ識別子 ("SPORTS")
optional string tag = 2; // 二次カテゴリ識別子 ("BASEBALL")
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
- 戻り値
message S2C {
repeated SeriesItem seriesList = 1; // Series リスト
}
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
- 頻度列挙については ECFrequency を参照
- API呼出結果の構造については RetType を参照
- Example
import ftWebsocket from "futu-api";
import { Common, Qot_Common } from "futu-api/proto";
import beautify from "js-beautify";
function GetEventContractSeriesList() {
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", tag: "Baseball" } };
let { errCode, retMsg, retType, s2c } = await websocket.GetEventContractSeriesList(req);
console.log("GetEventContractSeriesList: 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
GetEventContractSeriesList: errCode 0, retMsg , retType 0
{
"seriesList": [{
"seriesSecurity": {
"market": 101,
"code": "EC.KXUFCVICROUND.SERIES"
},
"seriesName": "UFC Round of Victory",
"category": "Sports",
"tags": [],
"frequency": 6
}, {
"seriesSecurity": {
"market": 101,
"code": "EC.KXNBASERIESSPREAD.SERIES"
},
"seriesName": "NBA Series Game Spread",
"category": "Sports",
"tags": [],
"frequency": 6
}]
}
stop
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
APIレート制限
- 30 秒間にイベントコントラクト Series リスト取得インターフェースへのリクエストは最大 10 回まで
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_event_contract_series_list(category=None, tag=None)
説明
イベントコントラクトの Series リストを取得します。Series は関連する Event の集合体(例:ある銘柄の GDP データ公表など)であり、一次カテゴリと二次タグによるフィルタリングに対応しています。
パラメータ
パラメータ 型 説明 category str 一次カテゴリ識別子、任意、例: 'Sports'tag str 二次カテゴリ識別子、任意、例: 'Baseball'戻り値
パラメータ 型 説明 ret RET_CODE API呼出結果 data pd.DataFrame ret == RET_OK の場合、Series リストを返します str ret != RET_OK の場合、エラーの説明を返します 返される DataFrame のフィールドは以下の通りです:
フィールド 型 説明 series_code str Series コントラクトコード series_name str Series 名称(多言語) category str 一次カテゴリ識別子 tags list 二次カテゴリ識別子リスト(1 つの series は複数の tag に属することができます) frequency str 頻度、ECFrequency を参照 Example
from moomoo import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_event_contract_series_list(category='Sports')
if ret == RET_OK:
print(data)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
- Output
series_code series_name category tags frequency
0 EC.KXUFCVICROUND.SERIES UFC Round of Victory Sports [] CUSTOM
1 EC.KXNBASERIESSPREAD.SERIES NBA Series Game Spread Sports [] CUSTOM
2 EC.KXWCUSAOPPONENT.SERIES World Cup USA Opponent Sports [] CUSTOM
3 EC.KXNFLSBMVP.SERIES Pro Football Championship MVP Sports [Football] ANNUAL
4 EC.KXUCLTCORNERS.SERIES Champions League Team Corners Sports [] CUSTOM
2
3
4
5
6
Sports カテゴリでは合計 433 個の Series が返されます。上記は最初の 5 行の例です。
# Qot_GetEventContractSeriesList.proto
説明
イベントコントラクトの Series リストを取得します。
パラメータ
// Series 項目
message SeriesItem {
required Qot_Common.Security seriesSecurity = 1; // {market=101, code="EC.KXRATECUTCOUNT"}
optional string seriesName = 2; // Series 名称(多言語)
optional string category = 3; // 一次カテゴリ識別子
repeated string tags = 4; // 二次カテゴリ識別子リスト(1 つの series は複数の tag に属することができます)
optional Qot_Common.EC_Frequency frequency = 5; // 頻度
}
message C2S {
optional string category = 1; // 一次カテゴリ識別子 ("SPORTS")
optional string tag = 2; // 二次カテゴリ識別子 ("BASEBALL")
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
- 銘柄構造については Security を参照
- 戻り値
message S2C {
repeated SeriesItem seriesList = 1;
}
message Response {
required int32 retType = 1 [default = -400]; //RetType,結果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
- 頻度列挙については ECFrequency を参照
- API呼出結果の構造については RetType を参照
プロトコル ID
3436
データ型
- 銘柄構造については Security を参照
- 頻度列挙については ECFrequency を参照
uint GetEventContractSeriesList(GetEventContractSeriesList.Request req);
virtual void OnReply_GetEventContractSeriesList(MMAPI_Conn client, uint nSerialNo, GetEventContractSeriesList.Response rsp);
説明
イベントコントラクトの Series リストを取得します。
パラメータ
message SeriesItem {
required Qot_Common.Security seriesSecurity = 1;
optional string seriesName = 2;
optional string category = 3;
repeated string tags = 4;
optional Qot_Common.EC_Frequency frequency = 5;
}
message C2S {
optional string category = 1;
optional string tag = 2;
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
- 銘柄構造については Security を参照
- 戻り値
message S2C {
repeated SeriesItem seriesList = 1;
}
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
- 頻度列挙については ECFrequency を参照
- 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;
var c2s = GetEventContractSeriesList.C2S.CreateBuilder()
.SetCategory("Sports").Build();
var req = GetEventContractSeriesList.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetEventContractSeriesList(req);
Console.Write("Send GetEventContractSeriesList: {0}\n", seqNo);
}
public void OnReply_GetEventContractSeriesList(MMAPI_Conn client, uint nSerialNo, GetEventContractSeriesList.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 getEventContractSeriesList(QotGetEventContractSeriesList.Request req);
void onReply_GetEventContractSeriesList(MMAPI_Conn client, int nSerialNo, QotGetEventContractSeriesList.Response rsp);
説明
イベントコントラクトの Series リストを取得します。
パラメータ
message C2S {
optional string category = 1;
optional string tag = 2;
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
- 銘柄構造については Security を参照
- 戻り値
message S2C {
repeated SeriesItem seriesList = 1;
}
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
- 頻度列挙については ECFrequency を参照
- 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;
QotGetEventContractSeriesList.C2S c2s = QotGetEventContractSeriesList.C2S.newBuilder()
.setCategory("Sports").build();
QotGetEventContractSeriesList.Request req = QotGetEventContractSeriesList.Request.newBuilder()
.setC2S(c2s).build();
int seqNo = qot.getEventContractSeriesList(req);
System.out.println("Send GetEventContractSeriesList: " + seqNo);
}
@Override
public void onReply_GetEventContractSeriesList(MMAPI_Conn client, int nSerialNo, QotGetEventContractSeriesList.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 GetEventContractSeriesList(const Qot_GetEventContractSeriesList::Request &stReq);
virtual void OnReply_GetEventContractSeriesList(moomoo::u32_t nSerialNo, const Qot_GetEventContractSeriesList::Response &stRsp) = 0;
説明
イベントコントラクトの Series リストを取得します。
パラメータ
// Series 項目
message SeriesItem {
required Qot_Common.Security seriesSecurity = 1; // {market=101, code="EC.KXRATECUTCOUNT"}
optional string seriesName = 2; // Series 名称(多言語)
optional string category = 3; // 一次カテゴリ識別子
repeated string tags = 4; // 二次カテゴリ識別子リスト(1 つの series は複数の tag に属することができます)
optional Qot_Common.EC_Frequency frequency = 5; // 頻度
}
message C2S {
optional string category = 1; // 一次カテゴリ識別子 ("SPORTS")
optional string tag = 2; // 二次カテゴリ識別子 ("BASEBALL")
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
- 銘柄構造については Security を参照
- 戻り値
message S2C {
repeated SeriesItem seriesList = 1;
}
message Response {
required int32 retType = 1 [default = -400]; //RetType,結果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
- 頻度列挙については ECFrequency を参照
- API呼出結果の構造については 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_GetEventContractSeriesList::Request req;
Qot_GetEventContractSeriesList::C2S *c2s = req.mutable_c2s();
c2s->set_category("Sports");
m_GetEventContractSeriesListSerialNo = m_pQotApi->GetEventContractSeriesList(req);
cout << "Request GetEventContractSeriesList SerialNo: " << m_GetEventContractSeriesListSerialNo << endl;
}
virtual void OnReply_GetEventContractSeriesList(moomoo::u32_t nSerialNo, const Qot_GetEventContractSeriesList::Response &stRsp) {
if (nSerialNo == m_GetEventContractSeriesListSerialNo)
{
cout << "OnReply_GetEventContractSeriesList 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_GetEventContractSeriesListSerialNo;
};
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
- Output
connect
Request GetEventContractSeriesList SerialNo: 1
OnReply_GetEventContractSeriesList SerialNo: 1
{
"retType": 0,
"retMsg": "",
"errCode": 0,
"s2c": {
"seriesList": [
{
"seriesSecurity": {"market": 101, "code": "EC.KXUFCVICROUND.SERIES"},
"seriesName": "UFC Round of Victory",
"category": "Sports",
"tags": [],
"frequency": 6
},
{
"seriesSecurity": {"market": 101, "code": "EC.KXNBASERIESSPREAD.SERIES"},
"seriesName": "NBA Series Game Spread",
"category": "Sports",
"tags": [],
"frequency": 6
}
]
}
}
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
GetEventContractSeriesList(req);
説明
イベントコントラクトの Series リストを取得します。一次カテゴリまたは二次タグでフィルタリング可能です。
パラメータ
// Series 項目
message SeriesItem {
required Qot_Common.Security seriesSecurity = 1; // Series 銘柄 {market=101, code="EC.KXRATECUTCOUNT"}
optional string seriesName = 2; // Series 名称(多言語)
optional string category = 3; // 一次カテゴリ識別子
repeated string tags = 4; // 二次カテゴリ識別子リスト
optional Qot_Common.EC_Frequency frequency = 5; // 頻度
}
message C2S {
optional string category = 1; // 一次カテゴリ識別子 ("SPORTS")
optional string tag = 2; // 二次カテゴリ識別子 ("BASEBALL")
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
- 戻り値
message S2C {
repeated SeriesItem seriesList = 1; // Series リスト
}
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
- 頻度列挙については ECFrequency を参照
- API呼出結果の構造については RetType を参照
- Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_Common } from "moomoo-api/proto";
import beautify from "js-beautify";
function GetEventContractSeriesList() {
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", tag: "Baseball" } };
let { errCode, retMsg, retType, s2c } = await websocket.GetEventContractSeriesList(req);
console.log("GetEventContractSeriesList: 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
GetEventContractSeriesList: errCode 0, retMsg , retType 0
{
"seriesList": [{
"seriesSecurity": {
"market": 101,
"code": "EC.KXUFCVICROUND.SERIES"
},
"seriesName": "UFC Round of Victory",
"category": "Sports",
"tags": [],
"frequency": 6
}, {
"seriesSecurity": {
"market": 101,
"code": "EC.KXNBASERIESSPREAD.SERIES"
},
"seriesName": "NBA Series Game Spread",
"category": "Sports",
"tags": [],
"frequency": 6
}]
}
stop
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
APIレート制限
- 30 秒間にイベントコントラクト Series リスト取得インターフェースへのリクエストは最大 10 回まで