# オプション原資産概要
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_option_underlying_overview(code_list, index_option_type=IndexOptionType.NORMAL)
説明
オプション原資産の概要データを一括取得します。出来高、建玉、インプライドボラティリティ(IV)および複数期間のヒストリカルボラティリティ(HV)等のコア指標の最新スナップショットを含みます。
パラメータ
パラメータ 型 説明 code_list list[str] 原資産銘柄コードリスト 例:['US.AAPL', 'US.TSLA']、最大 500 個index_option_type IndexOptionType 指数オプションタイプ NORMAL=通常オプション(デフォルト)、SMALL=ミニ指数オプション、ハンセン/国企指数のみ必要戻り値
パラメータ 型 説明 ret RET_CODE インターフェース呼び出し結果 data pandas.DataFrame ret == RET_OK の場合、原資産概要データを返す str ret != RET_OK の場合、エラー説明を返す 戻り DataFrame フィールド:
フィールド 型 説明 code str 銘柄コード name str 原資産名称 call_volume int コールオプション出来高 put_volume int プットオプション出来高 call_open_interest int コールオプション建玉(T-1 遅延) put_open_interest int プットオプション建玉(T-1 遅延) iv float インプライドボラティリティ(パーセント) iv_rank float IV ランクパーセンタイル(パーセント) iv_percentile float IV パーセンタイル(パーセント) pre_iv float 前取引日 IV(パーセント) hv_30d float 30日ヒストリカルボラティリティ(パーセント) hv_30d_percentile float 30日 HV パーセンタイル hv_60d float 60日ヒストリカルボラティリティ(パーセント) hv_60d_percentile float 60日 HV パーセンタイル hv_90d float 90日ヒストリカルボラティリティ(パーセント) hv_90d_percentile float 90日 HV パーセンタイル hv_120d float 120日ヒストリカルボラティリティ(パーセント) hv_120d_percentile float 120日 HV パーセンタイル hv_365d float 365日ヒストリカルボラティリティ(パーセント) hv_365d_percentile float 365日 HV パーセンタイル
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_option_underlying_overview(['US.AAPL', 'US.TSLA', 'US.NVDA'])
if ret == RET_OK:
print(data)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
- Output
code name call_volume put_volume call_open_interest put_open_interest iv iv_rank iv_percentile pre_iv hv_30d hv_30d_percentile hv_60d hv_60d_percentile hv_90d hv_90d_percentile hv_120d hv_120d_percentile hv_365d hv_365d_percentile
0 US.AAPL Apple 782941 490299 3165108 2237950 25.126 37.702 19.841 25.617 23.324 59.126 24.641 65.476 23.019 46.825 23.582 47.619 22.619 8.333
1 US.TSLA Tesla 2197764 1425740 4178685 2909774 55.053 39.265 64.285 55.401 49.359 68.254 46.536 58.730 44.990 46.031 41.688 29.761 44.500 1.190
2 US.NVDA NVIDIA 1980405 1176926 9096278 7648683 41.975 27.062 42.460 45.135 45.921 96.825 42.646 99.206 39.980 92.460 38.971 81.746 34.989 17.063
2
3
4
# Qot_GetOptionUnderlyingOverview.proto
説明
オプション原資産概要データを取得
パラメータ
message C2S
{
repeated Qot_Common.Security ownerList = 1; //オプション原資産リスト、最大500個
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType、指数オプションのタイプ、ハンセン/国企指数のみ使用
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
- 戻り値
message HVItem
{
required int32 timeRange = 1; //Qot_OptionCommon.OptionHVTimeRange、HV時間範囲
required double hv = 2; //ヒストリカルボラティリティ(パーセント)
optional double hvPercentile = 3; //HVパーセンタイル(パーセント)
}
message UnderlyingData
{
required Qot_Common.Security owner = 1; //オプション原資産
optional string code = 2; //銘柄コード
optional string name = 3; //原資産名称
optional int64 callVolume = 4; //コールオプション出来高
optional int64 putVolume = 5; //プットオプション出来高
optional int64 callOpenInterest = 6; //コールオプション建玉(T-1遅延)
optional int64 putOpenInterest = 7; //プットオプション建玉(T-1遅延)
optional double iv = 8; //インプライドボラティリティ(パーセント)
optional double ivRank = 9; //IVランクパーセンタイル(パーセント)
optional double ivPercentile = 10; //IVパーセンタイル(パーセント)
repeated HVItem hvList = 11; //ヒストリカルボラティリティリスト(複数時間範囲)
optional double preIV = 12; //前取引日IV(パーセント)
}
message S2C
{
repeated UnderlyingData underlyingDataList = 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
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3303
uint GetOptionUnderlyingOverview(Qot_GetOptionUnderlyingOverview.Request req); virtual void OnReply_GetOptionUnderlyingOverview(FTAPI_Conn client, uint nSerialNo, Qot_GetOptionUnderlyingOverview.Response rsp);
説明
オプション原資産概要データを取得
パラメータ
message C2S
{
repeated Qot_Common.Security ownerList = 1; //オプション原資産リスト、最大500個
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType、指数オプションのタイプ、ハンセン/国企指数のみ使用
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
- 戻り値
message HVItem
{
required int32 timeRange = 1; //Qot_OptionCommon.OptionHVTimeRange、HV時間範囲
required double hv = 2; //ヒストリカルボラティリティ(パーセント)
optional double hvPercentile = 3; //HVパーセンタイル(パーセント)
}
message UnderlyingData
{
required Qot_Common.Security owner = 1; //オプション原資産
optional string code = 2; //銘柄コード
optional string name = 3; //原資産名称
optional int64 callVolume = 4; //コールオプション出来高
optional int64 putVolume = 5; //プットオプション出来高
optional int64 callOpenInterest = 6; //コールオプション建玉(T-1遅延)
optional int64 putOpenInterest = 7; //プットオプション建玉(T-1遅延)
optional double iv = 8; //インプライドボラティリティ(パーセント)
optional double ivRank = 9; //IVランクパーセンタイル(パーセント)
optional double ivPercentile = 10; //IVパーセンタイル(パーセント)
repeated HVItem hvList = 11; //ヒストリカルボラティリティリスト(複数時間範囲)
optional double preIV = 12; //前取引日IV(パーセント)
}
message S2C
{
repeated UnderlyingData underlyingDataList = 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
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3303
int getOptionUnderlyingOverview(Qot_GetOptionUnderlyingOverview.Request req) onReply_GetOptionUnderlyingOverview(FTAPI_Conn client, int nSerialNo, Qot_GetOptionUnderlyingOverview.Response rsp)
説明
オプション原資産概要データを取得
パラメータ
message C2S
{
repeated Qot_Common.Security ownerList = 1; //オプション原資産リスト、最大500個
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType、指数オプションのタイプ、ハンセン/国企指数のみ使用
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
- 戻り値
message HVItem
{
required int32 timeRange = 1; //Qot_OptionCommon.OptionHVTimeRange、HV時間範囲
required double hv = 2; //ヒストリカルボラティリティ(パーセント)
optional double hvPercentile = 3; //HVパーセンタイル(パーセント)
}
message UnderlyingData
{
required Qot_Common.Security owner = 1; //オプション原資産
optional string code = 2; //銘柄コード
optional string name = 3; //原資産名称
optional int64 callVolume = 4; //コールオプション出来高
optional int64 putVolume = 5; //プットオプション出来高
optional int64 callOpenInterest = 6; //コールオプション建玉(T-1遅延)
optional int64 putOpenInterest = 7; //プットオプション建玉(T-1遅延)
optional double iv = 8; //インプライドボラティリティ(パーセント)
optional double ivRank = 9; //IVランクパーセンタイル(パーセント)
optional double ivPercentile = 10; //IVパーセンタイル(パーセント)
repeated HVItem hvList = 11; //ヒストリカルボラティリティリスト(複数時間範囲)
optional double preIV = 12; //前取引日IV(パーセント)
}
message S2C
{
repeated UnderlyingData underlyingDataList = 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
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3303
Futu::u32_t GetOptionUnderlyingOverview(const Qot_GetOptionUnderlyingOverview::Request &stReq);
virtual void OnReply_GetOptionUnderlyingOverview(Futu::u32_t nSerialNo, const Qot_GetOptionUnderlyingOverview::Response &stRsp) = 0;
説明
オプション原資産概要データを取得
パラメータ
message C2S
{
repeated Qot_Common.Security ownerList = 1; //オプション原資産リスト、最大500個
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType、指数オプションのタイプ、ハンセン/国企指数のみ使用
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
- 戻り値
message HVItem
{
required int32 timeRange = 1; //Qot_OptionCommon.OptionHVTimeRange、HV時間範囲
required double hv = 2; //ヒストリカルボラティリティ(パーセント)
optional double hvPercentile = 3; //HVパーセンタイル(パーセント)
}
message UnderlyingData
{
required Qot_Common.Security owner = 1; //オプション原資産
optional string code = 2; //銘柄コード
optional string name = 3; //原資産名称
optional int64 callVolume = 4; //コールオプション出来高
optional int64 putVolume = 5; //プットオプション出来高
optional int64 callOpenInterest = 6; //コールオプション建玉(T-1遅延)
optional int64 putOpenInterest = 7; //プットオプション建玉(T-1遅延)
optional double iv = 8; //インプライドボラティリティ(パーセント)
optional double ivRank = 9; //IVランクパーセンタイル(パーセント)
optional double ivPercentile = 10; //IVパーセンタイル(パーセント)
repeated HVItem hvList = 11; //ヒストリカルボラティリティリスト(複数時間範囲)
optional double preIV = 12; //前取引日IV(パーセント)
}
message S2C
{
repeated UnderlyingData underlyingDataList = 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
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3303
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_GetOptionUnderlyingOverview::Request req;
Qot_GetOptionUnderlyingOverview::C2S *c2s = req.mutable_c2s();
// TODO: 按 proto 填充 c2s 字段
m_GetOptionUnderlyingOverviewSerialNo = m_pQotApi->GetOptionUnderlyingOverview(req);
}
virtual void OnReply_GetOptionUnderlyingOverview(Futu::u32_t nSerialNo, const Qot_GetOptionUnderlyingOverview::Response &stRsp) {
if (nSerialNo != m_GetOptionUnderlyingOverviewSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
FTAPI_Qot *m_pQotApi;
Futu::u32_t m_GetOptionUnderlyingOverviewSerialNo = 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
getOptionUnderlyingOverview(qotGetOptionUnderlyingOverview)
説明
オプション原資産概要データを取得
パラメータ
message C2S
{
repeated Qot_Common.Security ownerList = 1; //オプション原資産リスト、最大500個
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType、指数オプションのタイプ、ハンセン/国企指数のみ使用
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
- 戻り値
message HVItem
{
required int32 timeRange = 1; //Qot_OptionCommon.OptionHVTimeRange、HV時間範囲
required double hv = 2; //ヒストリカルボラティリティ(パーセント)
optional double hvPercentile = 3; //HVパーセンタイル(パーセント)
}
message UnderlyingData
{
required Qot_Common.Security owner = 1; //オプション原資産
optional string code = 2; //銘柄コード
optional string name = 3; //原資産名称
optional int64 callVolume = 4; //コールオプション出来高
optional int64 putVolume = 5; //プットオプション出来高
optional int64 callOpenInterest = 6; //コールオプション建玉(T-1遅延)
optional int64 putOpenInterest = 7; //プットオプション建玉(T-1遅延)
optional double iv = 8; //インプライドボラティリティ(パーセント)
optional double ivRank = 9; //IVランクパーセンタイル(パーセント)
optional double ivPercentile = 10; //IVパーセンタイル(パーセント)
repeated HVItem hvList = 11; //ヒストリカルボラティリティリスト(複数時間範囲)
optional double preIV = 12; //前取引日IV(パーセント)
}
message S2C
{
repeated UnderlyingData underlyingDataList = 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
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3303
Example
import ftWebsocket from "futu-api";
import { Common, Qot_Common } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetOptionUnderlyingOverview(){
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: {
ownerList: [
{ market: QotMarket.QotMarket_US_Security, code: 'AAPL' },
{ market: QotMarket.QotMarket_US_Security, code: 'TSLA' },
],
},
};
websocket.GetOptionUnderlyingOverview(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetOptionUnderlyingOverview: 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);
}
QotGetOptionUnderlyingOverview()
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
GetOptionUnderlyingOverview: errCode 0, retMsg , retType 0
{
"underlyingDataList": [
{
"owner": { "market": 1, "code": "AAPL" },
"code": "US.AAPL",
"name": "Apple",
"callVolume": 782941,
"putVolume": 490299,
"callOpenInterest": 3165108,
"putOpenInterest": 2237950,
"iv": 25.126,
"ivRank": 37.702,
"ivPercentile": 19.841,
"hvList": [
{ "timeRange": 1, "hv": 23.324, "hvPercentile": 59.126 },
{ "timeRange": 2, "hv": 24.641, "hvPercentile": 65.476 },
{ "timeRange": 3, "hv": 23.019, "hvPercentile": 46.825 }
],
"preIV": 25.617
},
{
"owner": { "market": 1, "code": "TSLA" },
"code": "US.TSLA",
"name": "Tesla",
"callVolume": 2197764,
"putVolume": 1425740,
"callOpenInterest": 4178685,
"putOpenInterest": 2909774,
"iv": 55.053,
"ivRank": 39.265,
"ivPercentile": 64.285,
"hvList": [
{ "timeRange": 1, "hv": 49.359, "hvPercentile": 68.254 },
{ "timeRange": 2, "hv": 46.536, "hvPercentile": 58.73 },
{ "timeRange": 3, "hv": 44.99, "hvPercentile": 46.031 }
],
"preIV": 55.401
}
]
}
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
インターフェース制限
- 30秒以内に最大60回のオプション原資産概要インターフェースリクエスト
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_option_underlying_overview(code_list, index_option_type=IndexOptionType.NORMAL)
説明
オプション原資産の概要データを一括取得します。出来高、建玉、インプライドボラティリティ(IV)および複数期間のヒストリカルボラティリティ(HV)等のコア指標の最新スナップショットを含みます。
パラメータ
パラメータ 型 説明 code_list list[str] 原資産銘柄コードリスト 例:['US.AAPL', 'US.TSLA']、最大 500 個index_option_type IndexOptionType 指数オプションタイプ NORMAL=通常オプション(デフォルト)、SMALL=ミニ指数オプション、ハンセン/国企指数のみ必要戻り値
パラメータ 型 説明 ret RET_CODE インターフェース呼び出し結果 data pandas.DataFrame ret == RET_OK の場合、原資産概要データを返す str ret != RET_OK の場合、エラー説明を返す 戻り DataFrame フィールド:
フィールド 型 説明 code str 銘柄コード name str 原資産名称 call_volume int コールオプション出来高 put_volume int プットオプション出来高 call_open_interest int コールオプション建玉(T-1 遅延) put_open_interest int プットオプション建玉(T-1 遅延) iv float インプライドボラティリティ(パーセント) iv_rank float IV ランクパーセンタイル(パーセント) iv_percentile float IV パーセンタイル(パーセント) pre_iv float 前取引日 IV(パーセント) hv_30d float 30日ヒストリカルボラティリティ(パーセント) hv_30d_percentile float 30日 HV パーセンタイル hv_60d float 60日ヒストリカルボラティリティ(パーセント) hv_60d_percentile float 60日 HV パーセンタイル hv_90d float 90日ヒストリカルボラティリティ(パーセント) hv_90d_percentile float 90日 HV パーセンタイル hv_120d float 120日ヒストリカルボラティリティ(パーセント) hv_120d_percentile float 120日 HV パーセンタイル hv_365d float 365日ヒストリカルボラティリティ(パーセント) hv_365d_percentile float 365日 HV パーセンタイル
Example
from moomoo import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_option_underlying_overview(['US.AAPL', 'US.TSLA', 'US.NVDA'])
if ret == RET_OK:
print(data)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
- Output
code name call_volume put_volume call_open_interest put_open_interest iv iv_rank iv_percentile pre_iv hv_30d hv_30d_percentile hv_60d hv_60d_percentile hv_90d hv_90d_percentile hv_120d hv_120d_percentile hv_365d hv_365d_percentile
0 US.AAPL Apple 782941 490299 3165108 2237950 25.126 37.702 19.841 25.617 23.324 59.126 24.641 65.476 23.019 46.825 23.582 47.619 22.619 8.333
1 US.TSLA Tesla 2197764 1425740 4178685 2909774 55.053 39.265 64.285 55.401 49.359 68.254 46.536 58.730 44.990 46.031 41.688 29.761 44.500 1.190
2 US.NVDA NVIDIA 1980405 1176926 9096278 7648683 41.975 27.062 42.460 45.135 45.921 96.825 42.646 99.206 39.980 92.460 38.971 81.746 34.989 17.063
2
3
4
# Qot_GetOptionUnderlyingOverview.proto
説明
オプション原資産概要データを取得
パラメータ
message C2S
{
repeated Qot_Common.Security ownerList = 1; //オプション原資産リスト、最大500個
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType、指数オプションのタイプ、ハンセン/国企指数のみ使用
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
- 戻り値
message HVItem
{
required int32 timeRange = 1; //Qot_OptionCommon.OptionHVTimeRange、HV時間範囲
required double hv = 2; //ヒストリカルボラティリティ(パーセント)
optional double hvPercentile = 3; //HVパーセンタイル(パーセント)
}
message UnderlyingData
{
required Qot_Common.Security owner = 1; //オプション原資産
optional string code = 2; //銘柄コード
optional string name = 3; //原資産名称
optional int64 callVolume = 4; //コールオプション出来高
optional int64 putVolume = 5; //プットオプション出来高
optional int64 callOpenInterest = 6; //コールオプション建玉(T-1遅延)
optional int64 putOpenInterest = 7; //プットオプション建玉(T-1遅延)
optional double iv = 8; //インプライドボラティリティ(パーセント)
optional double ivRank = 9; //IVランクパーセンタイル(パーセント)
optional double ivPercentile = 10; //IVパーセンタイル(パーセント)
repeated HVItem hvList = 11; //ヒストリカルボラティリティリスト(複数時間範囲)
optional double preIV = 12; //前取引日IV(パーセント)
}
message S2C
{
repeated UnderlyingData underlyingDataList = 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
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3303
uint GetOptionUnderlyingOverview(Qot_GetOptionUnderlyingOverview.Request req); virtual void OnReply_GetOptionUnderlyingOverview(MMAPI_Conn client, uint nSerialNo, Qot_GetOptionUnderlyingOverview.Response rsp);
説明
オプション原資産概要データを取得
パラメータ
message C2S
{
repeated Qot_Common.Security ownerList = 1; //オプション原資産リスト、最大500個
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType、指数オプションのタイプ、ハンセン/国企指数のみ使用
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
- 戻り値
message HVItem
{
required int32 timeRange = 1; //Qot_OptionCommon.OptionHVTimeRange、HV時間範囲
required double hv = 2; //ヒストリカルボラティリティ(パーセント)
optional double hvPercentile = 3; //HVパーセンタイル(パーセント)
}
message UnderlyingData
{
required Qot_Common.Security owner = 1; //オプション原資産
optional string code = 2; //銘柄コード
optional string name = 3; //原資産名称
optional int64 callVolume = 4; //コールオプション出来高
optional int64 putVolume = 5; //プットオプション出来高
optional int64 callOpenInterest = 6; //コールオプション建玉(T-1遅延)
optional int64 putOpenInterest = 7; //プットオプション建玉(T-1遅延)
optional double iv = 8; //インプライドボラティリティ(パーセント)
optional double ivRank = 9; //IVランクパーセンタイル(パーセント)
optional double ivPercentile = 10; //IVパーセンタイル(パーセント)
repeated HVItem hvList = 11; //ヒストリカルボラティリティリスト(複数時間範囲)
optional double preIV = 12; //前取引日IV(パーセント)
}
message S2C
{
repeated UnderlyingData underlyingDataList = 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
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3303
int getOptionUnderlyingOverview(Qot_GetOptionUnderlyingOverview.Request req) onReply_GetOptionUnderlyingOverview(MMAPI_Conn client, int nSerialNo, Qot_GetOptionUnderlyingOverview.Response rsp)
説明
オプション原資産概要データを取得
パラメータ
message C2S
{
repeated Qot_Common.Security ownerList = 1; //オプション原資産リスト、最大500個
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType、指数オプションのタイプ、ハンセン/国企指数のみ使用
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
- 戻り値
message HVItem
{
required int32 timeRange = 1; //Qot_OptionCommon.OptionHVTimeRange、HV時間範囲
required double hv = 2; //ヒストリカルボラティリティ(パーセント)
optional double hvPercentile = 3; //HVパーセンタイル(パーセント)
}
message UnderlyingData
{
required Qot_Common.Security owner = 1; //オプション原資産
optional string code = 2; //銘柄コード
optional string name = 3; //原資産名称
optional int64 callVolume = 4; //コールオプション出来高
optional int64 putVolume = 5; //プットオプション出来高
optional int64 callOpenInterest = 6; //コールオプション建玉(T-1遅延)
optional int64 putOpenInterest = 7; //プットオプション建玉(T-1遅延)
optional double iv = 8; //インプライドボラティリティ(パーセント)
optional double ivRank = 9; //IVランクパーセンタイル(パーセント)
optional double ivPercentile = 10; //IVパーセンタイル(パーセント)
repeated HVItem hvList = 11; //ヒストリカルボラティリティリスト(複数時間範囲)
optional double preIV = 12; //前取引日IV(パーセント)
}
message S2C
{
repeated UnderlyingData underlyingDataList = 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
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3303
Moomoo::u32_t GetOptionUnderlyingOverview(const Qot_GetOptionUnderlyingOverview::Request &stReq);
virtual void OnReply_GetOptionUnderlyingOverview(Moomoo::u32_t nSerialNo, const Qot_GetOptionUnderlyingOverview::Response &stRsp) = 0;
説明
オプション原資産概要データを取得
パラメータ
message C2S
{
repeated Qot_Common.Security ownerList = 1; //オプション原資産リスト、最大500個
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType、指数オプションのタイプ、ハンセン/国企指数のみ使用
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
- 戻り値
message HVItem
{
required int32 timeRange = 1; //Qot_OptionCommon.OptionHVTimeRange、HV時間範囲
required double hv = 2; //ヒストリカルボラティリティ(パーセント)
optional double hvPercentile = 3; //HVパーセンタイル(パーセント)
}
message UnderlyingData
{
required Qot_Common.Security owner = 1; //オプション原資産
optional string code = 2; //銘柄コード
optional string name = 3; //原資産名称
optional int64 callVolume = 4; //コールオプション出来高
optional int64 putVolume = 5; //プットオプション出来高
optional int64 callOpenInterest = 6; //コールオプション建玉(T-1遅延)
optional int64 putOpenInterest = 7; //プットオプション建玉(T-1遅延)
optional double iv = 8; //インプライドボラティリティ(パーセント)
optional double ivRank = 9; //IVランクパーセンタイル(パーセント)
optional double ivPercentile = 10; //IVパーセンタイル(パーセント)
repeated HVItem hvList = 11; //ヒストリカルボラティリティリスト(複数時間範囲)
optional double preIV = 12; //前取引日IV(パーセント)
}
message S2C
{
repeated UnderlyingData underlyingDataList = 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
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3303
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_GetOptionUnderlyingOverview::Request req;
Qot_GetOptionUnderlyingOverview::C2S *c2s = req.mutable_c2s();
// TODO: 按 proto 填充 c2s 字段
m_GetOptionUnderlyingOverviewSerialNo = m_pQotApi->GetOptionUnderlyingOverview(req);
}
virtual void OnReply_GetOptionUnderlyingOverview(Moomoo::u32_t nSerialNo, const Qot_GetOptionUnderlyingOverview::Response &stRsp) {
if (nSerialNo != m_GetOptionUnderlyingOverviewSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
MMAPI_Qot *m_pQotApi;
Moomoo::u32_t m_GetOptionUnderlyingOverviewSerialNo = 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
getOptionUnderlyingOverview(qotGetOptionUnderlyingOverview)
説明
オプション原資産概要データを取得
パラメータ
message C2S
{
repeated Qot_Common.Security ownerList = 1; //オプション原資産リスト、最大500個
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType、指数オプションのタイプ、ハンセン/国企指数のみ使用
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
- 戻り値
message HVItem
{
required int32 timeRange = 1; //Qot_OptionCommon.OptionHVTimeRange、HV時間範囲
required double hv = 2; //ヒストリカルボラティリティ(パーセント)
optional double hvPercentile = 3; //HVパーセンタイル(パーセント)
}
message UnderlyingData
{
required Qot_Common.Security owner = 1; //オプション原資産
optional string code = 2; //銘柄コード
optional string name = 3; //原資産名称
optional int64 callVolume = 4; //コールオプション出来高
optional int64 putVolume = 5; //プットオプション出来高
optional int64 callOpenInterest = 6; //コールオプション建玉(T-1遅延)
optional int64 putOpenInterest = 7; //プットオプション建玉(T-1遅延)
optional double iv = 8; //インプライドボラティリティ(パーセント)
optional double ivRank = 9; //IVランクパーセンタイル(パーセント)
optional double ivPercentile = 10; //IVパーセンタイル(パーセント)
repeated HVItem hvList = 11; //ヒストリカルボラティリティリスト(複数時間範囲)
optional double preIV = 12; //前取引日IV(パーセント)
}
message S2C
{
repeated UnderlyingData underlyingDataList = 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
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3303
Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_Common } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetOptionUnderlyingOverview(){
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: {
ownerList: [
{ market: QotMarket.QotMarket_US_Security, code: 'AAPL' },
{ market: QotMarket.QotMarket_US_Security, code: 'TSLA' },
],
},
};
websocket.GetOptionUnderlyingOverview(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetOptionUnderlyingOverview: 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);
}
QotGetOptionUnderlyingOverview()
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
GetOptionUnderlyingOverview: errCode 0, retMsg , retType 0
{
"underlyingDataList": [
{
"owner": { "market": 1, "code": "AAPL" },
"code": "US.AAPL",
"name": "Apple",
"callVolume": 782941,
"putVolume": 490299,
"callOpenInterest": 3165108,
"putOpenInterest": 2237950,
"iv": 25.126,
"ivRank": 37.702,
"ivPercentile": 19.841,
"hvList": [
{ "timeRange": 1, "hv": 23.324, "hvPercentile": 59.126 },
{ "timeRange": 2, "hv": 24.641, "hvPercentile": 65.476 },
{ "timeRange": 3, "hv": 23.019, "hvPercentile": 46.825 }
],
"preIV": 25.617
},
{
"owner": { "market": 1, "code": "TSLA" },
"code": "US.TSLA",
"name": "Tesla",
"callVolume": 2197764,
"putVolume": 1425740,
"callOpenInterest": 4178685,
"putOpenInterest": 2909774,
"iv": 55.053,
"ivRank": 39.265,
"ivPercentile": 64.285,
"hvList": [
{ "timeRange": 1, "hv": 49.359, "hvPercentile": 68.254 },
{ "timeRange": 2, "hv": 46.536, "hvPercentile": 58.73 },
{ "timeRange": 3, "hv": 44.99, "hvPercentile": 46.031 }
],
"preIV": 55.401
}
]
}
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
インターフェース制限
- 30秒以内に最大60回のオプション原資産概要インターフェースリクエスト