# オプション原資産履歴ボラティリティ
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_option_underlying_his_volatility(code, index_option_type=IndexOptionType.NORMAL, begin_time=None, end_time=None, page_req_key=None)
説明
オプション原資産のヒストリカルボラティリティデータを取得します。取引日単位で IV と HV の時系列および原資産終値を返します。ページネーション対応。
パラメータ
パラメータ 型 説明 code str 原資産銘柄コード 例:'US.AAPL'index_option_type IndexOptionType 指数オプションタイプ NORMAL=通常オプション(デフォルト)、SMALL=ミニ指数オプションbegin_time str 開始日付、フォーマット 'YYYY-MM-DD' end_time str 終了日付、フォーマット 'YYYY-MM-DD' page_req_key bytes ページングリクエストキー 初回は None、続きは前回の戻り値を渡す時間範囲について
begin_timeとend_timeの間隔は最大 364 日- 両方未指定:
end_time= 当日、begin_time= 当日から 364 日前 begin_timeのみ指定:end_time=begin_timeから 364 日後end_timeのみ指定:begin_time=end_timeから 364 日前
戻り値
パラメータ 型 説明 ret RET_CODE インターフェース呼び出し結果 data pandas.DataFrame ret == RET_OK の場合、ボラティリティデータを返す str ret != RET_OK の場合、エラー説明を返す page_req_key bytes 次ページキー、None はデータなし 戻り DataFrame フィールド:
フィールド 型 説明 code str 銘柄コード name str 銘柄名称 time str 取引日時間文字列 timestamp float 取引日タイムスタンプ(Unix 秒) iv float インプライドボラティリティ(パーセント) hv float ヒストリカルボラティリティ(パーセント) underlying_price float 原資産終値(当日はマーク価格)
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data, page_req_key = quote_ctx.get_option_underlying_his_volatility(
'US.AAPL',
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
- Output
code name time timestamp iv hv underlying_price
0 US.AAPL Apple 2026-06-12 1.781237e+09 25.126 23.324 291.13
1 US.AAPL Apple 2026-06-11 1.781150e+09 25.617 23.270 295.63
2 US.AAPL Apple 2026-06-10 1.781064e+09 27.384 22.892 291.58
3 US.AAPL Apple 2026-06-09 1.780978e+09 27.237 22.854 290.55
4 US.AAPL Apple 2026-06-08 1.780891e+09 26.368 19.028 301.54
5 US.AAPL Apple 2026-06-05 1.780632e+09 26.995 18.024 307.34
6 US.AAPL Apple 2026-06-04 1.780546e+09 25.249 17.366 311.23
7 US.AAPL Apple 2026-06-03 1.780459e+09 26.801 18.927 310.26
8 US.AAPL Apple 2026-06-02 1.780373e+09 26.258 18.415 315.20
9 US.AAPL Apple 2026-06-01 1.780286e+09 25.864 16.841 306.31
2
3
4
5
6
7
8
9
10
11
# Qot_GetOptionUnderlyingHisVolatility.proto
説明
オプション原資産のヒストリカルボラティリティデータを取得
パラメータ
message C2S
{
required Qot_Common.Security owner = 1; //オプション原資産
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType
required string beginTime = 3; //開始時間文字列
required string endTime = 4; //終了時間文字列
optional bytes nextPageKey = 5; //ページングリクエストのキー
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 戻り値
message VolatilityItem
{
required string time = 1; //取引日時間文字列
optional double timestamp = 2; //取引日タイムスタンプ
optional double iv = 3; //インプライドボラティリティ(パーセント)
optional double hv = 4; //ヒストリカルボラティリティ(パーセント)
optional double underlyingPrice = 5; //原資産終値
}
message S2C
{
required Qot_Common.Security owner = 1; //オプション原資産
optional string code = 2; //銘柄コード
optional string name = 3; //銘柄名称
repeated VolatilityItem volatilityList = 4; //ボラティリティデータリスト、取引日降順
optional bytes nextPageKey = 5; //ページングリクエストのキー
}
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3304
uint GetOptionUnderlyingHisVolatility(Qot_GetOptionUnderlyingHisVolatility.Request req); virtual void OnReply_GetOptionUnderlyingHisVolatility(FTAPI_Conn client, uint nSerialNo, Qot_GetOptionUnderlyingHisVolatility.Response rsp);
説明
オプション原資産のヒストリカルボラティリティデータを取得
パラメータ
message C2S
{
required Qot_Common.Security owner = 1; //オプション原資産
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType
required string beginTime = 3; //開始時間文字列
required string endTime = 4; //終了時間文字列
optional bytes nextPageKey = 5; //ページングリクエストのキー
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 戻り値
message VolatilityItem
{
required string time = 1; //取引日時間文字列
optional double timestamp = 2; //取引日タイムスタンプ
optional double iv = 3; //インプライドボラティリティ(パーセント)
optional double hv = 4; //ヒストリカルボラティリティ(パーセント)
optional double underlyingPrice = 5; //原資産終値
}
message S2C
{
required Qot_Common.Security owner = 1; //オプション原資産
optional string code = 2; //銘柄コード
optional string name = 3; //銘柄名称
repeated VolatilityItem volatilityList = 4; //ボラティリティデータリスト、取引日降順
optional bytes nextPageKey = 5; //ページングリクエストのキー
}
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3304
int getOptionUnderlyingHisVolatility(Qot_GetOptionUnderlyingHisVolatility.Request req) onReply_GetOptionUnderlyingHisVolatility(FTAPI_Conn client, int nSerialNo, Qot_GetOptionUnderlyingHisVolatility.Response rsp)
説明
オプション原資産のヒストリカルボラティリティデータを取得
パラメータ
message C2S
{
required Qot_Common.Security owner = 1; //オプション原資産
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType
required string beginTime = 3; //開始時間文字列
required string endTime = 4; //終了時間文字列
optional bytes nextPageKey = 5; //ページングリクエストのキー
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 戻り値
message VolatilityItem
{
required string time = 1; //取引日時間文字列
optional double timestamp = 2; //取引日タイムスタンプ
optional double iv = 3; //インプライドボラティリティ(パーセント)
optional double hv = 4; //ヒストリカルボラティリティ(パーセント)
optional double underlyingPrice = 5; //原資産終値
}
message S2C
{
required Qot_Common.Security owner = 1; //オプション原資産
optional string code = 2; //銘柄コード
optional string name = 3; //銘柄名称
repeated VolatilityItem volatilityList = 4; //ボラティリティデータリスト、取引日降順
optional bytes nextPageKey = 5; //ページングリクエストのキー
}
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3304
Futu::u32_t GetOptionUnderlyingHisVolatility(const Qot_GetOptionUnderlyingHisVolatility::Request &stReq);
virtual void OnReply_GetOptionUnderlyingHisVolatility(Futu::u32_t nSerialNo, const Qot_GetOptionUnderlyingHisVolatility::Response &stRsp) = 0;
説明
オプション原資産のヒストリカルボラティリティデータを取得
パラメータ
message C2S
{
required Qot_Common.Security owner = 1; //オプション原資産
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType
required string beginTime = 3; //開始時間文字列
required string endTime = 4; //終了時間文字列
optional bytes nextPageKey = 5; //ページングリクエストのキー
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 戻り値
message VolatilityItem
{
required string time = 1; //取引日時間文字列
optional double timestamp = 2; //取引日タイムスタンプ
optional double iv = 3; //インプライドボラティリティ(パーセント)
optional double hv = 4; //ヒストリカルボラティリティ(パーセント)
optional double underlyingPrice = 5; //原資産終値
}
message S2C
{
required Qot_Common.Security owner = 1; //オプション原資産
optional string code = 2; //銘柄コード
optional string name = 3; //銘柄名称
repeated VolatilityItem volatilityList = 4; //ボラティリティデータリスト、取引日降順
optional bytes nextPageKey = 5; //ページングリクエストのキー
}
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3304
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_GetOptionUnderlyingHisVolatility::Request req;
Qot_GetOptionUnderlyingHisVolatility::C2S *c2s = req.mutable_c2s();
// TODO: 按 proto 填充 c2s 字段
m_GetOptionUnderlyingHisVolatilitySerialNo = m_pQotApi->GetOptionUnderlyingHisVolatility(req);
}
virtual void OnReply_GetOptionUnderlyingHisVolatility(Futu::u32_t nSerialNo, const Qot_GetOptionUnderlyingHisVolatility::Response &stRsp) {
if (nSerialNo != m_GetOptionUnderlyingHisVolatilitySerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
FTAPI_Qot *m_pQotApi;
Futu::u32_t m_GetOptionUnderlyingHisVolatilitySerialNo = 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
getOptionUnderlyingHisVolatility(qotGetOptionUnderlyingHisVolatility)
説明
オプション原資産のヒストリカルボラティリティデータを取得
パラメータ
message C2S
{
required Qot_Common.Security owner = 1; //オプション原資産
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType
required string beginTime = 3; //開始時間文字列
required string endTime = 4; //終了時間文字列
optional bytes nextPageKey = 5; //ページングリクエストのキー
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 戻り値
message VolatilityItem
{
required string time = 1; //取引日時間文字列
optional double timestamp = 2; //取引日タイムスタンプ
optional double iv = 3; //インプライドボラティリティ(パーセント)
optional double hv = 4; //ヒストリカルボラティリティ(パーセント)
optional double underlyingPrice = 5; //原資産終値
}
message S2C
{
required Qot_Common.Security owner = 1; //オプション原資産
optional string code = 2; //銘柄コード
optional string name = 3; //銘柄名称
repeated VolatilityItem volatilityList = 4; //ボラティリティデータリスト、取引日降順
optional bytes nextPageKey = 5; //ページングリクエストのキー
}
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3304
Example
import ftWebsocket from "futu-api";
import { Common, Qot_Common } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetOptionUnderlyingHisVolatility(){
const { RetType } = Common
const { QotMarket } = Qot_Common
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: {
owner: { market: QotMarket.QotMarket_US_Security, code: 'AAPL' },
beginTime: '2026-06-01',
endTime: '2026-06-15',
},
};
websocket.GetOptionUnderlyingHisVolatility(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetOptionUnderlyingHisVolatility: 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);
}
QotGetOptionUnderlyingHisVolatility()
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
- Output
GetOptionUnderlyingHisVolatility: errCode 0, retMsg , retType 0
{
"owner": { "market": 1, "code": "AAPL" },
"code": "US.AAPL",
"name": "Apple",
"volatilityList": [
{ "time": "2026-06-12", "timestamp": 1781237000, "iv": 25.126, "hv": 23.324, "underlyingPrice": 291.13 },
{ "time": "2026-06-11", "timestamp": 1781150000, "iv": 25.617, "hv": 23.27, "underlyingPrice": 295.63 },
{ "time": "2026-06-10", "timestamp": 1781064000, "iv": 27.384, "hv": 22.892, "underlyingPrice": 291.58 },
{ "time": "2026-06-09", "timestamp": 1780978000, "iv": 27.237, "hv": 22.854, "underlyingPrice": 290.55 },
{ "time": "2026-06-08", "timestamp": 1780891000, "iv": 26.368, "hv": 19.028, "underlyingPrice": 301.54 }
]
}
2
3
4
5
6
7
8
9
10
11
12
13
インターフェース制限
- 30秒以内に最大60回のオプション原資産履歴ボラティリティインターフェースリクエスト(ページング対応のインターフェースは初回呼び出しのみカウント)
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_option_underlying_his_volatility(code, index_option_type=IndexOptionType.NORMAL, begin_time=None, end_time=None, page_req_key=None)
説明
オプション原資産のヒストリカルボラティリティデータを取得します。取引日単位で IV と HV の時系列および原資産終値を返します。ページネーション対応。
パラメータ
パラメータ 型 説明 code str 原資産銘柄コード 例:'US.AAPL'index_option_type IndexOptionType 指数オプションタイプ NORMAL=通常オプション(デフォルト)、SMALL=ミニ指数オプションbegin_time str 開始日付、フォーマット 'YYYY-MM-DD' end_time str 終了日付、フォーマット 'YYYY-MM-DD' page_req_key bytes ページングリクエストキー 初回は None、続きは前回の戻り値を渡す時間範囲について
begin_timeとend_timeの間隔は最大 364 日- 両方未指定:
end_time= 当日、begin_time= 当日から 364 日前 begin_timeのみ指定:end_time=begin_timeから 364 日後end_timeのみ指定:begin_time=end_timeから 364 日前
戻り値
パラメータ 型 説明 ret RET_CODE インターフェース呼び出し結果 data pandas.DataFrame ret == RET_OK の場合、ボラティリティデータを返す str ret != RET_OK の場合、エラー説明を返す page_req_key bytes 次ページキー、None はデータなし 戻り DataFrame フィールド:
フィールド 型 説明 code str 銘柄コード name str 銘柄名称 time str 取引日時間文字列 timestamp float 取引日タイムスタンプ(Unix 秒) iv float インプライドボラティリティ(パーセント) hv float ヒストリカルボラティリティ(パーセント) underlying_price float 原資産終値(当日はマーク価格)
Example
from moomoo import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data, page_req_key = quote_ctx.get_option_underlying_his_volatility(
'US.AAPL',
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
- Output
code name time timestamp iv hv underlying_price
0 US.AAPL Apple 2026-06-12 1.781237e+09 25.126 23.324 291.13
1 US.AAPL Apple 2026-06-11 1.781150e+09 25.617 23.270 295.63
2 US.AAPL Apple 2026-06-10 1.781064e+09 27.384 22.892 291.58
3 US.AAPL Apple 2026-06-09 1.780978e+09 27.237 22.854 290.55
4 US.AAPL Apple 2026-06-08 1.780891e+09 26.368 19.028 301.54
5 US.AAPL Apple 2026-06-05 1.780632e+09 26.995 18.024 307.34
6 US.AAPL Apple 2026-06-04 1.780546e+09 25.249 17.366 311.23
7 US.AAPL Apple 2026-06-03 1.780459e+09 26.801 18.927 310.26
8 US.AAPL Apple 2026-06-02 1.780373e+09 26.258 18.415 315.20
9 US.AAPL Apple 2026-06-01 1.780286e+09 25.864 16.841 306.31
2
3
4
5
6
7
8
9
10
11
# Qot_GetOptionUnderlyingHisVolatility.proto
説明
オプション原資産のヒストリカルボラティリティデータを取得
パラメータ
message C2S
{
required Qot_Common.Security owner = 1; //オプション原資産
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType
required string beginTime = 3; //開始時間文字列
required string endTime = 4; //終了時間文字列
optional bytes nextPageKey = 5; //ページングリクエストのキー
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 戻り値
message VolatilityItem
{
required string time = 1; //取引日時間文字列
optional double timestamp = 2; //取引日タイムスタンプ
optional double iv = 3; //インプライドボラティリティ(パーセント)
optional double hv = 4; //ヒストリカルボラティリティ(パーセント)
optional double underlyingPrice = 5; //原資産終値
}
message S2C
{
required Qot_Common.Security owner = 1; //オプション原資産
optional string code = 2; //銘柄コード
optional string name = 3; //銘柄名称
repeated VolatilityItem volatilityList = 4; //ボラティリティデータリスト、取引日降順
optional bytes nextPageKey = 5; //ページングリクエストのキー
}
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3304
uint GetOptionUnderlyingHisVolatility(Qot_GetOptionUnderlyingHisVolatility.Request req); virtual void OnReply_GetOptionUnderlyingHisVolatility(MMAPI_Conn client, uint nSerialNo, Qot_GetOptionUnderlyingHisVolatility.Response rsp);
説明
オプション原資産のヒストリカルボラティリティデータを取得
パラメータ
message C2S
{
required Qot_Common.Security owner = 1; //オプション原資産
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType
required string beginTime = 3; //開始時間文字列
required string endTime = 4; //終了時間文字列
optional bytes nextPageKey = 5; //ページングリクエストのキー
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 戻り値
message VolatilityItem
{
required string time = 1; //取引日時間文字列
optional double timestamp = 2; //取引日タイムスタンプ
optional double iv = 3; //インプライドボラティリティ(パーセント)
optional double hv = 4; //ヒストリカルボラティリティ(パーセント)
optional double underlyingPrice = 5; //原資産終値
}
message S2C
{
required Qot_Common.Security owner = 1; //オプション原資産
optional string code = 2; //銘柄コード
optional string name = 3; //銘柄名称
repeated VolatilityItem volatilityList = 4; //ボラティリティデータリスト、取引日降順
optional bytes nextPageKey = 5; //ページングリクエストのキー
}
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3304
int getOptionUnderlyingHisVolatility(Qot_GetOptionUnderlyingHisVolatility.Request req) onReply_GetOptionUnderlyingHisVolatility(MMAPI_Conn client, int nSerialNo, Qot_GetOptionUnderlyingHisVolatility.Response rsp)
説明
オプション原資産のヒストリカルボラティリティデータを取得
パラメータ
message C2S
{
required Qot_Common.Security owner = 1; //オプション原資産
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType
required string beginTime = 3; //開始時間文字列
required string endTime = 4; //終了時間文字列
optional bytes nextPageKey = 5; //ページングリクエストのキー
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 戻り値
message VolatilityItem
{
required string time = 1; //取引日時間文字列
optional double timestamp = 2; //取引日タイムスタンプ
optional double iv = 3; //インプライドボラティリティ(パーセント)
optional double hv = 4; //ヒストリカルボラティリティ(パーセント)
optional double underlyingPrice = 5; //原資産終値
}
message S2C
{
required Qot_Common.Security owner = 1; //オプション原資産
optional string code = 2; //銘柄コード
optional string name = 3; //銘柄名称
repeated VolatilityItem volatilityList = 4; //ボラティリティデータリスト、取引日降順
optional bytes nextPageKey = 5; //ページングリクエストのキー
}
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3304
Moomoo::u32_t GetOptionUnderlyingHisVolatility(const Qot_GetOptionUnderlyingHisVolatility::Request &stReq);
virtual void OnReply_GetOptionUnderlyingHisVolatility(Moomoo::u32_t nSerialNo, const Qot_GetOptionUnderlyingHisVolatility::Response &stRsp) = 0;
説明
オプション原資産のヒストリカルボラティリティデータを取得
パラメータ
message C2S
{
required Qot_Common.Security owner = 1; //オプション原資産
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType
required string beginTime = 3; //開始時間文字列
required string endTime = 4; //終了時間文字列
optional bytes nextPageKey = 5; //ページングリクエストのキー
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 戻り値
message VolatilityItem
{
required string time = 1; //取引日時間文字列
optional double timestamp = 2; //取引日タイムスタンプ
optional double iv = 3; //インプライドボラティリティ(パーセント)
optional double hv = 4; //ヒストリカルボラティリティ(パーセント)
optional double underlyingPrice = 5; //原資産終値
}
message S2C
{
required Qot_Common.Security owner = 1; //オプション原資産
optional string code = 2; //銘柄コード
optional string name = 3; //銘柄名称
repeated VolatilityItem volatilityList = 4; //ボラティリティデータリスト、取引日降順
optional bytes nextPageKey = 5; //ページングリクエストのキー
}
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3304
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_GetOptionUnderlyingHisVolatility::Request req;
Qot_GetOptionUnderlyingHisVolatility::C2S *c2s = req.mutable_c2s();
// TODO: 按 proto 填充 c2s 字段
m_GetOptionUnderlyingHisVolatilitySerialNo = m_pQotApi->GetOptionUnderlyingHisVolatility(req);
}
virtual void OnReply_GetOptionUnderlyingHisVolatility(Moomoo::u32_t nSerialNo, const Qot_GetOptionUnderlyingHisVolatility::Response &stRsp) {
if (nSerialNo != m_GetOptionUnderlyingHisVolatilitySerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
MMAPI_Qot *m_pQotApi;
Moomoo::u32_t m_GetOptionUnderlyingHisVolatilitySerialNo = 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
getOptionUnderlyingHisVolatility(qotGetOptionUnderlyingHisVolatility)
説明
オプション原資産のヒストリカルボラティリティデータを取得
パラメータ
message C2S
{
required Qot_Common.Security owner = 1; //オプション原資産
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType
required string beginTime = 3; //開始時間文字列
required string endTime = 4; //終了時間文字列
optional bytes nextPageKey = 5; //ページングリクエストのキー
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 戻り値
message VolatilityItem
{
required string time = 1; //取引日時間文字列
optional double timestamp = 2; //取引日タイムスタンプ
optional double iv = 3; //インプライドボラティリティ(パーセント)
optional double hv = 4; //ヒストリカルボラティリティ(パーセント)
optional double underlyingPrice = 5; //原資産終値
}
message S2C
{
required Qot_Common.Security owner = 1; //オプション原資産
optional string code = 2; //銘柄コード
optional string name = 3; //銘柄名称
repeated VolatilityItem volatilityList = 4; //ボラティリティデータリスト、取引日降順
optional bytes nextPageKey = 5; //ページングリクエストのキー
}
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3304
Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_Common } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetOptionUnderlyingHisVolatility(){
const { RetType } = Common
const { QotMarket } = Qot_Common
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: {
owner: { market: QotMarket.QotMarket_US_Security, code: 'AAPL' },
beginTime: '2026-06-01',
endTime: '2026-06-15',
},
};
websocket.GetOptionUnderlyingHisVolatility(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetOptionUnderlyingHisVolatility: 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);
}
QotGetOptionUnderlyingHisVolatility()
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
- Output
GetOptionUnderlyingHisVolatility: errCode 0, retMsg , retType 0
{
"owner": { "market": 1, "code": "AAPL" },
"code": "US.AAPL",
"name": "Apple",
"volatilityList": [
{ "time": "2026-06-12", "timestamp": 1781237000, "iv": 25.126, "hv": 23.324, "underlyingPrice": 291.13 },
{ "time": "2026-06-11", "timestamp": 1781150000, "iv": 25.617, "hv": 23.27, "underlyingPrice": 295.63 },
{ "time": "2026-06-10", "timestamp": 1781064000, "iv": 27.384, "hv": 22.892, "underlyingPrice": 291.58 },
{ "time": "2026-06-09", "timestamp": 1780978000, "iv": 27.237, "hv": 22.854, "underlyingPrice": 290.55 },
{ "time": "2026-06-08", "timestamp": 1780891000, "iv": 26.368, "hv": 19.028, "underlyingPrice": 301.54 }
]
}
2
3
4
5
6
7
8
9
10
11
12
13
インターフェース制限
- 30秒以内に最大60回のオプション原資産履歴ボラティリティインターフェースリクエスト(ページング対応のインターフェースは初回呼び出しのみカウント)