# Option Market Statistics
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_option_market_statistic(option_market, data_type, begin_time=None, end_time=None, page_req_key=None)
Description
Get option market statistics (volume/open interest), returns call, put, and total values by trading day granularity, with pagination support.
Parameters
Parameter Type Description option_market OptionMarket Option market type US_SECURITY=US equity options, US_INDEX=US index options, HK_SECURITY=HK equity options, HK_INDEX=HK index optionsdata_type OptionStatisticDataType Data type VOLUME=Volume, OPEN_INTEREST=Open interestbegin_time str Start date, format 'YYYY-MM-DD' If not specified, defaults to data from the past yearend_time str End date, format 'YYYY-MM-DD' Time span with begin_time must not exceed one yearpage_req_key bytes Pagination request key Pass None for the first request, pass the previously returned value for subsequent requestsReturns
Parameter Type Description ret RET_CODE Interface call result data pandas.DataFrame When ret == RET_OK, returns statistics data str When ret != RET_OK, returns error description page_req_key bytes Next page key, None indicates no more data Returned DataFrame fields:
Field Type Description time str Trading day time string timestamp float Trading day timestamp (Unix seconds) call_value int Call option total value put_value int Put option total value total_value int Total value (call_value + put_value) ratio float Put/Call ratio N/A when call_value is 0
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data, page_req_key = quote_ctx.get_option_market_statistic(
OptionMarket.US_SECURITY,
OptionStatisticDataType.VOLUME,
begin_time='2026-06-01',
end_time='2026-06-15'
)
if ret == RET_OK:
print(data)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
- Output
time timestamp call_value put_value total_value ratio
0 2026-06-12 1.781237e+09 45658870 28723978 74382848 0.629100
1 2026-06-11 1.781150e+09 38303062 30520043 68823105 0.796804
2 2026-06-10 1.781064e+09 35371830 30180004 65551834 0.853221
3 2026-06-09 1.780978e+09 42880655 36646152 79526807 0.854608
4 2026-06-08 1.780891e+09 35442266 25811533 61253799 0.728270
5 2026-06-05 1.780632e+09 52362998 44023321 96386319 0.840733
6 2026-06-04 1.780546e+09 38082169 24572137 62654306 0.645240
7 2026-06-03 1.780459e+09 36858233 23035404 59893637 0.624973
8 2026-06-02 1.780373e+09 36822706 21026201 57848907 0.571012
9 2026-06-01 1.780286e+09 42932185 24084036 67016221 0.560979
2
3
4
5
6
7
8
9
10
11
# Qot_GetOptionMarketStatistic.proto
Description
Get option market statistics data
Parameters
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket, option market type
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType, data type (volume or open interest)
required string beginTime = 3; //Start time string
required string endTime = 4; //End time string, auto-paginates when span exceeds one year
optional bytes nextPageKey = 5; //Pagination key, leave empty for first page, fill with nextPageKey from previous page
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Returns
//Daily statistics
message StatisticItem
{
required string time = 1; //Trading day time string
optional double timestamp = 2; //Trading day timestamp
required int64 callValue = 3; //Call option total (volume or open interest, determined by requested dataType)
required int64 putValue = 4; //Put option total
optional int64 totalValue = 5; //Total value (callValue + putValue)
optional double ratio = 6; //Put/Call ratio (not set when callValue is 0)
}
message S2C
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket, option market type
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType, data type
repeated StatisticItem statisticList = 3; //Statistics data list, sorted by trading day descending
optional bytes nextPageKey = 4; //Pagination key, has value means more data available
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType, return result
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
- Interface call result, see RetType
Protocol ID
3301
uint GetOptionMarketStatistic(Qot_GetOptionMarketStatistic.Request req); virtual void OnReply_GetOptionMarketStatistic(FTAPI_Conn client, uint nSerialNo, Qot_GetOptionMarketStatistic.Response rsp);
Description
Get option market statistics data
Parameters
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket, option market type
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType, data type (volume or open interest)
required string beginTime = 3; //Start time string
required string endTime = 4; //End time string, auto-paginates when span exceeds one year
optional bytes nextPageKey = 5; //Pagination key, leave empty for first page, fill with nextPageKey from previous page
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Returns
//Daily statistics
message StatisticItem
{
required string time = 1; //Trading day time string
optional double timestamp = 2; //Trading day timestamp
required int64 callValue = 3; //Call option total (volume or open interest, determined by requested dataType)
required int64 putValue = 4; //Put option total
optional int64 totalValue = 5; //Total value (callValue + putValue)
optional double ratio = 6; //Put/Call ratio (not set when callValue is 0)
}
message S2C
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket, option market type
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType, data type
repeated StatisticItem statisticList = 3; //Statistics data list, sorted by trading day descending
optional bytes nextPageKey = 4; //Pagination key, has value means more data available
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType, return result
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
- Interface call result, see RetType
Protocol ID
3301
int getOptionMarketStatistic(Qot_GetOptionMarketStatistic.Request req) onReply_GetOptionMarketStatistic(FTAPI_Conn client, int nSerialNo, Qot_GetOptionMarketStatistic.Response rsp)
Description
Get option market statistics data
Parameters
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket, option market type
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType, data type (volume or open interest)
required string beginTime = 3; //Start time string
required string endTime = 4; //End time string, auto-paginates when span exceeds one year
optional bytes nextPageKey = 5; //Pagination key, leave empty for first page, fill with nextPageKey from previous page
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Returns
//Daily statistics
message StatisticItem
{
required string time = 1; //Trading day time string
optional double timestamp = 2; //Trading day timestamp
required int64 callValue = 3; //Call option total (volume or open interest, determined by requested dataType)
required int64 putValue = 4; //Put option total
optional int64 totalValue = 5; //Total value (callValue + putValue)
optional double ratio = 6; //Put/Call ratio (not set when callValue is 0)
}
message S2C
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket, option market type
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType, data type
repeated StatisticItem statisticList = 3; //Statistics data list, sorted by trading day descending
optional bytes nextPageKey = 4; //Pagination key, has value means more data available
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType, return result
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
- Interface call result, see RetType
Protocol ID
3301
Futu::u32_t GetOptionMarketStatistic(const Qot_GetOptionMarketStatistic::Request &stReq);
virtual void OnReply_GetOptionMarketStatistic(Futu::u32_t nSerialNo, const Qot_GetOptionMarketStatistic::Response &stRsp) = 0;
Description
Get option market statistics data
Parameters
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket, option market type
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType, data type (volume or open interest)
required string beginTime = 3; //Start time string
required string endTime = 4; //End time string, auto-paginates when span exceeds one year
optional bytes nextPageKey = 5; //Pagination key, leave empty for first page, fill with nextPageKey from previous page
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Returns
//Daily statistics
message StatisticItem
{
required string time = 1; //Trading day time string
optional double timestamp = 2; //Trading day timestamp
required int64 callValue = 3; //Call option total (volume or open interest, determined by requested dataType)
required int64 putValue = 4; //Put option total
optional int64 totalValue = 5; //Total value (callValue + putValue)
optional double ratio = 6; //Put/Call ratio (not set when callValue is 0)
}
message S2C
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket, option market type
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType, data type
repeated StatisticItem statisticList = 3; //Statistics data list, sorted by trading day descending
optional bytes nextPageKey = 4; //Pagination key, has value means more data available
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType, return result
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
- Interface call result, see RetType
Protocol ID
3301
Example
class Program : public FTSPI_Qot, public FTSPI_Conn
{
public:
Program() {
m_pQotApi = FTAPI::CreateQotApi();
m_pQotApi->RegisterQotSpi(this);
m_pQotApi->RegisterConnSpi(this);
}
~Program() {
if (m_pQotApi != nullptr) {
m_pQotApi->UnregisterQotSpi();
m_pQotApi->UnregisterConnSpi();
FTAPI::ReleaseQotApi(m_pQotApi);
m_pQotApi = nullptr;
}
}
void Start() {
m_pQotApi->InitConnect("127.0.0.1", 11111, false);
}
virtual void OnInitConnect(FTAPI_Conn* pConn, Futu::i64_t nErrCode, const char* strDesc) {
Qot_GetOptionMarketStatistic::Request req;
Qot_GetOptionMarketStatistic::C2S *c2s = req.mutable_c2s();
// TODO: populate c2s fields per proto
m_GetOptionMarketStatisticSerialNo = m_pQotApi->GetOptionMarketStatistic(req);
}
virtual void OnReply_GetOptionMarketStatistic(Futu::u32_t nSerialNo, const Qot_GetOptionMarketStatistic::Response &stRsp) {
if (nSerialNo != m_GetOptionMarketStatisticSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
FTAPI_Qot *m_pQotApi;
Futu::u32_t m_GetOptionMarketStatisticSerialNo = 0;
};
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
getOptionMarketStatistic(qotGetOptionMarketStatistic)
Description
Get option market statistics data
Parameters
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket, option market type
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType, data type (volume or open interest)
required string beginTime = 3; //Start time string
required string endTime = 4; //End time string, auto-paginates when span exceeds one year
optional bytes nextPageKey = 5; //Pagination key, leave empty for first page, fill with nextPageKey from previous page
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Returns
//Daily statistics
message StatisticItem
{
required string time = 1; //Trading day time string
optional double timestamp = 2; //Trading day timestamp
required int64 callValue = 3; //Call option total (volume or open interest, determined by requested dataType)
required int64 putValue = 4; //Put option total
optional int64 totalValue = 5; //Total value (callValue + putValue)
optional double ratio = 6; //Put/Call ratio (not set when callValue is 0)
}
message S2C
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket, option market type
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType, data type
repeated StatisticItem statisticList = 3; //Statistics data list, sorted by trading day descending
optional bytes nextPageKey = 4; //Pagination key, has value means more data available
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType, return result
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
- Interface call result, see RetType
Protocol ID
3301
Example
import ftWebsocket from "futu-api";
import { Common, Qot_OptionCommon } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetOptionMarketStatistic(){
const { RetType } = Common
const { OptionMarket, OptionStatisticDataType } = Qot_OptionCommon
let [addr, port, enable_ssl, key] = ["127.0.0.1", 11112, false, ''];
let websocket = new ftWebsocket();
websocket.onlogin = (ret, msg)=>{
if (ret) {
const req = {
c2s: {
optionMarket: OptionMarket.OptionMarket_US_Security,
dataType: OptionStatisticDataType.OptionStatisticDataType_Volume,
beginTime: '2026-06-01',
endTime: '2026-06-15',
},
};
websocket.GetOptionMarketStatistic(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetOptionMarketStatistic: errCode %d, retMsg %s, retType %d", errCode, retMsg, retType);
if(retType == RetType.RetType_Succeed){
let data = beautify(JSON.stringify(s2c), { indent_size: 2, space_in_empty_paren: true });
console.log(data);
}
})
.catch((error)=>{ console.log("error:", error); });
} else {
console.log("start error", msg);
}
};
websocket.start(addr, port, enable_ssl, key);
setTimeout(()=>{ websocket.stop(); process.exit(); }, 5000);
}
QotGetOptionMarketStatistic()
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
- Output
GetOptionMarketStatistic: errCode 0, retMsg , retType 0
{
"optionMarket": 1,
"dataType": 0,
"statisticList": [
{
"time": "2026-06-12",
"timestamp": 1781237000,
"callValue": 45658870,
"putValue": 28723978,
"totalValue": 74382848,
"ratio": 0.6291
},
{
"time": "2026-06-11",
"timestamp": 1781150000,
"callValue": 38303062,
"putValue": 30520043,
"totalValue": 68823105,
"ratio": 0.796804
},
{
"time": "2026-06-10",
"timestamp": 1781064000,
"callValue": 35371830,
"putValue": 30180004,
"totalValue": 65551834,
"ratio": 0.853221
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Rate Limit
- Maximum 60 requests per 30 seconds for the option market statistics interface (for paginated interfaces, only the first call counts)
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_option_market_statistic(option_market, data_type, begin_time=None, end_time=None, page_req_key=None)
Description
Get option market statistics (volume/open interest), returns call, put, and total values by trading day granularity, with pagination support.
Parameters
Parameter Type Description option_market OptionMarket Option market type US_SECURITY=US equity options, US_INDEX=US index options, HK_SECURITY=HK equity options, HK_INDEX=HK index optionsdata_type OptionStatisticDataType Data type VOLUME=Volume, OPEN_INTEREST=Open interestbegin_time str Start date, format 'YYYY-MM-DD' If not specified, defaults to data from the past yearend_time str End date, format 'YYYY-MM-DD' Time span with begin_time must not exceed one yearpage_req_key bytes Pagination request key Pass None for the first request, pass the previously returned value for subsequent requestsReturns
Parameter Type Description ret RET_CODE Interface call result data pandas.DataFrame When ret == RET_OK, returns statistics data str When ret != RET_OK, returns error description page_req_key bytes Next page key, None indicates no more data Returned DataFrame fields:
Field Type Description time str Trading day time string timestamp float Trading day timestamp (Unix seconds) call_value int Call option total value put_value int Put option total value total_value int Total value (call_value + put_value) ratio float Put/Call ratio N/A when call_value is 0
Example
from moomoo import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data, page_req_key = quote_ctx.get_option_market_statistic(
OptionMarket.US_SECURITY,
OptionStatisticDataType.VOLUME,
begin_time='2026-06-01',
end_time='2026-06-15'
)
if ret == RET_OK:
print(data)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
- Output
time timestamp call_value put_value total_value ratio
0 2026-06-12 1.781237e+09 45658870 28723978 74382848 0.629100
1 2026-06-11 1.781150e+09 38303062 30520043 68823105 0.796804
2 2026-06-10 1.781064e+09 35371830 30180004 65551834 0.853221
3 2026-06-09 1.780978e+09 42880655 36646152 79526807 0.854608
4 2026-06-08 1.780891e+09 35442266 25811533 61253799 0.728270
5 2026-06-05 1.780632e+09 52362998 44023321 96386319 0.840733
6 2026-06-04 1.780546e+09 38082169 24572137 62654306 0.645240
7 2026-06-03 1.780459e+09 36858233 23035404 59893637 0.624973
8 2026-06-02 1.780373e+09 36822706 21026201 57848907 0.571012
9 2026-06-01 1.780286e+09 42932185 24084036 67016221 0.560979
2
3
4
5
6
7
8
9
10
11
# Qot_GetOptionMarketStatistic.proto
Description
Get option market statistics data
Parameters
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket, option market type
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType, data type (volume or open interest)
required string beginTime = 3; //Start time string
required string endTime = 4; //End time string, auto-paginates when span exceeds one year
optional bytes nextPageKey = 5; //Pagination key, leave empty for first page, fill with nextPageKey from previous page
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Returns
//Daily statistics
message StatisticItem
{
required string time = 1; //Trading day time string
optional double timestamp = 2; //Trading day timestamp
required int64 callValue = 3; //Call option total (volume or open interest, determined by requested dataType)
required int64 putValue = 4; //Put option total
optional int64 totalValue = 5; //Total value (callValue + putValue)
optional double ratio = 6; //Put/Call ratio (not set when callValue is 0)
}
message S2C
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket, option market type
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType, data type
repeated StatisticItem statisticList = 3; //Statistics data list, sorted by trading day descending
optional bytes nextPageKey = 4; //Pagination key, has value means more data available
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType, return result
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
- Interface call result, see RetType
Protocol ID
3301
uint GetOptionMarketStatistic(Qot_GetOptionMarketStatistic.Request req); virtual void OnReply_GetOptionMarketStatistic(MMAPI_Conn client, uint nSerialNo, Qot_GetOptionMarketStatistic.Response rsp);
Description
Get option market statistics data
Parameters
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket, option market type
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType, data type (volume or open interest)
required string beginTime = 3; //Start time string
required string endTime = 4; //End time string, auto-paginates when span exceeds one year
optional bytes nextPageKey = 5; //Pagination key, leave empty for first page, fill with nextPageKey from previous page
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Returns
//Daily statistics
message StatisticItem
{
required string time = 1; //Trading day time string
optional double timestamp = 2; //Trading day timestamp
required int64 callValue = 3; //Call option total (volume or open interest, determined by requested dataType)
required int64 putValue = 4; //Put option total
optional int64 totalValue = 5; //Total value (callValue + putValue)
optional double ratio = 6; //Put/Call ratio (not set when callValue is 0)
}
message S2C
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket, option market type
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType, data type
repeated StatisticItem statisticList = 3; //Statistics data list, sorted by trading day descending
optional bytes nextPageKey = 4; //Pagination key, has value means more data available
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType, return result
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
- Interface call result, see RetType
Protocol ID
3301
int getOptionMarketStatistic(Qot_GetOptionMarketStatistic.Request req) onReply_GetOptionMarketStatistic(MMAPI_Conn client, int nSerialNo, Qot_GetOptionMarketStatistic.Response rsp)
Description
Get option market statistics data
Parameters
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket, option market type
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType, data type (volume or open interest)
required string beginTime = 3; //Start time string
required string endTime = 4; //End time string, auto-paginates when span exceeds one year
optional bytes nextPageKey = 5; //Pagination key, leave empty for first page, fill with nextPageKey from previous page
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Returns
//Daily statistics
message StatisticItem
{
required string time = 1; //Trading day time string
optional double timestamp = 2; //Trading day timestamp
required int64 callValue = 3; //Call option total (volume or open interest, determined by requested dataType)
required int64 putValue = 4; //Put option total
optional int64 totalValue = 5; //Total value (callValue + putValue)
optional double ratio = 6; //Put/Call ratio (not set when callValue is 0)
}
message S2C
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket, option market type
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType, data type
repeated StatisticItem statisticList = 3; //Statistics data list, sorted by trading day descending
optional bytes nextPageKey = 4; //Pagination key, has value means more data available
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType, return result
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
- Interface call result, see RetType
Protocol ID
3301
Moomoo::u32_t GetOptionMarketStatistic(const Qot_GetOptionMarketStatistic::Request &stReq);
virtual void OnReply_GetOptionMarketStatistic(Moomoo::u32_t nSerialNo, const Qot_GetOptionMarketStatistic::Response &stRsp) = 0;
Description
Get option market statistics data
Parameters
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket, option market type
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType, data type (volume or open interest)
required string beginTime = 3; //Start time string
required string endTime = 4; //End time string, auto-paginates when span exceeds one year
optional bytes nextPageKey = 5; //Pagination key, leave empty for first page, fill with nextPageKey from previous page
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Returns
//Daily statistics
message StatisticItem
{
required string time = 1; //Trading day time string
optional double timestamp = 2; //Trading day timestamp
required int64 callValue = 3; //Call option total (volume or open interest, determined by requested dataType)
required int64 putValue = 4; //Put option total
optional int64 totalValue = 5; //Total value (callValue + putValue)
optional double ratio = 6; //Put/Call ratio (not set when callValue is 0)
}
message S2C
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket, option market type
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType, data type
repeated StatisticItem statisticList = 3; //Statistics data list, sorted by trading day descending
optional bytes nextPageKey = 4; //Pagination key, has value means more data available
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType, return result
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
- Interface call result, see RetType
Protocol ID
3301
Example
class Program : public MMSPI_Qot, public MMSPI_Conn
{
public:
Program() {
m_pQotApi = MMAPI::CreateQotApi();
m_pQotApi->RegisterQotSpi(this);
m_pQotApi->RegisterConnSpi(this);
}
~Program() {
if (m_pQotApi != nullptr) {
m_pQotApi->UnregisterQotSpi();
m_pQotApi->UnregisterConnSpi();
MMAPI::ReleaseQotApi(m_pQotApi);
m_pQotApi = nullptr;
}
}
void Start() {
m_pQotApi->InitConnect("127.0.0.1", 11111, false);
}
virtual void OnInitConnect(MMAPI_Conn* pConn, Moomoo::i64_t nErrCode, const char* strDesc) {
Qot_GetOptionMarketStatistic::Request req;
Qot_GetOptionMarketStatistic::C2S *c2s = req.mutable_c2s();
// TODO: populate c2s fields per proto
m_GetOptionMarketStatisticSerialNo = m_pQotApi->GetOptionMarketStatistic(req);
}
virtual void OnReply_GetOptionMarketStatistic(Moomoo::u32_t nSerialNo, const Qot_GetOptionMarketStatistic::Response &stRsp) {
if (nSerialNo != m_GetOptionMarketStatisticSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
MMAPI_Qot *m_pQotApi;
Moomoo::u32_t m_GetOptionMarketStatisticSerialNo = 0;
};
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
getOptionMarketStatistic(qotGetOptionMarketStatistic)
Description
Get option market statistics data
Parameters
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket, option market type
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType, data type (volume or open interest)
required string beginTime = 3; //Start time string
required string endTime = 4; //End time string, auto-paginates when span exceeds one year
optional bytes nextPageKey = 5; //Pagination key, leave empty for first page, fill with nextPageKey from previous page
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Returns
//Daily statistics
message StatisticItem
{
required string time = 1; //Trading day time string
optional double timestamp = 2; //Trading day timestamp
required int64 callValue = 3; //Call option total (volume or open interest, determined by requested dataType)
required int64 putValue = 4; //Put option total
optional int64 totalValue = 5; //Total value (callValue + putValue)
optional double ratio = 6; //Put/Call ratio (not set when callValue is 0)
}
message S2C
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket, option market type
required int32 dataType = 2; //Qot_OptionCommon.OptionStatisticDataType, data type
repeated StatisticItem statisticList = 3; //Statistics data list, sorted by trading day descending
optional bytes nextPageKey = 4; //Pagination key, has value means more data available
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType, return result
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
- Interface call result, see RetType
Protocol ID
3301
Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_OptionCommon } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetOptionMarketStatistic(){
const { RetType } = Common
const { OptionMarket, OptionStatisticDataType } = Qot_OptionCommon
let [addr, port, enable_ssl, key] = ["127.0.0.1", 11112, false, ''];
let websocket = new mmWebsocket();
websocket.onlogin = (ret, msg)=>{
if (ret) {
const req = {
c2s: {
optionMarket: OptionMarket.OptionMarket_US_Security,
dataType: OptionStatisticDataType.OptionStatisticDataType_Volume,
beginTime: '2026-06-01',
endTime: '2026-06-15',
},
};
websocket.GetOptionMarketStatistic(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetOptionMarketStatistic: errCode %d, retMsg %s, retType %d", errCode, retMsg, retType);
if(retType == RetType.RetType_Succeed){
let data = beautify(JSON.stringify(s2c), { indent_size: 2, space_in_empty_paren: true });
console.log(data);
}
})
.catch((error)=>{ console.log("error:", error); });
} else {
console.log("start error", msg);
}
};
websocket.start(addr, port, enable_ssl, key);
setTimeout(()=>{ websocket.stop(); process.exit(); }, 5000);
}
QotGetOptionMarketStatistic()
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
- Output
GetOptionMarketStatistic: errCode 0, retMsg , retType 0
{
"optionMarket": 1,
"dataType": 0,
"statisticList": [
{
"time": "2026-06-12",
"timestamp": 1781237000,
"callValue": 45658870,
"putValue": 28723978,
"totalValue": 74382848,
"ratio": 0.6291
},
{
"time": "2026-06-11",
"timestamp": 1781150000,
"callValue": 38303062,
"putValue": 30520043,
"totalValue": 68823105,
"ratio": 0.796804
},
{
"time": "2026-06-10",
"timestamp": 1781064000,
"callValue": 35371830,
"putValue": 30180004,
"totalValue": 65551834,
"ratio": 0.853221
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Rate Limit
- Maximum 60 requests per 30 seconds for the option market statistics interface (for paginated interfaces, only the first call counts)