# オプション市場統計
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_option_market_statistic(option_market, data_type, begin_time=None, end_time=None, page_req_key=None)
説明
オプション市場統計データ(出来高/建玉)を取得し、取引日単位でコール、プットおよび合計値を返します。ページネーション対応。
パラメータ
パラメータ 型 説明 option_market OptionMarket オプション市場タイプ US_SECURITY=米国株式オプション、US_INDEX=米国指数オプション、HK_SECURITY=香港株式オプション、HK_INDEX=香港指数オプションdata_type OptionStatisticDataType データタイプ VOLUME=出来高、OPEN_INTEREST=建玉begin_time str 開始日付、フォーマット 'YYYY-MM-DD' 未指定の場合、デフォルトで直近1年分のデータを取得end_time str 終了日付、フォーマット 'YYYY-MM-DD' begin_time との期間は1年以内page_req_key bytes ページングリクエストキー 初回は None、続きは前回の戻り値を渡す戻り値
パラメータ 型 説明 ret RET_CODE インターフェース呼び出し結果 data pandas.DataFrame ret == RET_OK の場合、統計データを返す str ret != RET_OK の場合、エラー説明を返す page_req_key bytes 次ページキー、None はデータなし 戻り DataFrame フィールド:
フィールド 型 説明 time str 取引日時間文字列 timestamp float 取引日タイムスタンプ(Unix 秒) call_value int コールオプション合計値 put_value int プットオプション合計値 total_value int 合計値(call_value + put_value) ratio float Put/Call 比率 call_value が 0 の場合は N/A
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data, page_req_key = quote_ctx.get_option_market_statistic(
OptionMarket.US_SECURITY,
OptionStatisticDataType.VOLUME,
begin_time='2026-06-01',
end_time='2026-06-15'
)
if ret == RET_OK:
print(data)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
- Output
time timestamp call_value put_value total_value ratio
0 2026-06-12 1.781237e+09 45658870 28723978 74382848 0.629100
1 2026-06-11 1.781150e+09 38303062 30520043 68823105 0.796804
2 2026-06-10 1.781064e+09 35371830 30180004 65551834 0.853221
3 2026-06-09 1.780978e+09 42880655 36646152 79526807 0.854608
4 2026-06-08 1.780891e+09 35442266 25811533 61253799 0.728270
5 2026-06-05 1.780632e+09 52362998 44023321 96386319 0.840733
6 2026-06-04 1.780546e+09 38082169 24572137 62654306 0.645240
7 2026-06-03 1.780459e+09 36858233 23035404 59893637 0.624973
8 2026-06-02 1.780373e+09 36822706 21026201 57848907 0.571012
9 2026-06-01 1.780286e+09 42932185 24084036 67016221 0.560979
2
3
4
5
6
7
8
9
10
11
# Qot_GetOptionMarketStatistic.proto
説明
オプション市場統計データを取得
パラメータ
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket、オプション市場タイプ
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType、データタイプ(出来高または建玉)
required string beginTime = 3; //開始時間文字列
required string endTime = 4; //終了時間文字列、期間が1年を超える場合は自動ページング
optional bytes nextPageKey = 5; //ページングリクエストのキー、初回は未設定、続きは前回返却のnextPageKeyを設定
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 戻り値
//日次統計データ
message StatisticItem
{
required string time = 1; //取引日時間文字列
optional double timestamp = 2; //取引日タイムスタンプ
required int64 callValue = 3; //コールオプション合計値(出来高または建玉、リクエストのdataTypeにより決定)
required int64 putValue = 4; //プットオプション合計値
optional int64 totalValue = 5; //合計値(callValue + putValue)
optional double ratio = 6; //Put/Call比率(callValueが0の場合は未設定)
}
message S2C
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket、オプション市場タイプ
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType、データタイプ
repeated StatisticItem statisticList = 3; //統計データリスト、取引日降順
optional bytes nextPageKey = 4; //ページングリクエストのキー、値がある場合はさらにデータあり
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType、戻り結果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3301
uint GetOptionMarketStatistic(Qot_GetOptionMarketStatistic.Request req); virtual void OnReply_GetOptionMarketStatistic(FTAPI_Conn client, uint nSerialNo, Qot_GetOptionMarketStatistic.Response rsp);
説明
オプション市場統計データを取得
パラメータ
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket、オプション市場タイプ
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType、データタイプ(出来高または建玉)
required string beginTime = 3; //開始時間文字列
required string endTime = 4; //終了時間文字列、期間が1年を超える場合は自動ページング
optional bytes nextPageKey = 5; //ページングリクエストのキー、初回は未設定、続きは前回返却のnextPageKeyを設定
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 戻り値
//日次統計データ
message StatisticItem
{
required string time = 1; //取引日時間文字列
optional double timestamp = 2; //取引日タイムスタンプ
required int64 callValue = 3; //コールオプション合計値(出来高または建玉、リクエストのdataTypeにより決定)
required int64 putValue = 4; //プットオプション合計値
optional int64 totalValue = 5; //合計値(callValue + putValue)
optional double ratio = 6; //Put/Call比率(callValueが0の場合は未設定)
}
message S2C
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket、オプション市場タイプ
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType、データタイプ
repeated StatisticItem statisticList = 3; //統計データリスト、取引日降順
optional bytes nextPageKey = 4; //ページングリクエストのキー、値がある場合はさらにデータあり
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType、戻り結果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3301
int getOptionMarketStatistic(Qot_GetOptionMarketStatistic.Request req) onReply_GetOptionMarketStatistic(FTAPI_Conn client, int nSerialNo, Qot_GetOptionMarketStatistic.Response rsp)
説明
オプション市場統計データを取得
パラメータ
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket、オプション市場タイプ
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType、データタイプ(出来高または建玉)
required string beginTime = 3; //開始時間文字列
required string endTime = 4; //終了時間文字列、期間が1年を超える場合は自動ページング
optional bytes nextPageKey = 5; //ページングリクエストのキー、初回は未設定、続きは前回返却のnextPageKeyを設定
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 戻り値
//日次統計データ
message StatisticItem
{
required string time = 1; //取引日時間文字列
optional double timestamp = 2; //取引日タイムスタンプ
required int64 callValue = 3; //コールオプション合計値(出来高または建玉、リクエストのdataTypeにより決定)
required int64 putValue = 4; //プットオプション合計値
optional int64 totalValue = 5; //合計値(callValue + putValue)
optional double ratio = 6; //Put/Call比率(callValueが0の場合は未設定)
}
message S2C
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket、オプション市場タイプ
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType、データタイプ
repeated StatisticItem statisticList = 3; //統計データリスト、取引日降順
optional bytes nextPageKey = 4; //ページングリクエストのキー、値がある場合はさらにデータあり
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType、戻り結果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3301
Futu::u32_t GetOptionMarketStatistic(const Qot_GetOptionMarketStatistic::Request &stReq);
virtual void OnReply_GetOptionMarketStatistic(Futu::u32_t nSerialNo, const Qot_GetOptionMarketStatistic::Response &stRsp) = 0;
説明
オプション市場統計データを取得
パラメータ
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket、オプション市場タイプ
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType、データタイプ(出来高または建玉)
required string beginTime = 3; //開始時間文字列
required string endTime = 4; //終了時間文字列、期間が1年を超える場合は自動ページング
optional bytes nextPageKey = 5; //ページングリクエストのキー、初回は未設定、続きは前回返却のnextPageKeyを設定
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 戻り値
//日次統計データ
message StatisticItem
{
required string time = 1; //取引日時間文字列
optional double timestamp = 2; //取引日タイムスタンプ
required int64 callValue = 3; //コールオプション合計値(出来高または建玉、リクエストのdataTypeにより決定)
required int64 putValue = 4; //プットオプション合計値
optional int64 totalValue = 5; //合計値(callValue + putValue)
optional double ratio = 6; //Put/Call比率(callValueが0の場合は未設定)
}
message S2C
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket、オプション市場タイプ
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType、データタイプ
repeated StatisticItem statisticList = 3; //統計データリスト、取引日降順
optional bytes nextPageKey = 4; //ページングリクエストのキー、値がある場合はさらにデータあり
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType、戻り結果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3301
Example
class Program : public FTSPI_Qot, public FTSPI_Conn
{
public:
Program() {
m_pQotApi = FTAPI::CreateQotApi();
m_pQotApi->RegisterQotSpi(this);
m_pQotApi->RegisterConnSpi(this);
}
~Program() {
if (m_pQotApi != nullptr) {
m_pQotApi->UnregisterQotSpi();
m_pQotApi->UnregisterConnSpi();
FTAPI::ReleaseQotApi(m_pQotApi);
m_pQotApi = nullptr;
}
}
void Start() {
m_pQotApi->InitConnect("127.0.0.1", 11111, false);
}
virtual void OnInitConnect(FTAPI_Conn* pConn, Futu::i64_t nErrCode, const char* strDesc) {
Qot_GetOptionMarketStatistic::Request req;
Qot_GetOptionMarketStatistic::C2S *c2s = req.mutable_c2s();
// TODO: 按 proto 填充 c2s 字段
m_GetOptionMarketStatisticSerialNo = m_pQotApi->GetOptionMarketStatistic(req);
}
virtual void OnReply_GetOptionMarketStatistic(Futu::u32_t nSerialNo, const Qot_GetOptionMarketStatistic::Response &stRsp) {
if (nSerialNo != m_GetOptionMarketStatisticSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
FTAPI_Qot *m_pQotApi;
Futu::u32_t m_GetOptionMarketStatisticSerialNo = 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
getOptionMarketStatistic(qotGetOptionMarketStatistic)
説明
オプション市場統計データを取得
パラメータ
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket、オプション市場タイプ
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType、データタイプ(出来高または建玉)
required string beginTime = 3; //開始時間文字列
required string endTime = 4; //終了時間文字列、期間が1年を超える場合は自動ページング
optional bytes nextPageKey = 5; //ページングリクエストのキー、初回は未設定、続きは前回返却のnextPageKeyを設定
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 戻り値
//日次統計データ
message StatisticItem
{
required string time = 1; //取引日時間文字列
optional double timestamp = 2; //取引日タイムスタンプ
required int64 callValue = 3; //コールオプション合計値(出来高または建玉、リクエストのdataTypeにより決定)
required int64 putValue = 4; //プットオプション合計値
optional int64 totalValue = 5; //合計値(callValue + putValue)
optional double ratio = 6; //Put/Call比率(callValueが0の場合は未設定)
}
message S2C
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket、オプション市場タイプ
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType、データタイプ
repeated StatisticItem statisticList = 3; //統計データリスト、取引日降順
optional bytes nextPageKey = 4; //ページングリクエストのキー、値がある場合はさらにデータあり
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType、戻り結果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3301
Example
import ftWebsocket from "futu-api";
import { Common, Qot_OptionCommon } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetOptionMarketStatistic(){
const { RetType } = Common
const { OptionMarket, OptionStatisticDataType } = Qot_OptionCommon
let [addr, port, enable_ssl, key] = ["127.0.0.1", 11112, false, ''];
let websocket = new ftWebsocket();
websocket.onlogin = (ret, msg)=>{
if (ret) {
const req = {
c2s: {
optionMarket: OptionMarket.OptionMarket_US_Security,
dataType: OptionStatisticDataType.OptionStatisticDataType_Volume,
beginTime: '2026-06-01',
endTime: '2026-06-15',
},
};
websocket.GetOptionMarketStatistic(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetOptionMarketStatistic: errCode %d, retMsg %s, retType %d", errCode, retMsg, retType);
if(retType == RetType.RetType_Succeed){
let data = beautify(JSON.stringify(s2c), { indent_size: 2, space_in_empty_paren: true });
console.log(data);
}
})
.catch((error)=>{ console.log("error:", error); });
} else {
console.log("start error", msg);
}
};
websocket.start(addr, port, enable_ssl, key);
setTimeout(()=>{ websocket.stop(); process.exit(); }, 5000);
}
QotGetOptionMarketStatistic()
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
- Output
GetOptionMarketStatistic: errCode 0, retMsg , retType 0
{
"optionMarket": 1,
"dataType": 0,
"statisticList": [
{
"time": "2026-06-12",
"timestamp": 1781237000,
"callValue": 45658870,
"putValue": 28723978,
"totalValue": 74382848,
"ratio": 0.6291
},
{
"time": "2026-06-11",
"timestamp": 1781150000,
"callValue": 38303062,
"putValue": 30520043,
"totalValue": 68823105,
"ratio": 0.796804
},
{
"time": "2026-06-10",
"timestamp": 1781064000,
"callValue": 35371830,
"putValue": 30180004,
"totalValue": 65551834,
"ratio": 0.853221
}
]
}
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
インターフェース制限
- 30秒以内に最大60回のオプション市場統計インターフェースリクエスト(ページング対応のインターフェースは初回呼び出しのみカウント)
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_option_market_statistic(option_market, data_type, begin_time=None, end_time=None, page_req_key=None)
説明
オプション市場統計データ(出来高/建玉)を取得し、取引日単位でコール、プットおよび合計値を返します。ページネーション対応。
パラメータ
パラメータ 型 説明 option_market OptionMarket オプション市場タイプ US_SECURITY=米国株式オプション、US_INDEX=米国指数オプション、HK_SECURITY=香港株式オプション、HK_INDEX=香港指数オプションdata_type OptionStatisticDataType データタイプ VOLUME=出来高、OPEN_INTEREST=建玉begin_time str 開始日付、フォーマット 'YYYY-MM-DD' 未指定の場合、デフォルトで直近1年分のデータを取得end_time str 終了日付、フォーマット 'YYYY-MM-DD' begin_time との期間は1年以内page_req_key bytes ページングリクエストキー 初回は None、続きは前回の戻り値を渡す戻り値
パラメータ 型 説明 ret RET_CODE インターフェース呼び出し結果 data pandas.DataFrame ret == RET_OK の場合、統計データを返す str ret != RET_OK の場合、エラー説明を返す page_req_key bytes 次ページキー、None はデータなし 戻り DataFrame フィールド:
フィールド 型 説明 time str 取引日時間文字列 timestamp float 取引日タイムスタンプ(Unix 秒) call_value int コールオプション合計値 put_value int プットオプション合計値 total_value int 合計値(call_value + put_value) ratio float Put/Call 比率 call_value が 0 の場合は N/A
Example
from moomoo import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data, page_req_key = quote_ctx.get_option_market_statistic(
OptionMarket.US_SECURITY,
OptionStatisticDataType.VOLUME,
begin_time='2026-06-01',
end_time='2026-06-15'
)
if ret == RET_OK:
print(data)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
- Output
time timestamp call_value put_value total_value ratio
0 2026-06-12 1.781237e+09 45658870 28723978 74382848 0.629100
1 2026-06-11 1.781150e+09 38303062 30520043 68823105 0.796804
2 2026-06-10 1.781064e+09 35371830 30180004 65551834 0.853221
3 2026-06-09 1.780978e+09 42880655 36646152 79526807 0.854608
4 2026-06-08 1.780891e+09 35442266 25811533 61253799 0.728270
5 2026-06-05 1.780632e+09 52362998 44023321 96386319 0.840733
6 2026-06-04 1.780546e+09 38082169 24572137 62654306 0.645240
7 2026-06-03 1.780459e+09 36858233 23035404 59893637 0.624973
8 2026-06-02 1.780373e+09 36822706 21026201 57848907 0.571012
9 2026-06-01 1.780286e+09 42932185 24084036 67016221 0.560979
2
3
4
5
6
7
8
9
10
11
# Qot_GetOptionMarketStatistic.proto
説明
オプション市場統計データを取得
パラメータ
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket、オプション市場タイプ
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType、データタイプ(出来高または建玉)
required string beginTime = 3; //開始時間文字列
required string endTime = 4; //終了時間文字列、期間が1年を超える場合は自動ページング
optional bytes nextPageKey = 5; //ページングリクエストのキー、初回は未設定、続きは前回返却のnextPageKeyを設定
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 戻り値
//日次統計データ
message StatisticItem
{
required string time = 1; //取引日時間文字列
optional double timestamp = 2; //取引日タイムスタンプ
required int64 callValue = 3; //コールオプション合計値(出来高または建玉、リクエストのdataTypeにより決定)
required int64 putValue = 4; //プットオプション合計値
optional int64 totalValue = 5; //合計値(callValue + putValue)
optional double ratio = 6; //Put/Call比率(callValueが0の場合は未設定)
}
message S2C
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket、オプション市場タイプ
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType、データタイプ
repeated StatisticItem statisticList = 3; //統計データリスト、取引日降順
optional bytes nextPageKey = 4; //ページングリクエストのキー、値がある場合はさらにデータあり
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType、戻り結果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3301
uint GetOptionMarketStatistic(Qot_GetOptionMarketStatistic.Request req); virtual void OnReply_GetOptionMarketStatistic(MMAPI_Conn client, uint nSerialNo, Qot_GetOptionMarketStatistic.Response rsp);
説明
オプション市場統計データを取得
パラメータ
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket、オプション市場タイプ
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType、データタイプ(出来高または建玉)
required string beginTime = 3; //開始時間文字列
required string endTime = 4; //終了時間文字列、期間が1年を超える場合は自動ページング
optional bytes nextPageKey = 5; //ページングリクエストのキー、初回は未設定、続きは前回返却のnextPageKeyを設定
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 戻り値
//日次統計データ
message StatisticItem
{
required string time = 1; //取引日時間文字列
optional double timestamp = 2; //取引日タイムスタンプ
required int64 callValue = 3; //コールオプション合計値(出来高または建玉、リクエストのdataTypeにより決定)
required int64 putValue = 4; //プットオプション合計値
optional int64 totalValue = 5; //合計値(callValue + putValue)
optional double ratio = 6; //Put/Call比率(callValueが0の場合は未設定)
}
message S2C
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket、オプション市場タイプ
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType、データタイプ
repeated StatisticItem statisticList = 3; //統計データリスト、取引日降順
optional bytes nextPageKey = 4; //ページングリクエストのキー、値がある場合はさらにデータあり
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType、戻り結果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3301
int getOptionMarketStatistic(Qot_GetOptionMarketStatistic.Request req) onReply_GetOptionMarketStatistic(MMAPI_Conn client, int nSerialNo, Qot_GetOptionMarketStatistic.Response rsp)
説明
オプション市場統計データを取得
パラメータ
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket、オプション市場タイプ
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType、データタイプ(出来高または建玉)
required string beginTime = 3; //開始時間文字列
required string endTime = 4; //終了時間文字列、期間が1年を超える場合は自動ページング
optional bytes nextPageKey = 5; //ページングリクエストのキー、初回は未設定、続きは前回返却のnextPageKeyを設定
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 戻り値
//日次統計データ
message StatisticItem
{
required string time = 1; //取引日時間文字列
optional double timestamp = 2; //取引日タイムスタンプ
required int64 callValue = 3; //コールオプション合計値(出来高または建玉、リクエストのdataTypeにより決定)
required int64 putValue = 4; //プットオプション合計値
optional int64 totalValue = 5; //合計値(callValue + putValue)
optional double ratio = 6; //Put/Call比率(callValueが0の場合は未設定)
}
message S2C
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket、オプション市場タイプ
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType、データタイプ
repeated StatisticItem statisticList = 3; //統計データリスト、取引日降順
optional bytes nextPageKey = 4; //ページングリクエストのキー、値がある場合はさらにデータあり
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType、戻り結果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3301
Moomoo::u32_t GetOptionMarketStatistic(const Qot_GetOptionMarketStatistic::Request &stReq);
virtual void OnReply_GetOptionMarketStatistic(Moomoo::u32_t nSerialNo, const Qot_GetOptionMarketStatistic::Response &stRsp) = 0;
説明
オプション市場統計データを取得
パラメータ
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket、オプション市場タイプ
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType、データタイプ(出来高または建玉)
required string beginTime = 3; //開始時間文字列
required string endTime = 4; //終了時間文字列、期間が1年を超える場合は自動ページング
optional bytes nextPageKey = 5; //ページングリクエストのキー、初回は未設定、続きは前回返却のnextPageKeyを設定
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 戻り値
//日次統計データ
message StatisticItem
{
required string time = 1; //取引日時間文字列
optional double timestamp = 2; //取引日タイムスタンプ
required int64 callValue = 3; //コールオプション合計値(出来高または建玉、リクエストのdataTypeにより決定)
required int64 putValue = 4; //プットオプション合計値
optional int64 totalValue = 5; //合計値(callValue + putValue)
optional double ratio = 6; //Put/Call比率(callValueが0の場合は未設定)
}
message S2C
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket、オプション市場タイプ
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType、データタイプ
repeated StatisticItem statisticList = 3; //統計データリスト、取引日降順
optional bytes nextPageKey = 4; //ページングリクエストのキー、値がある場合はさらにデータあり
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType、戻り結果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3301
Example
class Program : public MMSPI_Qot, public MMSPI_Conn
{
public:
Program() {
m_pQotApi = MMAPI::CreateQotApi();
m_pQotApi->RegisterQotSpi(this);
m_pQotApi->RegisterConnSpi(this);
}
~Program() {
if (m_pQotApi != nullptr) {
m_pQotApi->UnregisterQotSpi();
m_pQotApi->UnregisterConnSpi();
MMAPI::ReleaseQotApi(m_pQotApi);
m_pQotApi = nullptr;
}
}
void Start() {
m_pQotApi->InitConnect("127.0.0.1", 11111, false);
}
virtual void OnInitConnect(MMAPI_Conn* pConn, Moomoo::i64_t nErrCode, const char* strDesc) {
Qot_GetOptionMarketStatistic::Request req;
Qot_GetOptionMarketStatistic::C2S *c2s = req.mutable_c2s();
// TODO: 按 proto 填充 c2s 字段
m_GetOptionMarketStatisticSerialNo = m_pQotApi->GetOptionMarketStatistic(req);
}
virtual void OnReply_GetOptionMarketStatistic(Moomoo::u32_t nSerialNo, const Qot_GetOptionMarketStatistic::Response &stRsp) {
if (nSerialNo != m_GetOptionMarketStatisticSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
MMAPI_Qot *m_pQotApi;
Moomoo::u32_t m_GetOptionMarketStatisticSerialNo = 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
getOptionMarketStatistic(qotGetOptionMarketStatistic)
説明
オプション市場統計データを取得
パラメータ
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket、オプション市場タイプ
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType、データタイプ(出来高または建玉)
required string beginTime = 3; //開始時間文字列
required string endTime = 4; //終了時間文字列、期間が1年を超える場合は自動ページング
optional bytes nextPageKey = 5; //ページングリクエストのキー、初回は未設定、続きは前回返却のnextPageKeyを設定
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 戻り値
//日次統計データ
message StatisticItem
{
required string time = 1; //取引日時間文字列
optional double timestamp = 2; //取引日タイムスタンプ
required int64 callValue = 3; //コールオプション合計値(出来高または建玉、リクエストのdataTypeにより決定)
required int64 putValue = 4; //プットオプション合計値
optional int64 totalValue = 5; //合計値(callValue + putValue)
optional double ratio = 6; //Put/Call比率(callValueが0の場合は未設定)
}
message S2C
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket、オプション市場タイプ
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType、データタイプ
repeated StatisticItem statisticList = 3; //統計データリスト、取引日降順
optional bytes nextPageKey = 4; //ページングリクエストのキー、値がある場合はさらにデータあり
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType、戻り結果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3301
Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_OptionCommon } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetOptionMarketStatistic(){
const { RetType } = Common
const { OptionMarket, OptionStatisticDataType } = Qot_OptionCommon
let [addr, port, enable_ssl, key] = ["127.0.0.1", 11112, false, ''];
let websocket = new mmWebsocket();
websocket.onlogin = (ret, msg)=>{
if (ret) {
const req = {
c2s: {
optionMarket: OptionMarket.OptionMarket_US_Security,
dataType: OptionStatisticDataType.OptionStatisticDataType_Volume,
beginTime: '2026-06-01',
endTime: '2026-06-15',
},
};
websocket.GetOptionMarketStatistic(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetOptionMarketStatistic: errCode %d, retMsg %s, retType %d", errCode, retMsg, retType);
if(retType == RetType.RetType_Succeed){
let data = beautify(JSON.stringify(s2c), { indent_size: 2, space_in_empty_paren: true });
console.log(data);
}
})
.catch((error)=>{ console.log("error:", error); });
} else {
console.log("start error", msg);
}
};
websocket.start(addr, port, enable_ssl, key);
setTimeout(()=>{ websocket.stop(); process.exit(); }, 5000);
}
QotGetOptionMarketStatistic()
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
- Output
GetOptionMarketStatistic: errCode 0, retMsg , retType 0
{
"optionMarket": 1,
"dataType": 0,
"statisticList": [
{
"time": "2026-06-12",
"timestamp": 1781237000,
"callValue": 45658870,
"putValue": 28723978,
"totalValue": 74382848,
"ratio": 0.6291
},
{
"time": "2026-06-11",
"timestamp": 1781150000,
"callValue": 38303062,
"putValue": 30520043,
"totalValue": 68823105,
"ratio": 0.796804
},
{
"time": "2026-06-10",
"timestamp": 1781064000,
"callValue": 35371830,
"putValue": 30180004,
"totalValue": 65551834,
"ratio": 0.853221
}
]
}
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
インターフェース制限
- 30秒以内に最大60回のオプション市場統計インターフェースリクエスト(ページング対応のインターフェースは初回呼び出しのみカウント)