# 期權合約排行
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_option_rank(option_market, sort_type, count=None, trading_date=None, sort_direction=None, page=None, filter_list=None)
介紹
獲取期權合約排行列表,支持按成交量、持倉量、增倉量、減倉量、IV、漲跌幅等維度排序。
參數
參數 類型 說明 option_market OptionMarket 期權市場類型 US_SECURITY=美股股票期權、US_INDEX=美股指數期權、HK_SECURITY=港股股票期權、HK_INDEX=港股指數期權sort_type OptionRankType 排序類型 VOLUME=成交量、TURNOVER=成交額、OI=持倉量、OI_INCREMENT=增倉量(日)、OI_DECREMENT=減倉量(日)、OI_MARKET_CAP=持倉額、OI_MARKET_CAP_INCREMENT=增倉額(日)、OI_MARKET_CAP_DECREMENT=減倉額(日)、CHANGE_RATE=漲跌幅、IV=隱含波動率count int 返回數量 範圍 [1,200],默認 200trading_date str 交易日 格式 yyyy-MM-dd,不填返回最新排行sort_direction int 排序方向 0=降序(默認),1=升序page str 分頁遊標 首次請求不傳,後續傳 next_pagefilter_list list[OptionRankFilter] 篩選條件列表 多條件為 AND 關係返回
返回四元組 (ret, data, next_page, all_count)
參數 類型 說明 ret RET_CODE 接口調用結果 data pandas.DataFrame 當 ret == RET_OK,返回排行數據 data str 當 ret != RET_OK,返回錯誤描述 next_page str 下一頁遊標,None 表示無更多數據 all_count int 滿足篩選條件的總數量 data DataFrame 字段:
字段 類型 說明 code str 期權合約代碼 name str 期權名稱 option_type str 期權類型 CALL/PUToi_increment int 增倉量(>=0) oi_decrement int 減倉量(>=0) oi_market_cap_increment float 增倉額(>=0) oi_market_cap_decrement float 減倉額(>=0) volume int 成交量 turnover float 成交額 open_interest int 持倉量 open_interest_market_cap float 持倉額 iv float 隱含波動率(百分比) option_price float 期權最新價 change_ratio float 漲跌幅(小數) mid_price float 中間價 bid_price float 買入價 bid_volume int 買量 ask_price float 賣出價 ask_volume int 賣量 delta float Delta gamma float Gamma theta float Theta vega float Vega rho float Rho 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_rank(
OptionMarket.US_SECURITY,
OptionRankType.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 option_type oi_increment oi_decrement oi_market_cap_increment oi_market_cap_decrement volume turnover open_interest open_interest_market_cap iv option_price change_ratio mid_price bid_price bid_volume ask_price ask_volume delta gamma theta vega rho trading_date trading_timestamp
0 US.SPY260612C742000 SPY 260612 742.00C CALL 1816 N/A 105328.0 N/A 730160 91928623.0 7449 432042.0 146.507 0.58 -67.688 0.580 0.56 28 0.60 1 0.43674 0.27447 -455.46028 0.00385 0.0 2026-06-12 1.781237e+09
1 US.SPY260612C745000 SPY 260612 745.00C CALL 5416 N/A 5416.0 N/A 617981 44479304.0 17013 17013.0 87.067 0.01 -98.958 0.015 0.01 708 0.02 500 0.02438 0.03501 -18.52310 0.00107 0.0 2026-06-12 1.781237e+09
2 US.SPY260612C743000 SPY 260612 743.00C CALL 5438 N/A 48942.0 N/A 606769 64419534.0 7426 66834.0 59.082 0.09 -93.898 0.095 0.09 208 0.10 118 0.13412 0.19487 -50.92453 0.00405 0.0 2026-06-12 1.781237e+09
3 US.SPY260612P740000 SPY 260612 740.00P PUT 1223 N/A 1223.0 N/A 566915 69291991.0 15291 15291.0 53.083 0.01 -99.790 0.015 0.01 447 0.02 407 -0.03761 0.08224 -16.47701 0.00153 0.0 2026-06-12 1.781237e+09
4 US.SPY260612C741000 SPY 260612 741.00C CALL 2924 N/A 423980.0 N/A 506505 88981079.0 6229 903205.0 224.448 1.45 -33.179 1.520 1.46 12 1.58 23 0.63754 0.17055 -662.49947 0.00367 0.0 2026-06-12 1.781237e+09
all_count: 1955829
2
3
4
5
6
7
# Qot_GetOptionRank.proto
介紹
獲取期權合約排行列表
參數
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket
required int32 sortType = 2; //Qot_OptionCommon.OptionRankType
optional int32 count = 3; //返回數量[1,200],默認200
optional string tradingDate = 4; //交易日,格式yyyy-MM-dd
optional bool isAsc = 5; //是否升序,默認false
optional string page = 6; //分頁遊標
repeated Qot_OptionCommon.OptionRankIndicator filterList = 7;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- 返回
message OptionRankItem
{
required Qot_Common.Security option = 1;
optional string name = 2;
optional int32 optionType = 3;
optional int64 oiIncrement = 4;
optional int64 oiDecrement = 5;
optional double oiMarketCapIncrement = 6;
optional double oiMarketCapDecrement = 7;
optional int64 volume = 8;
optional double turnover = 9;
optional int64 openInterest = 10;
optional double openInterestMarketCap = 11;
optional double iv = 12;
optional double optionPrice = 13;
optional double changeRate = 14;
optional double midPrice = 15;
optional double bidPrice = 16;
optional int64 bidVolume = 17;
optional double askPrice = 18;
optional int64 askVolume = 19;
optional double delta = 20;
optional double gamma = 21;
optional double theta = 22;
optional double vega = 23;
optional double rho = 24;
}
message S2C
{
required int32 optionMarket = 1;
required int32 sortType = 2;
optional string tradingDate = 3;
optional double tradingTimestamp = 4;
repeated OptionRankItem 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
38
39
40
41
42
43
44
45
46
- 接口調用結果,結構參見 RetType
協議 ID
3306
uint GetOptionRank(Qot_GetOptionRank.Request req); virtual void OnReply_GetOptionRank(FTAPI_Conn client, uint nSerialNo, Qot_GetOptionRank.Response rsp);
介紹
獲取期權合約排行列表
參數
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket
required int32 sortType = 2; //Qot_OptionCommon.OptionRankType
optional int32 count = 3; //返回數量[1,200],默認200
optional string tradingDate = 4; //交易日,格式yyyy-MM-dd
optional bool isAsc = 5; //是否升序,默認false
optional string page = 6; //分頁遊標
repeated Qot_OptionCommon.OptionRankIndicator filterList = 7;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- 返回
message OptionRankItem
{
required Qot_Common.Security option = 1;
optional string name = 2;
optional int32 optionType = 3;
optional int64 oiIncrement = 4;
optional int64 oiDecrement = 5;
optional double oiMarketCapIncrement = 6;
optional double oiMarketCapDecrement = 7;
optional int64 volume = 8;
optional double turnover = 9;
optional int64 openInterest = 10;
optional double openInterestMarketCap = 11;
optional double iv = 12;
optional double optionPrice = 13;
optional double changeRate = 14;
optional double midPrice = 15;
optional double bidPrice = 16;
optional int64 bidVolume = 17;
optional double askPrice = 18;
optional int64 askVolume = 19;
optional double delta = 20;
optional double gamma = 21;
optional double theta = 22;
optional double vega = 23;
optional double rho = 24;
}
message S2C
{
required int32 optionMarket = 1;
required int32 sortType = 2;
optional string tradingDate = 3;
optional double tradingTimestamp = 4;
repeated OptionRankItem 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
38
39
40
41
42
43
44
45
46
- 接口調用結果,結構參見 RetType
協議 ID
3306
int getOptionRank(Qot_GetOptionRank.Request req) onReply_GetOptionRank(FTAPI_Conn client, int nSerialNo, Qot_GetOptionRank.Response rsp)
介紹
獲取期權合約排行列表
參數
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket
required int32 sortType = 2; //Qot_OptionCommon.OptionRankType
optional int32 count = 3; //返回數量[1,200],默認200
optional string tradingDate = 4; //交易日,格式yyyy-MM-dd
optional bool isAsc = 5; //是否升序,默認false
optional string page = 6; //分頁遊標
repeated Qot_OptionCommon.OptionRankIndicator filterList = 7;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- 返回
message OptionRankItem
{
required Qot_Common.Security option = 1;
optional string name = 2;
optional int32 optionType = 3;
optional int64 oiIncrement = 4;
optional int64 oiDecrement = 5;
optional double oiMarketCapIncrement = 6;
optional double oiMarketCapDecrement = 7;
optional int64 volume = 8;
optional double turnover = 9;
optional int64 openInterest = 10;
optional double openInterestMarketCap = 11;
optional double iv = 12;
optional double optionPrice = 13;
optional double changeRate = 14;
optional double midPrice = 15;
optional double bidPrice = 16;
optional int64 bidVolume = 17;
optional double askPrice = 18;
optional int64 askVolume = 19;
optional double delta = 20;
optional double gamma = 21;
optional double theta = 22;
optional double vega = 23;
optional double rho = 24;
}
message S2C
{
required int32 optionMarket = 1;
required int32 sortType = 2;
optional string tradingDate = 3;
optional double tradingTimestamp = 4;
repeated OptionRankItem 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
38
39
40
41
42
43
44
45
46
- 接口調用結果,結構參見 RetType
協議 ID
3306
Futu::u32_t GetOptionRank(const Qot_GetOptionRank::Request &stReq);
virtual void OnReply_GetOptionRank(Futu::u32_t nSerialNo, const Qot_GetOptionRank::Response &stRsp) = 0;
介紹
獲取期權合約排行列表
參數
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket
required int32 sortType = 2; //Qot_OptionCommon.OptionRankType
optional int32 count = 3; //返回數量[1,200],默認200
optional string tradingDate = 4; //交易日,格式yyyy-MM-dd
optional bool isAsc = 5; //是否升序,默認false
optional string page = 6; //分頁遊標
repeated Qot_OptionCommon.OptionRankIndicator filterList = 7;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- 返回
message OptionRankItem
{
required Qot_Common.Security option = 1;
optional string name = 2;
optional int32 optionType = 3;
optional int64 oiIncrement = 4;
optional int64 oiDecrement = 5;
optional double oiMarketCapIncrement = 6;
optional double oiMarketCapDecrement = 7;
optional int64 volume = 8;
optional double turnover = 9;
optional int64 openInterest = 10;
optional double openInterestMarketCap = 11;
optional double iv = 12;
optional double optionPrice = 13;
optional double changeRate = 14;
optional double midPrice = 15;
optional double bidPrice = 16;
optional int64 bidVolume = 17;
optional double askPrice = 18;
optional int64 askVolume = 19;
optional double delta = 20;
optional double gamma = 21;
optional double theta = 22;
optional double vega = 23;
optional double rho = 24;
}
message S2C
{
required int32 optionMarket = 1;
required int32 sortType = 2;
optional string tradingDate = 3;
optional double tradingTimestamp = 4;
repeated OptionRankItem 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
38
39
40
41
42
43
44
45
46
- 接口調用結果,結構參見 RetType
協議 ID
3306
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_GetOptionRank::Request req;
Qot_GetOptionRank::C2S *c2s = req.mutable_c2s();
// TODO: 按 proto 填充 c2s 字段
m_GetOptionRankSerialNo = m_pQotApi->GetOptionRank(req);
}
virtual void OnReply_GetOptionRank(Futu::u32_t nSerialNo, const Qot_GetOptionRank::Response &stRsp) {
if (nSerialNo != m_GetOptionRankSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
FTAPI_Qot *m_pQotApi;
Futu::u32_t m_GetOptionRankSerialNo = 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
getOptionRank(qotGetOptionRank)
介紹
獲取期權合約排行列表
參數
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket
required int32 sortType = 2; //Qot_OptionCommon.OptionRankType
optional int32 count = 3; //返回數量[1,200],默認200
optional string tradingDate = 4; //交易日,格式yyyy-MM-dd
optional bool isAsc = 5; //是否升序,默認false
optional string page = 6; //分頁遊標
repeated Qot_OptionCommon.OptionRankIndicator filterList = 7;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- 返回
message OptionRankItem
{
required Qot_Common.Security option = 1;
optional string name = 2;
optional int32 optionType = 3;
optional int64 oiIncrement = 4;
optional int64 oiDecrement = 5;
optional double oiMarketCapIncrement = 6;
optional double oiMarketCapDecrement = 7;
optional int64 volume = 8;
optional double turnover = 9;
optional int64 openInterest = 10;
optional double openInterestMarketCap = 11;
optional double iv = 12;
optional double optionPrice = 13;
optional double changeRate = 14;
optional double midPrice = 15;
optional double bidPrice = 16;
optional int64 bidVolume = 17;
optional double askPrice = 18;
optional int64 askVolume = 19;
optional double delta = 20;
optional double gamma = 21;
optional double theta = 22;
optional double vega = 23;
optional double rho = 24;
}
message S2C
{
required int32 optionMarket = 1;
required int32 sortType = 2;
optional string tradingDate = 3;
optional double tradingTimestamp = 4;
repeated OptionRankItem 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
38
39
40
41
42
43
44
45
46
- 接口調用結果,結構參見 RetType
協議 ID
3306
Example
import ftWebsocket from "futu-api";
import { Common, Qot_OptionCommon } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetOptionRank(){
const { RetType } = Common
const { OptionMarket, OptionRankType } = 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: OptionRankType.OptionRankType_Volume,
count: 5,
},
};
websocket.GetOptionRank(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetOptionRank: 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);
}
QotGetOptionRank()
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
GetOptionRank: errCode 0, retMsg , retType 0
{
"optionMarket": 1,
"sortType": 1,
"tradingDate": "2026-06-12",
"tradingTimestamp": 1781237000,
"rankList": [
{
"option": { "market": 1, "code": "SPY260612C742000" },
"name": "SPY 260612 742.00C",
"optionType": 1,
"oiIncrement": 1816,
"volume": 730160,
"turnover": 91928623,
"openInterest": 7449,
"iv": 146.507,
"optionPrice": 0.58,
"changeRate": -67.688,
"midPrice": 0.58,
"bidPrice": 0.56,
"bidVolume": 28,
"askPrice": 0.6,
"askVolume": 1,
"delta": 0.43674,
"gamma": 0.27447,
"theta": -455.46028,
"vega": 0.00385,
"rho": 0
},
{
"option": { "market": 1, "code": "SPY260612C745000" },
"name": "SPY 260612 745.00C",
"optionType": 1,
"oiIncrement": 5416,
"volume": 617981,
"turnover": 44479304,
"openInterest": 17013,
"iv": 87.067,
"optionPrice": 0.01,
"changeRate": -98.958,
"midPrice": 0.015,
"bidPrice": 0.01,
"bidVolume": 708,
"askPrice": 0.02,
"askVolume": 500,
"delta": 0.02438,
"gamma": 0.03501,
"theta": -18.5231,
"vega": 0.00107,
"rho": 0
}
],
"allCount": 1955829
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
接口限制
- 30 秒內最多請求 60 次期權合約排行接口(支持分頁的接口,僅首次調用納入統計)
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_option_rank(option_market, sort_type, count=None, trading_date=None, sort_direction=None, page=None, filter_list=None)
介紹
獲取期權合約排行列表,支持按成交量、持倉量、增倉量、減倉量、IV、漲跌幅等維度排序。
參數
參數 類型 說明 option_market OptionMarket 期權市場類型 US_SECURITY=美股股票期權、US_INDEX=美股指數期權、HK_SECURITY=港股股票期權、HK_INDEX=港股指數期權sort_type OptionRankType 排序類型 VOLUME=成交量、TURNOVER=成交額、OI=持倉量、OI_INCREMENT=增倉量(日)、OI_DECREMENT=減倉量(日)、OI_MARKET_CAP=持倉額、OI_MARKET_CAP_INCREMENT=增倉額(日)、OI_MARKET_CAP_DECREMENT=減倉額(日)、CHANGE_RATE=漲跌幅、IV=隱含波動率count int 返回數量 範圍 [1,200],默認 200trading_date str 交易日 格式 yyyy-MM-dd,不填返回最新排行sort_direction int 排序方向 0=降序(默認),1=升序page str 分頁遊標 首次請求不傳,後續傳 next_pagefilter_list list[OptionRankFilter] 篩選條件列表 多條件為 AND 關係返回
返回四元組 (ret, data, next_page, all_count)
參數 類型 說明 ret RET_CODE 接口調用結果 data pandas.DataFrame 當 ret == RET_OK,返回排行數據 data str 當 ret != RET_OK,返回錯誤描述 next_page str 下一頁遊標,None 表示無更多數據 all_count int 滿足篩選條件的總數量 data DataFrame 字段:
字段 類型 說明 code str 期權合約代碼 name str 期權名稱 option_type str 期權類型 CALL/PUToi_increment int 增倉量(>=0) oi_decrement int 減倉量(>=0) oi_market_cap_increment float 增倉額(>=0) oi_market_cap_decrement float 減倉額(>=0) volume int 成交量 turnover float 成交額 open_interest int 持倉量 open_interest_market_cap float 持倉額 iv float 隱含波動率(百分比) option_price float 期權最新價 change_ratio float 漲跌幅(小數) mid_price float 中間價 bid_price float 買入價 bid_volume int 買量 ask_price float 賣出價 ask_volume int 賣量 delta float Delta gamma float Gamma theta float Theta vega float Vega rho float Rho 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_rank(
OptionMarket.US_SECURITY,
OptionRankType.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 option_type oi_increment oi_decrement oi_market_cap_increment oi_market_cap_decrement volume turnover open_interest open_interest_market_cap iv option_price change_ratio mid_price bid_price bid_volume ask_price ask_volume delta gamma theta vega rho trading_date trading_timestamp
0 US.SPY260612C742000 SPY 260612 742.00C CALL 1816 N/A 105328.0 N/A 730160 91928623.0 7449 432042.0 146.507 0.58 -67.688 0.580 0.56 28 0.60 1 0.43674 0.27447 -455.46028 0.00385 0.0 2026-06-12 1.781237e+09
1 US.SPY260612C745000 SPY 260612 745.00C CALL 5416 N/A 5416.0 N/A 617981 44479304.0 17013 17013.0 87.067 0.01 -98.958 0.015 0.01 708 0.02 500 0.02438 0.03501 -18.52310 0.00107 0.0 2026-06-12 1.781237e+09
2 US.SPY260612C743000 SPY 260612 743.00C CALL 5438 N/A 48942.0 N/A 606769 64419534.0 7426 66834.0 59.082 0.09 -93.898 0.095 0.09 208 0.10 118 0.13412 0.19487 -50.92453 0.00405 0.0 2026-06-12 1.781237e+09
3 US.SPY260612P740000 SPY 260612 740.00P PUT 1223 N/A 1223.0 N/A 566915 69291991.0 15291 15291.0 53.083 0.01 -99.790 0.015 0.01 447 0.02 407 -0.03761 0.08224 -16.47701 0.00153 0.0 2026-06-12 1.781237e+09
4 US.SPY260612C741000 SPY 260612 741.00C CALL 2924 N/A 423980.0 N/A 506505 88981079.0 6229 903205.0 224.448 1.45 -33.179 1.520 1.46 12 1.58 23 0.63754 0.17055 -662.49947 0.00367 0.0 2026-06-12 1.781237e+09
all_count: 1955829
2
3
4
5
6
7
# Qot_GetOptionRank.proto
介紹
獲取期權合約排行列表
參數
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket
required int32 sortType = 2; //Qot_OptionCommon.OptionRankType
optional int32 count = 3; //返回數量[1,200],默認200
optional string tradingDate = 4; //交易日,格式yyyy-MM-dd
optional bool isAsc = 5; //是否升序,默認false
optional string page = 6; //分頁遊標
repeated Qot_OptionCommon.OptionRankIndicator filterList = 7;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- 返回
message OptionRankItem
{
required Qot_Common.Security option = 1;
optional string name = 2;
optional int32 optionType = 3;
optional int64 oiIncrement = 4;
optional int64 oiDecrement = 5;
optional double oiMarketCapIncrement = 6;
optional double oiMarketCapDecrement = 7;
optional int64 volume = 8;
optional double turnover = 9;
optional int64 openInterest = 10;
optional double openInterestMarketCap = 11;
optional double iv = 12;
optional double optionPrice = 13;
optional double changeRate = 14;
optional double midPrice = 15;
optional double bidPrice = 16;
optional int64 bidVolume = 17;
optional double askPrice = 18;
optional int64 askVolume = 19;
optional double delta = 20;
optional double gamma = 21;
optional double theta = 22;
optional double vega = 23;
optional double rho = 24;
}
message S2C
{
required int32 optionMarket = 1;
required int32 sortType = 2;
optional string tradingDate = 3;
optional double tradingTimestamp = 4;
repeated OptionRankItem 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
38
39
40
41
42
43
44
45
46
- 接口調用結果,結構參見 RetType
協議 ID
3306
uint GetOptionRank(Qot_GetOptionRank.Request req); virtual void OnReply_GetOptionRank(MMAPI_Conn client, uint nSerialNo, Qot_GetOptionRank.Response rsp);
介紹
獲取期權合約排行列表
參數
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket
required int32 sortType = 2; //Qot_OptionCommon.OptionRankType
optional int32 count = 3; //返回數量[1,200],默認200
optional string tradingDate = 4; //交易日,格式yyyy-MM-dd
optional bool isAsc = 5; //是否升序,默認false
optional string page = 6; //分頁遊標
repeated Qot_OptionCommon.OptionRankIndicator filterList = 7;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- 返回
message OptionRankItem
{
required Qot_Common.Security option = 1;
optional string name = 2;
optional int32 optionType = 3;
optional int64 oiIncrement = 4;
optional int64 oiDecrement = 5;
optional double oiMarketCapIncrement = 6;
optional double oiMarketCapDecrement = 7;
optional int64 volume = 8;
optional double turnover = 9;
optional int64 openInterest = 10;
optional double openInterestMarketCap = 11;
optional double iv = 12;
optional double optionPrice = 13;
optional double changeRate = 14;
optional double midPrice = 15;
optional double bidPrice = 16;
optional int64 bidVolume = 17;
optional double askPrice = 18;
optional int64 askVolume = 19;
optional double delta = 20;
optional double gamma = 21;
optional double theta = 22;
optional double vega = 23;
optional double rho = 24;
}
message S2C
{
required int32 optionMarket = 1;
required int32 sortType = 2;
optional string tradingDate = 3;
optional double tradingTimestamp = 4;
repeated OptionRankItem 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
38
39
40
41
42
43
44
45
46
- 接口調用結果,結構參見 RetType
協議 ID
3306
int getOptionRank(Qot_GetOptionRank.Request req) onReply_GetOptionRank(MMAPI_Conn client, int nSerialNo, Qot_GetOptionRank.Response rsp)
介紹
獲取期權合約排行列表
參數
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket
required int32 sortType = 2; //Qot_OptionCommon.OptionRankType
optional int32 count = 3; //返回數量[1,200],默認200
optional string tradingDate = 4; //交易日,格式yyyy-MM-dd
optional bool isAsc = 5; //是否升序,默認false
optional string page = 6; //分頁遊標
repeated Qot_OptionCommon.OptionRankIndicator filterList = 7;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- 返回
message OptionRankItem
{
required Qot_Common.Security option = 1;
optional string name = 2;
optional int32 optionType = 3;
optional int64 oiIncrement = 4;
optional int64 oiDecrement = 5;
optional double oiMarketCapIncrement = 6;
optional double oiMarketCapDecrement = 7;
optional int64 volume = 8;
optional double turnover = 9;
optional int64 openInterest = 10;
optional double openInterestMarketCap = 11;
optional double iv = 12;
optional double optionPrice = 13;
optional double changeRate = 14;
optional double midPrice = 15;
optional double bidPrice = 16;
optional int64 bidVolume = 17;
optional double askPrice = 18;
optional int64 askVolume = 19;
optional double delta = 20;
optional double gamma = 21;
optional double theta = 22;
optional double vega = 23;
optional double rho = 24;
}
message S2C
{
required int32 optionMarket = 1;
required int32 sortType = 2;
optional string tradingDate = 3;
optional double tradingTimestamp = 4;
repeated OptionRankItem 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
38
39
40
41
42
43
44
45
46
- 接口調用結果,結構參見 RetType
協議 ID
3306
Moomoo::u32_t GetOptionRank(const Qot_GetOptionRank::Request &stReq);
virtual void OnReply_GetOptionRank(Moomoo::u32_t nSerialNo, const Qot_GetOptionRank::Response &stRsp) = 0;
介紹
獲取期權合約排行列表
參數
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket
required int32 sortType = 2; //Qot_OptionCommon.OptionRankType
optional int32 count = 3; //返回數量[1,200],默認200
optional string tradingDate = 4; //交易日,格式yyyy-MM-dd
optional bool isAsc = 5; //是否升序,默認false
optional string page = 6; //分頁遊標
repeated Qot_OptionCommon.OptionRankIndicator filterList = 7;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- 返回
message OptionRankItem
{
required Qot_Common.Security option = 1;
optional string name = 2;
optional int32 optionType = 3;
optional int64 oiIncrement = 4;
optional int64 oiDecrement = 5;
optional double oiMarketCapIncrement = 6;
optional double oiMarketCapDecrement = 7;
optional int64 volume = 8;
optional double turnover = 9;
optional int64 openInterest = 10;
optional double openInterestMarketCap = 11;
optional double iv = 12;
optional double optionPrice = 13;
optional double changeRate = 14;
optional double midPrice = 15;
optional double bidPrice = 16;
optional int64 bidVolume = 17;
optional double askPrice = 18;
optional int64 askVolume = 19;
optional double delta = 20;
optional double gamma = 21;
optional double theta = 22;
optional double vega = 23;
optional double rho = 24;
}
message S2C
{
required int32 optionMarket = 1;
required int32 sortType = 2;
optional string tradingDate = 3;
optional double tradingTimestamp = 4;
repeated OptionRankItem 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
38
39
40
41
42
43
44
45
46
- 接口調用結果,結構參見 RetType
協議 ID
3306
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_GetOptionRank::Request req;
Qot_GetOptionRank::C2S *c2s = req.mutable_c2s();
// TODO: 按 proto 填充 c2s 字段
m_GetOptionRankSerialNo = m_pQotApi->GetOptionRank(req);
}
virtual void OnReply_GetOptionRank(Moomoo::u32_t nSerialNo, const Qot_GetOptionRank::Response &stRsp) {
if (nSerialNo != m_GetOptionRankSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
MMAPI_Qot *m_pQotApi;
Moomoo::u32_t m_GetOptionRankSerialNo = 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
getOptionRank(qotGetOptionRank)
介紹
獲取期權合約排行列表
參數
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket
required int32 sortType = 2; //Qot_OptionCommon.OptionRankType
optional int32 count = 3; //返回數量[1,200],默認200
optional string tradingDate = 4; //交易日,格式yyyy-MM-dd
optional bool isAsc = 5; //是否升序,默認false
optional string page = 6; //分頁遊標
repeated Qot_OptionCommon.OptionRankIndicator filterList = 7;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- 返回
message OptionRankItem
{
required Qot_Common.Security option = 1;
optional string name = 2;
optional int32 optionType = 3;
optional int64 oiIncrement = 4;
optional int64 oiDecrement = 5;
optional double oiMarketCapIncrement = 6;
optional double oiMarketCapDecrement = 7;
optional int64 volume = 8;
optional double turnover = 9;
optional int64 openInterest = 10;
optional double openInterestMarketCap = 11;
optional double iv = 12;
optional double optionPrice = 13;
optional double changeRate = 14;
optional double midPrice = 15;
optional double bidPrice = 16;
optional int64 bidVolume = 17;
optional double askPrice = 18;
optional int64 askVolume = 19;
optional double delta = 20;
optional double gamma = 21;
optional double theta = 22;
optional double vega = 23;
optional double rho = 24;
}
message S2C
{
required int32 optionMarket = 1;
required int32 sortType = 2;
optional string tradingDate = 3;
optional double tradingTimestamp = 4;
repeated OptionRankItem 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
38
39
40
41
42
43
44
45
46
- 接口調用結果,結構參見 RetType
協議 ID
3306
Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_OptionCommon } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetOptionRank(){
const { RetType } = Common
const { OptionMarket, OptionRankType } = 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: OptionRankType.OptionRankType_Volume,
count: 5,
},
};
websocket.GetOptionRank(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetOptionRank: 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);
}
QotGetOptionRank()
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
GetOptionRank: errCode 0, retMsg , retType 0
{
"optionMarket": 1,
"sortType": 1,
"tradingDate": "2026-06-12",
"tradingTimestamp": 1781237000,
"rankList": [
{
"option": { "market": 1, "code": "SPY260612C742000" },
"name": "SPY 260612 742.00C",
"optionType": 1,
"oiIncrement": 1816,
"volume": 730160,
"turnover": 91928623,
"openInterest": 7449,
"iv": 146.507,
"optionPrice": 0.58,
"changeRate": -67.688,
"midPrice": 0.58,
"bidPrice": 0.56,
"bidVolume": 28,
"askPrice": 0.6,
"askVolume": 1,
"delta": 0.43674,
"gamma": 0.27447,
"theta": -455.46028,
"vega": 0.00385,
"rho": 0
},
{
"option": { "market": 1, "code": "SPY260612C745000" },
"name": "SPY 260612 745.00C",
"optionType": 1,
"oiIncrement": 5416,
"volume": 617981,
"turnover": 44479304,
"openInterest": 17013,
"iv": 87.067,
"optionPrice": 0.01,
"changeRate": -98.958,
"midPrice": 0.015,
"bidPrice": 0.01,
"bidVolume": 708,
"askPrice": 0.02,
"askVolume": 500,
"delta": 0.02438,
"gamma": 0.03501,
"theta": -18.5231,
"vega": 0.00107,
"rho": 0
}
],
"allCount": 1955829
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
接口限制
- 30 秒內最多請求 60 次期權合約排行接口(支持分頁的接口,僅首次調用納入統計)