# オプション原資産ランキング
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_option_underlying_rank(option_market, sort_type, sort_direction=None, count=None, trading_date=None, filter_list=None, page=None)
説明
オプション人気原資産ランキングを取得します。指定された次元でオプション原資産(株式/ETF/指数)をランク付けし、多次元フィルタリングとページネーションに対応しています。
パラメータ
パラメータ 型 説明 option_market OptionMarket オプション市場タイプ US_SECURITY=米国株式オプション、US_INDEX=米国指数オプション、HK_SECURITY=香港株式オプション、HK_INDEX=香港指数オプションsort_type UnderlyingRankSortType ソートフィールド VOLUME=総出来高、VOLUME_RATIO=Put/Call出来高比値、OPEN_INTEREST=総建玉、OPEN_INTEREST_RATIO=Put/Call建玉比値、PRICE=最新価格、PRICE_CHANGE=騰落率、IV=IV、IV_CHANGE=IV変化率、HV=HV、HV_CHANGE=HV変化率、IV_RANK=IV Rank、IV_PERCENTILE=IV Percentile、MARKET_CAP=時価総額sort_direction int ソート方向 0=降順(デフォルト)、1=昇順count int ページあたりの数量 範囲 [1,200]、デフォルト 200trading_date str 取引日 フォーマット yyyy-MM-dd、未指定の場合は最新ランキングを返すfilter_list list[UnderlyingRankFilter] フィルタ条件リスト 複数条件は AND 関係page str ページングカーソル 初回リクエストは None を渡す、ページングは前回返却の next_page を渡す戻り値
パラメータ 型 説明 ret RET_CODE インターフェース呼び出し結果 data pandas.DataFrame ret == RET_OK の場合、ランキングデータを返す str ret != RET_OK の場合、エラー説明を返す next_page str 次ページカーソル文字列、None は次ページなし all_count int 条件に合致する総データ数 data DataFrame フィールド:
フィールド 型 説明 code str 原資産銘柄コード name str 原資産名称 total_volume int オプション総出来高 total_open_interest int オプション総建玉 volume_ratio float Put/Call 出来高比率(パーセント) open_interest_ratio float Put/Call 建玉比率(パーセント) iv float インプライドボラティリティ(パーセント) iv_rank float IV ランクパーセンタイル(パーセント) iv_percentile float IV パーセンタイル(パーセント) price float 原資産最新価格 change_ratio float 原資産騰落率(小数) iv_change float IV 変化率(パーセント) hv float ヒストリカルボラティリティ(パーセント) hv_change float HV 変化率(パーセント) market_cap float 時価総額 trading_date str ランキングデータ対応取引日 trading_timestamp float ランキングデータ対応取引日タイムスタンプ(Unix 秒)
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data, next_page, all_count = quote_ctx.get_option_underlying_rank(
option_market=OptionMarket.US_SECURITY,
sort_type=UnderlyingRankSortType.VOLUME,
count=5
)
if ret == RET_OK:
print(data)
print('all_count:', all_count)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
- Output
code name total_volume total_open_interest volume_ratio open_interest_ratio iv iv_rank iv_percentile price change_ratio iv_change hv hv_change market_cap trading_date trading_timestamp
0 US.SPY 标普500ETF-SPDR 14228830 19909256 0.97899 1.93868 17.675 27.143 61.111 741.75 0.540826 -8.261 15.031 -0.057 7.814945e+11 2026-06-12 1.781237e+09
1 US.QQQ 纳指100ETF-Invesco QQQ Trust 8239190 12964422 0.99417 1.49888 27.652 62.918 91.269 721.34 0.588465 -8.332 26.196 -0.644 4.765533e+11 2026-06-12 1.781237e+09
2 US.TSLA 特斯拉 3623504 7088459 0.64872 0.69633 55.053 39.265 64.285 406.43 1.823876 -0.629 49.359 -1.194 1.526439e+12 2026-06-12 1.781237e+09
3 US.NVDA 英伟达 3157331 16744961 0.59428 0.84085 41.975 27.062 42.460 205.19 0.156197 -7.002 45.921 -1.972 4.965598e+12 2026-06-12 1.781237e+09
4 US.IWM 罗素2000ETF-iShares 2840729 11791964 0.79034 2.78276 24.857 33.930 64.285 292.95 0.874626 -6.744 24.802 0.522 8.061984e+10 2026-06-12 1.781237e+09
all_count: 6017
2
3
4
5
6
7
# Qot_GetOptionUnderlyingRank.proto
説明
オプション原資産ランキングリストを取得
パラメータ
message C2S
{
required int32 optionMarket = 1; //コーポレートアクションタイプ
required int32 sortType = 2; //Qot_OptionCommon.UnderlyingRankSortType
optional bool isAsc = 3; //昇順かどうか、デフォルトfalse
optional int32 count = 4; //ページあたりの数量[1,200]、デフォルト200
optional string tradingDate = 5; //取引日、フォーマットyyyy-MM-dd
repeated Qot_OptionCommon.UnderlyingRankIndicator filterList = 6;
optional string page = 7; //ページングカーソル
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- 戻り値
message UnderlyingRankItem
{
required Qot_Common.Security owner = 1;
optional string name = 2;
optional int64 totalVolume = 3;
optional int64 totalOpenInterest = 4;
optional double volumeRatio = 5;
optional double openInterestRatio = 6;
optional double iv = 7;
optional double ivRank = 8;
optional double ivPercentile = 9;
optional double price = 10;
optional double changeRate = 11;
optional double ivChange = 12;
optional double hv = 13;
optional double hvChange = 14;
optional double marketCap = 15;
}
message S2C
{
required int32 optionMarket = 1;
required int32 sortType = 2;
optional string tradingDate = 3;
optional double tradingTimestamp = 4;
repeated UnderlyingRankItem rankList = 5;
optional string nextPage = 6;
optional int32 allCount = 7;
}
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
36
37
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3305
uint GetOptionUnderlyingRank(Qot_GetOptionUnderlyingRank.Request req); virtual void OnReply_GetOptionUnderlyingRank(FTAPI_Conn client, uint nSerialNo, Qot_GetOptionUnderlyingRank.Response rsp);
説明
オプション原資産ランキングリストを取得
パラメータ
message C2S
{
required int32 optionMarket = 1; //コーポレートアクションタイプ
required int32 sortType = 2; //Qot_OptionCommon.UnderlyingRankSortType
optional bool isAsc = 3; //昇順かどうか、デフォルトfalse
optional int32 count = 4; //ページあたりの数量[1,200]、デフォルト200
optional string tradingDate = 5; //取引日、フォーマットyyyy-MM-dd
repeated Qot_OptionCommon.UnderlyingRankIndicator filterList = 6;
optional string page = 7; //ページングカーソル
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- 戻り値
message UnderlyingRankItem
{
required Qot_Common.Security owner = 1;
optional string name = 2;
optional int64 totalVolume = 3;
optional int64 totalOpenInterest = 4;
optional double volumeRatio = 5;
optional double openInterestRatio = 6;
optional double iv = 7;
optional double ivRank = 8;
optional double ivPercentile = 9;
optional double price = 10;
optional double changeRate = 11;
optional double ivChange = 12;
optional double hv = 13;
optional double hvChange = 14;
optional double marketCap = 15;
}
message S2C
{
required int32 optionMarket = 1;
required int32 sortType = 2;
optional string tradingDate = 3;
optional double tradingTimestamp = 4;
repeated UnderlyingRankItem rankList = 5;
optional string nextPage = 6;
optional int32 allCount = 7;
}
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
36
37
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3305
int getOptionUnderlyingRank(Qot_GetOptionUnderlyingRank.Request req) onReply_GetOptionUnderlyingRank(FTAPI_Conn client, int nSerialNo, Qot_GetOptionUnderlyingRank.Response rsp)
説明
オプション原資産ランキングリストを取得
パラメータ
message C2S
{
required int32 optionMarket = 1; //コーポレートアクションタイプ
required int32 sortType = 2; //Qot_OptionCommon.UnderlyingRankSortType
optional bool isAsc = 3; //昇順かどうか、デフォルトfalse
optional int32 count = 4; //ページあたりの数量[1,200]、デフォルト200
optional string tradingDate = 5; //取引日、フォーマットyyyy-MM-dd
repeated Qot_OptionCommon.UnderlyingRankIndicator filterList = 6;
optional string page = 7; //ページングカーソル
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- 戻り値
message UnderlyingRankItem
{
required Qot_Common.Security owner = 1;
optional string name = 2;
optional int64 totalVolume = 3;
optional int64 totalOpenInterest = 4;
optional double volumeRatio = 5;
optional double openInterestRatio = 6;
optional double iv = 7;
optional double ivRank = 8;
optional double ivPercentile = 9;
optional double price = 10;
optional double changeRate = 11;
optional double ivChange = 12;
optional double hv = 13;
optional double hvChange = 14;
optional double marketCap = 15;
}
message S2C
{
required int32 optionMarket = 1;
required int32 sortType = 2;
optional string tradingDate = 3;
optional double tradingTimestamp = 4;
repeated UnderlyingRankItem rankList = 5;
optional string nextPage = 6;
optional int32 allCount = 7;
}
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
36
37
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3305
Futu::u32_t GetOptionUnderlyingRank(const Qot_GetOptionUnderlyingRank::Request &stReq);
virtual void OnReply_GetOptionUnderlyingRank(Futu::u32_t nSerialNo, const Qot_GetOptionUnderlyingRank::Response &stRsp) = 0;
説明
オプション原資産ランキングリストを取得
パラメータ
message C2S
{
required int32 optionMarket = 1; //コーポレートアクションタイプ
required int32 sortType = 2; //Qot_OptionCommon.UnderlyingRankSortType
optional bool isAsc = 3; //昇順かどうか、デフォルトfalse
optional int32 count = 4; //ページあたりの数量[1,200]、デフォルト200
optional string tradingDate = 5; //取引日、フォーマットyyyy-MM-dd
repeated Qot_OptionCommon.UnderlyingRankIndicator filterList = 6;
optional string page = 7; //ページングカーソル
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- 戻り値
message UnderlyingRankItem
{
required Qot_Common.Security owner = 1;
optional string name = 2;
optional int64 totalVolume = 3;
optional int64 totalOpenInterest = 4;
optional double volumeRatio = 5;
optional double openInterestRatio = 6;
optional double iv = 7;
optional double ivRank = 8;
optional double ivPercentile = 9;
optional double price = 10;
optional double changeRate = 11;
optional double ivChange = 12;
optional double hv = 13;
optional double hvChange = 14;
optional double marketCap = 15;
}
message S2C
{
required int32 optionMarket = 1;
required int32 sortType = 2;
optional string tradingDate = 3;
optional double tradingTimestamp = 4;
repeated UnderlyingRankItem rankList = 5;
optional string nextPage = 6;
optional int32 allCount = 7;
}
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
36
37
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3305
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_GetOptionUnderlyingRank::Request req;
Qot_GetOptionUnderlyingRank::C2S *c2s = req.mutable_c2s();
// TODO: 按 proto 填充 c2s 字段
m_GetOptionUnderlyingRankSerialNo = m_pQotApi->GetOptionUnderlyingRank(req);
}
virtual void OnReply_GetOptionUnderlyingRank(Futu::u32_t nSerialNo, const Qot_GetOptionUnderlyingRank::Response &stRsp) {
if (nSerialNo != m_GetOptionUnderlyingRankSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
FTAPI_Qot *m_pQotApi;
Futu::u32_t m_GetOptionUnderlyingRankSerialNo = 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
getOptionUnderlyingRank(qotGetOptionUnderlyingRank)
説明
オプション原資産ランキングリストを取得
パラメータ
message C2S
{
required int32 optionMarket = 1; //コーポレートアクションタイプ
required int32 sortType = 2; //Qot_OptionCommon.UnderlyingRankSortType
optional bool isAsc = 3; //昇順かどうか、デフォルトfalse
optional int32 count = 4; //ページあたりの数量[1,200]、デフォルト200
optional string tradingDate = 5; //取引日、フォーマットyyyy-MM-dd
repeated Qot_OptionCommon.UnderlyingRankIndicator filterList = 6;
optional string page = 7; //ページングカーソル
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- 戻り値
message UnderlyingRankItem
{
required Qot_Common.Security owner = 1;
optional string name = 2;
optional int64 totalVolume = 3;
optional int64 totalOpenInterest = 4;
optional double volumeRatio = 5;
optional double openInterestRatio = 6;
optional double iv = 7;
optional double ivRank = 8;
optional double ivPercentile = 9;
optional double price = 10;
optional double changeRate = 11;
optional double ivChange = 12;
optional double hv = 13;
optional double hvChange = 14;
optional double marketCap = 15;
}
message S2C
{
required int32 optionMarket = 1;
required int32 sortType = 2;
optional string tradingDate = 3;
optional double tradingTimestamp = 4;
repeated UnderlyingRankItem rankList = 5;
optional string nextPage = 6;
optional int32 allCount = 7;
}
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
36
37
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3305
Example
import ftWebsocket from "futu-api";
import { Common, Qot_OptionCommon } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetOptionUnderlyingRank(){
const { RetType } = Common
const { OptionMarket, UnderlyingRankSortType } = 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,
sortType: UnderlyingRankSortType.UnderlyingRankSortType_Volume,
count: 5,
},
};
websocket.GetOptionUnderlyingRank(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetOptionUnderlyingRank: 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);
}
QotGetOptionUnderlyingRank()
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
GetOptionUnderlyingRank: errCode 0, retMsg , retType 0
{
"optionMarket": 1,
"sortType": 1,
"tradingDate": "2026-06-12",
"tradingTimestamp": 1781237000,
"rankList": [
{
"owner": { "market": 1, "code": "SPY" },
"name": "标普500ETF-SPDR",
"totalVolume": 14228830,
"totalOpenInterest": 19909256,
"volumeRatio": 0.97899,
"openInterestRatio": 1.93868,
"iv": 17.675,
"ivRank": 27.143,
"ivPercentile": 61.111,
"price": 741.75,
"changeRate": 0.540826,
"ivChange": -8.261,
"hv": 15.031,
"hvChange": -0.057,
"marketCap": 781494500000
},
{
"owner": { "market": 1, "code": "QQQ" },
"name": "纳指100ETF-Invesco QQQ Trust",
"totalVolume": 8239190,
"totalOpenInterest": 12964422,
"volumeRatio": 0.99417,
"openInterestRatio": 1.49888,
"iv": 27.652,
"ivRank": 62.918,
"ivPercentile": 91.269,
"price": 721.34,
"changeRate": 0.588465,
"ivChange": -8.332,
"hv": 26.196,
"hvChange": -0.644,
"marketCap": 476553300000
}
],
"allCount": 6017
}
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
インターフェース制限
- 30秒以内に最大60回のオプション原資産ランキングインターフェースリクエスト(ページング対応のインターフェースは初回呼び出しのみカウント)
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_option_underlying_rank(option_market, sort_type, sort_direction=None, count=None, trading_date=None, filter_list=None, page=None)
説明
オプション人気原資産ランキングを取得します。指定された次元でオプション原資産(株式/ETF/指数)をランク付けし、多次元フィルタリングとページネーションに対応しています。
パラメータ
パラメータ 型 説明 option_market OptionMarket オプション市場タイプ US_SECURITY=米国株式オプション、US_INDEX=米国指数オプション、HK_SECURITY=香港株式オプション、HK_INDEX=香港指数オプションsort_type UnderlyingRankSortType ソートフィールド VOLUME=総出来高、VOLUME_RATIO=Put/Call出来高比値、OPEN_INTEREST=総建玉、OPEN_INTEREST_RATIO=Put/Call建玉比値、PRICE=最新価格、PRICE_CHANGE=騰落率、IV=IV、IV_CHANGE=IV変化率、HV=HV、HV_CHANGE=HV変化率、IV_RANK=IV Rank、IV_PERCENTILE=IV Percentile、MARKET_CAP=時価総額sort_direction int ソート方向 0=降順(デフォルト)、1=昇順count int ページあたりの数量 範囲 [1,200]、デフォルト 200trading_date str 取引日 フォーマット yyyy-MM-dd、未指定の場合は最新ランキングを返すfilter_list list[UnderlyingRankFilter] フィルタ条件リスト 複数条件は AND 関係page str ページングカーソル 初回リクエストは None を渡す、ページングは前回返却の next_page を渡す戻り値
パラメータ 型 説明 ret RET_CODE インターフェース呼び出し結果 data pandas.DataFrame ret == RET_OK の場合、ランキングデータを返す str ret != RET_OK の場合、エラー説明を返す next_page str 次ページカーソル文字列、None は次ページなし all_count int 条件に合致する総データ数 data DataFrame フィールド:
フィールド 型 説明 code str 原資産銘柄コード name str 原資産名称 total_volume int オプション総出来高 total_open_interest int オプション総建玉 volume_ratio float Put/Call 出来高比率(パーセント) open_interest_ratio float Put/Call 建玉比率(パーセント) iv float インプライドボラティリティ(パーセント) iv_rank float IV ランクパーセンタイル(パーセント) iv_percentile float IV パーセンタイル(パーセント) price float 原資産最新価格 change_ratio float 原資産騰落率(小数) iv_change float IV 変化率(パーセント) hv float ヒストリカルボラティリティ(パーセント) hv_change float HV 変化率(パーセント) market_cap float 時価総額 trading_date str ランキングデータ対応取引日 trading_timestamp float ランキングデータ対応取引日タイムスタンプ(Unix 秒)
Example
from moomoo import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data, next_page, all_count = quote_ctx.get_option_underlying_rank(
option_market=OptionMarket.US_SECURITY,
sort_type=UnderlyingRankSortType.VOLUME,
count=5
)
if ret == RET_OK:
print(data)
print('all_count:', all_count)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
- Output
code name total_volume total_open_interest volume_ratio open_interest_ratio iv iv_rank iv_percentile price change_ratio iv_change hv hv_change market_cap trading_date trading_timestamp
0 US.SPY 标普500ETF-SPDR 14228830 19909256 0.97899 1.93868 17.675 27.143 61.111 741.75 0.540826 -8.261 15.031 -0.057 7.814945e+11 2026-06-12 1.781237e+09
1 US.QQQ 纳指100ETF-Invesco QQQ Trust 8239190 12964422 0.99417 1.49888 27.652 62.918 91.269 721.34 0.588465 -8.332 26.196 -0.644 4.765533e+11 2026-06-12 1.781237e+09
2 US.TSLA 特斯拉 3623504 7088459 0.64872 0.69633 55.053 39.265 64.285 406.43 1.823876 -0.629 49.359 -1.194 1.526439e+12 2026-06-12 1.781237e+09
3 US.NVDA 英伟达 3157331 16744961 0.59428 0.84085 41.975 27.062 42.460 205.19 0.156197 -7.002 45.921 -1.972 4.965598e+12 2026-06-12 1.781237e+09
4 US.IWM 罗素2000ETF-iShares 2840729 11791964 0.79034 2.78276 24.857 33.930 64.285 292.95 0.874626 -6.744 24.802 0.522 8.061984e+10 2026-06-12 1.781237e+09
all_count: 6017
2
3
4
5
6
7
# Qot_GetOptionUnderlyingRank.proto
説明
オプション原資産ランキングリストを取得
パラメータ
message C2S
{
required int32 optionMarket = 1; //コーポレートアクションタイプ
required int32 sortType = 2; //Qot_OptionCommon.UnderlyingRankSortType
optional bool isAsc = 3; //昇順かどうか、デフォルトfalse
optional int32 count = 4; //ページあたりの数量[1,200]、デフォルト200
optional string tradingDate = 5; //取引日、フォーマットyyyy-MM-dd
repeated Qot_OptionCommon.UnderlyingRankIndicator filterList = 6;
optional string page = 7; //ページングカーソル
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- 戻り値
message UnderlyingRankItem
{
required Qot_Common.Security owner = 1;
optional string name = 2;
optional int64 totalVolume = 3;
optional int64 totalOpenInterest = 4;
optional double volumeRatio = 5;
optional double openInterestRatio = 6;
optional double iv = 7;
optional double ivRank = 8;
optional double ivPercentile = 9;
optional double price = 10;
optional double changeRate = 11;
optional double ivChange = 12;
optional double hv = 13;
optional double hvChange = 14;
optional double marketCap = 15;
}
message S2C
{
required int32 optionMarket = 1;
required int32 sortType = 2;
optional string tradingDate = 3;
optional double tradingTimestamp = 4;
repeated UnderlyingRankItem rankList = 5;
optional string nextPage = 6;
optional int32 allCount = 7;
}
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
36
37
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3305
uint GetOptionUnderlyingRank(Qot_GetOptionUnderlyingRank.Request req); virtual void OnReply_GetOptionUnderlyingRank(MMAPI_Conn client, uint nSerialNo, Qot_GetOptionUnderlyingRank.Response rsp);
説明
オプション原資産ランキングリストを取得
パラメータ
message C2S
{
required int32 optionMarket = 1; //コーポレートアクションタイプ
required int32 sortType = 2; //Qot_OptionCommon.UnderlyingRankSortType
optional bool isAsc = 3; //昇順かどうか、デフォルトfalse
optional int32 count = 4; //ページあたりの数量[1,200]、デフォルト200
optional string tradingDate = 5; //取引日、フォーマットyyyy-MM-dd
repeated Qot_OptionCommon.UnderlyingRankIndicator filterList = 6;
optional string page = 7; //ページングカーソル
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- 戻り値
message UnderlyingRankItem
{
required Qot_Common.Security owner = 1;
optional string name = 2;
optional int64 totalVolume = 3;
optional int64 totalOpenInterest = 4;
optional double volumeRatio = 5;
optional double openInterestRatio = 6;
optional double iv = 7;
optional double ivRank = 8;
optional double ivPercentile = 9;
optional double price = 10;
optional double changeRate = 11;
optional double ivChange = 12;
optional double hv = 13;
optional double hvChange = 14;
optional double marketCap = 15;
}
message S2C
{
required int32 optionMarket = 1;
required int32 sortType = 2;
optional string tradingDate = 3;
optional double tradingTimestamp = 4;
repeated UnderlyingRankItem rankList = 5;
optional string nextPage = 6;
optional int32 allCount = 7;
}
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
36
37
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3305
int getOptionUnderlyingRank(Qot_GetOptionUnderlyingRank.Request req) onReply_GetOptionUnderlyingRank(MMAPI_Conn client, int nSerialNo, Qot_GetOptionUnderlyingRank.Response rsp)
説明
オプション原資産ランキングリストを取得
パラメータ
message C2S
{
required int32 optionMarket = 1; //コーポレートアクションタイプ
required int32 sortType = 2; //Qot_OptionCommon.UnderlyingRankSortType
optional bool isAsc = 3; //昇順かどうか、デフォルトfalse
optional int32 count = 4; //ページあたりの数量[1,200]、デフォルト200
optional string tradingDate = 5; //取引日、フォーマットyyyy-MM-dd
repeated Qot_OptionCommon.UnderlyingRankIndicator filterList = 6;
optional string page = 7; //ページングカーソル
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- 戻り値
message UnderlyingRankItem
{
required Qot_Common.Security owner = 1;
optional string name = 2;
optional int64 totalVolume = 3;
optional int64 totalOpenInterest = 4;
optional double volumeRatio = 5;
optional double openInterestRatio = 6;
optional double iv = 7;
optional double ivRank = 8;
optional double ivPercentile = 9;
optional double price = 10;
optional double changeRate = 11;
optional double ivChange = 12;
optional double hv = 13;
optional double hvChange = 14;
optional double marketCap = 15;
}
message S2C
{
required int32 optionMarket = 1;
required int32 sortType = 2;
optional string tradingDate = 3;
optional double tradingTimestamp = 4;
repeated UnderlyingRankItem rankList = 5;
optional string nextPage = 6;
optional int32 allCount = 7;
}
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
36
37
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3305
Moomoo::u32_t GetOptionUnderlyingRank(const Qot_GetOptionUnderlyingRank::Request &stReq);
virtual void OnReply_GetOptionUnderlyingRank(Moomoo::u32_t nSerialNo, const Qot_GetOptionUnderlyingRank::Response &stRsp) = 0;
説明
オプション原資産ランキングリストを取得
パラメータ
message C2S
{
required int32 optionMarket = 1; //コーポレートアクションタイプ
required int32 sortType = 2; //Qot_OptionCommon.UnderlyingRankSortType
optional bool isAsc = 3; //昇順かどうか、デフォルトfalse
optional int32 count = 4; //ページあたりの数量[1,200]、デフォルト200
optional string tradingDate = 5; //取引日、フォーマットyyyy-MM-dd
repeated Qot_OptionCommon.UnderlyingRankIndicator filterList = 6;
optional string page = 7; //ページングカーソル
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- 戻り値
message UnderlyingRankItem
{
required Qot_Common.Security owner = 1;
optional string name = 2;
optional int64 totalVolume = 3;
optional int64 totalOpenInterest = 4;
optional double volumeRatio = 5;
optional double openInterestRatio = 6;
optional double iv = 7;
optional double ivRank = 8;
optional double ivPercentile = 9;
optional double price = 10;
optional double changeRate = 11;
optional double ivChange = 12;
optional double hv = 13;
optional double hvChange = 14;
optional double marketCap = 15;
}
message S2C
{
required int32 optionMarket = 1;
required int32 sortType = 2;
optional string tradingDate = 3;
optional double tradingTimestamp = 4;
repeated UnderlyingRankItem rankList = 5;
optional string nextPage = 6;
optional int32 allCount = 7;
}
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
36
37
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3305
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_GetOptionUnderlyingRank::Request req;
Qot_GetOptionUnderlyingRank::C2S *c2s = req.mutable_c2s();
// TODO: 按 proto 填充 c2s 字段
m_GetOptionUnderlyingRankSerialNo = m_pQotApi->GetOptionUnderlyingRank(req);
}
virtual void OnReply_GetOptionUnderlyingRank(Moomoo::u32_t nSerialNo, const Qot_GetOptionUnderlyingRank::Response &stRsp) {
if (nSerialNo != m_GetOptionUnderlyingRankSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
MMAPI_Qot *m_pQotApi;
Moomoo::u32_t m_GetOptionUnderlyingRankSerialNo = 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
getOptionUnderlyingRank(qotGetOptionUnderlyingRank)
説明
オプション原資産ランキングリストを取得
パラメータ
message C2S
{
required int32 optionMarket = 1; //コーポレートアクションタイプ
required int32 sortType = 2; //Qot_OptionCommon.UnderlyingRankSortType
optional bool isAsc = 3; //昇順かどうか、デフォルトfalse
optional int32 count = 4; //ページあたりの数量[1,200]、デフォルト200
optional string tradingDate = 5; //取引日、フォーマットyyyy-MM-dd
repeated Qot_OptionCommon.UnderlyingRankIndicator filterList = 6;
optional string page = 7; //ページングカーソル
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- 戻り値
message UnderlyingRankItem
{
required Qot_Common.Security owner = 1;
optional string name = 2;
optional int64 totalVolume = 3;
optional int64 totalOpenInterest = 4;
optional double volumeRatio = 5;
optional double openInterestRatio = 6;
optional double iv = 7;
optional double ivRank = 8;
optional double ivPercentile = 9;
optional double price = 10;
optional double changeRate = 11;
optional double ivChange = 12;
optional double hv = 13;
optional double hvChange = 14;
optional double marketCap = 15;
}
message S2C
{
required int32 optionMarket = 1;
required int32 sortType = 2;
optional string tradingDate = 3;
optional double tradingTimestamp = 4;
repeated UnderlyingRankItem rankList = 5;
optional string nextPage = 6;
optional int32 allCount = 7;
}
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
36
37
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3305
Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_OptionCommon } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetOptionUnderlyingRank(){
const { RetType } = Common
const { OptionMarket, UnderlyingRankSortType } = 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,
sortType: UnderlyingRankSortType.UnderlyingRankSortType_Volume,
count: 5,
},
};
websocket.GetOptionUnderlyingRank(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetOptionUnderlyingRank: 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);
}
QotGetOptionUnderlyingRank()
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
GetOptionUnderlyingRank: errCode 0, retMsg , retType 0
{
"optionMarket": 1,
"sortType": 1,
"tradingDate": "2026-06-12",
"tradingTimestamp": 1781237000,
"rankList": [
{
"owner": { "market": 1, "code": "SPY" },
"name": "标普500ETF-SPDR",
"totalVolume": 14228830,
"totalOpenInterest": 19909256,
"volumeRatio": 0.97899,
"openInterestRatio": 1.93868,
"iv": 17.675,
"ivRank": 27.143,
"ivPercentile": 61.111,
"price": 741.75,
"changeRate": 0.540826,
"ivChange": -8.261,
"hv": 15.031,
"hvChange": -0.057,
"marketCap": 781494500000
},
{
"owner": { "market": 1, "code": "QQQ" },
"name": "纳指100ETF-Invesco QQQ Trust",
"totalVolume": 8239190,
"totalOpenInterest": 12964422,
"volumeRatio": 0.99417,
"openInterestRatio": 1.49888,
"iv": 27.652,
"ivRank": 62.918,
"ivPercentile": 91.269,
"price": 721.34,
"changeRate": 0.588465,
"ivChange": -8.332,
"hv": 26.196,
"hvChange": -0.644,
"marketCap": 476553300000
}
],
"allCount": 6017
}
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
インターフェース制限
- 30秒以内に最大60回のオプション原資産ランキングインターフェースリクエスト(ページング対応のインターフェースは初回呼び出しのみカウント)