# 期權標的歷史統計
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_option_underlying_his_statistic(code, index_option_type=IndexOptionType.NORMAL, begin_time=None, end_time=None, page_req_key=None)
介紹
獲取期權標的歷史統計數據,按交易日返回該標的對應期權的成交量、持倉量及 Put/Call 比率時間序列,支持分頁。
參數
參數 類型 說明 code str 標的股票代碼 如 'US.AAPL'index_option_type IndexOptionType 指數期權類型 NORMAL=普通期權(默認)、SMALL=小型指數期權begin_time str 開始日期,格式 'YYYY-MM-DD' 不傳默認 end_time 往前推 364 天end_time str 結束日期,格式 'YYYY-MM-DD' 與 begin_time 跨度最多 364 天page_req_key bytes 分頁請求 key 首次傳 None,續拉傳上次返回值返回
參數 類型 說明 ret RET_CODE 接口調用結果 data pandas.DataFrame 當 ret == RET_OK,返回統計數據 str 當 ret != RET_OK,返回錯誤描述 page_req_key bytes 下一頁 key,None 表示無更多數據 返回 DataFrame 字段:
字段 類型 說明 code str 股票代碼 name str 股票名稱 time str 交易日時間字符串 timestamp float 交易日時間戳(Unix 秒) option_volume int 期權總成交量(call_volume + put_volume) call_volume int 看漲期權成交量 put_volume int 看跌期權成交量 put_call_volume_ratio float Put/Call 成交量比 option_open_interest int 期權總持倉量 call_open_interest int 看漲期權持倉量(T-1 延遲) put_open_interest int 看跌期權持倉量(T-1 延遲) put_call_open_interest_ratio float Put/Call 持倉量比 underlying_price float 標的價格
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data, page_req_key = quote_ctx.get_option_underlying_his_statistic(
'US.AAPL',
begin_time='2026-06-01',
end_time='2026-06-15'
)
if ret == RET_OK:
print(data)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- Output
code name time timestamp option_volume call_volume put_volume put_call_volume_ratio option_open_interest call_open_interest put_open_interest put_call_open_interest_ratio underlying_price
0 US.AAPL Apple 2026-06-12 1.781237e+09 1273240 782941 490299 0.626227 0 0 0 N/A 291.13
1 US.AAPL Apple 2026-06-11 1.781150e+09 950737 580535 370202 0.637691 5403058 3165108 2237950 0.707069 295.63
2 US.AAPL Apple 2026-06-10 1.781064e+09 1734799 1039630 695169 0.668670 5522747 3270454 2252293 0.688679 291.58
3 US.AAPL Apple 2026-06-09 1.780978e+09 1715749 1024046 691703 0.675461 5405022 3209586 2195436 0.684025 290.55
4 US.AAPL Apple 2026-06-08 1.780891e+09 2179789 1293656 886133 0.684983 5350402 3142828 2207574 0.702416 301.54
...
2
3
4
5
6
7
# Qot_GetOptionUnderlyingHisStatistic.proto
介紹
獲取期權標的歷史統計數據
參數
message C2S
{
required Qot_Common.Security owner = 1; //期權標的股
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType
required string beginTime = 3; //開始時間字符串
required string endTime = 4; //結束時間字符串
optional bytes nextPageKey = 5; //分頁請求的key
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 返回
message DailyStatistic
{
required string time = 1; //交易日時間字符串
optional double timestamp = 2; //交易日時間戳
optional int64 optionVolume = 3; //期權總成交量
required int64 callVolume = 4; //看漲期權成交量
required int64 putVolume = 5; //看跌期權成交量
optional double putCallVolumeRatio = 6; //Put/Call成交量比
optional int64 optionOpenInterest = 7; //期權總持倉量
required int64 callOpenInterest = 8; //看漲期權持倉量
required int64 putOpenInterest = 9; //看跌期權持倉量
optional double putCallOpenInterestRatio = 10; //Put/Call持倉量比
optional double underlyingPrice = 11; //標的價格
}
message S2C
{
required Qot_Common.Security owner = 1; //期權標的股
optional string code = 2; //股票代碼
optional string name = 3; //股票名稱
repeated DailyStatistic statisticList = 4; //統計數據列表,按交易日降序
optional bytes nextPageKey = 5; //分頁請求的key
}
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
- 接口調用結果,結構參見 RetType
協議 ID
3302
uint GetOptionUnderlyingHisStatistic(Qot_GetOptionUnderlyingHisStatistic.Request req); virtual void OnReply_GetOptionUnderlyingHisStatistic(FTAPI_Conn client, uint nSerialNo, Qot_GetOptionUnderlyingHisStatistic.Response rsp);
介紹
獲取期權標的歷史統計數據
參數
message C2S
{
required Qot_Common.Security owner = 1; //期權標的股
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType
required string beginTime = 3; //開始時間字符串
required string endTime = 4; //結束時間字符串
optional bytes nextPageKey = 5; //分頁請求的key
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 返回
message DailyStatistic
{
required string time = 1; //交易日時間字符串
optional double timestamp = 2; //交易日時間戳
optional int64 optionVolume = 3; //期權總成交量
required int64 callVolume = 4; //看漲期權成交量
required int64 putVolume = 5; //看跌期權成交量
optional double putCallVolumeRatio = 6; //Put/Call成交量比
optional int64 optionOpenInterest = 7; //期權總持倉量
required int64 callOpenInterest = 8; //看漲期權持倉量
required int64 putOpenInterest = 9; //看跌期權持倉量
optional double putCallOpenInterestRatio = 10; //Put/Call持倉量比
optional double underlyingPrice = 11; //標的價格
}
message S2C
{
required Qot_Common.Security owner = 1; //期權標的股
optional string code = 2; //股票代碼
optional string name = 3; //股票名稱
repeated DailyStatistic statisticList = 4; //統計數據列表,按交易日降序
optional bytes nextPageKey = 5; //分頁請求的key
}
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
- 接口調用結果,結構參見 RetType
協議 ID
3302
Example
public class Program : FTSPI_Qot, FTSPI_Conn
{
FTAPI_Qot qot = new FTAPI_Qot();
public Program()
{
qot.SetClientInfo("csharp", 1);
qot.SetConnCallback(this);
qot.SetQotCallback(this);
}
public void Start()
{
qot.InitConnect("127.0.0.1", (ushort)11111, false);
}
public void OnInitConnect(FTAPI_Conn client, long errCode, String desc)
{
if (errCode != 0) return;
var c2s = Qot_GetOptionUnderlyingHisStatistic.C2S.CreateBuilder()
// TODO: 按 proto 填充 c2s 字段
.Build();
var req = Qot_GetOptionUnderlyingHisStatistic.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetOptionUnderlyingHisStatistic(req);
Console.Write("Send GetOptionUnderlyingHisStatistic: {0}\n", seqNo);
}
public void OnReply_GetOptionUnderlyingHisStatistic(FTAPI_Conn client, uint nSerialNo, Qot_GetOptionUnderlyingHisStatistic.Response rsp)
{
Console.Write("Reply: {0} {1}\n", nSerialNo, rsp.ToString());
}
public static void Main(String[] args)
{
FTAPI.Init();
new Program().Start();
while (true) Thread.Sleep(1000 * 600);
}
}
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
Send GetOptionUnderlyingHisStatistic: 1
Reply: 1 {
"time": "2026-06-11",
"timestamp": 1781150000,
"optionVolume": 950737,
"callVolume": 580535,
"putVolume": 370202,
"putCallVolumeRatio": 0.637691,
"optionOpenInterest": 5403058,
"callOpenInterest": 3165108,
"putOpenInterest": 2237950,
"putCallOpenInterestRatio": 0.707069,
"underlyingPrice": 295.63
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
int getOptionUnderlyingHisStatistic(Qot_GetOptionUnderlyingHisStatistic.Request req) onReply_GetOptionUnderlyingHisStatistic(FTAPI_Conn client, int nSerialNo, Qot_GetOptionUnderlyingHisStatistic.Response rsp)
介紹
獲取期權標的歷史統計數據
參數
message C2S
{
required Qot_Common.Security owner = 1; //期權標的股
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType
required string beginTime = 3; //開始時間字符串
required string endTime = 4; //結束時間字符串
optional bytes nextPageKey = 5; //分頁請求的key
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 返回
message DailyStatistic
{
required string time = 1; //交易日時間字符串
optional double timestamp = 2; //交易日時間戳
optional int64 optionVolume = 3; //期權總成交量
required int64 callVolume = 4; //看漲期權成交量
required int64 putVolume = 5; //看跌期權成交量
optional double putCallVolumeRatio = 6; //Put/Call成交量比
optional int64 optionOpenInterest = 7; //期權總持倉量
required int64 callOpenInterest = 8; //看漲期權持倉量
required int64 putOpenInterest = 9; //看跌期權持倉量
optional double putCallOpenInterestRatio = 10; //Put/Call持倉量比
optional double underlyingPrice = 11; //標的價格
}
message S2C
{
required Qot_Common.Security owner = 1; //期權標的股
optional string code = 2; //股票代碼
optional string name = 3; //股票名稱
repeated DailyStatistic statisticList = 4; //統計數據列表,按交易日降序
optional bytes nextPageKey = 5; //分頁請求的key
}
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
- 接口調用結果,結構參見 RetType
協議 ID
3302
Example
public class Program implements FTSPI_Qot, FTSPI_Conn {
private FTAPI_Conn_Qot qot = new FTAPI_Conn_Qot();
public Program() {
qot.setClientInfo("java", 1);
qot.setConnCallback(this);
qot.setQotCallback(this);
}
public void start() {
qot.initConnect("127.0.0.1", (short) 11111, false);
}
@Override
public void onInitConnect(FTAPI_Conn client, long errCode, String desc) {
if (errCode != 0) return;
Qot_GetOptionUnderlyingHisStatistic.C2S c2s = Qot_GetOptionUnderlyingHisStatistic.C2S.newBuilder()
// TODO: 按 proto 填充 c2s 字段
.build();
Qot_GetOptionUnderlyingHisStatistic.Request req = Qot_GetOptionUnderlyingHisStatistic.Request.newBuilder()
.setC2S(c2s).build();
int seqNo = qot.getOptionUnderlyingHisStatistic(req);
System.out.println("Send getOptionUnderlyingHisStatistic: " + seqNo);
}
@Override
public void onReply_GetOptionUnderlyingHisStatistic(FTAPI_Conn client, int nSerialNo, Qot_GetOptionUnderlyingHisStatistic.Response rsp) {
System.out.println("Reply: " + nSerialNo + " " + rsp.toString());
}
public static void main(String[] args) {
FTAPI.init();
new Program().start();
while (true) {
try { Thread.sleep(1000 * 600); } catch (InterruptedException e) {}
}
}
}
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
Send getOptionUnderlyingHisStatistic: 1
Reply: 1 {
"time": "2026-06-11",
"timestamp": 1781150000,
"optionVolume": 950737,
"callVolume": 580535,
"putVolume": 370202,
"putCallVolumeRatio": 0.637691,
"optionOpenInterest": 5403058,
"callOpenInterest": 3165108,
"putOpenInterest": 2237950,
"putCallOpenInterestRatio": 0.707069,
"underlyingPrice": 295.63
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Futu::u32_t GetOptionUnderlyingHisStatistic(const Qot_GetOptionUnderlyingHisStatistic::Request &stReq);
virtual void OnReply_GetOptionUnderlyingHisStatistic(Futu::u32_t nSerialNo, const Qot_GetOptionUnderlyingHisStatistic::Response &stRsp) = 0;
介紹
獲取期權標的歷史統計數據
參數
message C2S
{
required Qot_Common.Security owner = 1; //期權標的股
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType
required string beginTime = 3; //開始時間字符串
required string endTime = 4; //結束時間字符串
optional bytes nextPageKey = 5; //分頁請求的key
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 返回
message DailyStatistic
{
required string time = 1; //交易日時間字符串
optional double timestamp = 2; //交易日時間戳
optional int64 optionVolume = 3; //期權總成交量
required int64 callVolume = 4; //看漲期權成交量
required int64 putVolume = 5; //看跌期權成交量
optional double putCallVolumeRatio = 6; //Put/Call成交量比
optional int64 optionOpenInterest = 7; //期權總持倉量
required int64 callOpenInterest = 8; //看漲期權持倉量
required int64 putOpenInterest = 9; //看跌期權持倉量
optional double putCallOpenInterestRatio = 10; //Put/Call持倉量比
optional double underlyingPrice = 11; //標的價格
}
message S2C
{
required Qot_Common.Security owner = 1; //期權標的股
optional string code = 2; //股票代碼
optional string name = 3; //股票名稱
repeated DailyStatistic statisticList = 4; //統計數據列表,按交易日降序
optional bytes nextPageKey = 5; //分頁請求的key
}
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
- 接口調用結果,結構參見 RetType
協議 ID
3302
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_GetOptionUnderlyingHisStatistic::Request req;
Qot_GetOptionUnderlyingHisStatistic::C2S *c2s = req.mutable_c2s();
// TODO: 按 proto 填充 c2s 字段
m_GetOptionUnderlyingHisStatisticSerialNo = m_pQotApi->GetOptionUnderlyingHisStatistic(req);
}
virtual void OnReply_GetOptionUnderlyingHisStatistic(Futu::u32_t nSerialNo, const Qot_GetOptionUnderlyingHisStatistic::Response &stRsp) {
if (nSerialNo != m_GetOptionUnderlyingHisStatisticSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
FTAPI_Qot *m_pQotApi;
Futu::u32_t m_GetOptionUnderlyingHisStatisticSerialNo = 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
getOptionUnderlyingHisStatistic(qotGetOptionUnderlyingHisStatistic)
介紹
獲取期權標的歷史統計數據
參數
message C2S
{
required Qot_Common.Security owner = 1; //期權標的股
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType
required string beginTime = 3; //開始時間字符串
required string endTime = 4; //結束時間字符串
optional bytes nextPageKey = 5; //分頁請求的key
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 返回
message DailyStatistic
{
required string time = 1; //交易日時間字符串
optional double timestamp = 2; //交易日時間戳
optional int64 optionVolume = 3; //期權總成交量
required int64 callVolume = 4; //看漲期權成交量
required int64 putVolume = 5; //看跌期權成交量
optional double putCallVolumeRatio = 6; //Put/Call成交量比
optional int64 optionOpenInterest = 7; //期權總持倉量
required int64 callOpenInterest = 8; //看漲期權持倉量
required int64 putOpenInterest = 9; //看跌期權持倉量
optional double putCallOpenInterestRatio = 10; //Put/Call持倉量比
optional double underlyingPrice = 11; //標的價格
}
message S2C
{
required Qot_Common.Security owner = 1; //期權標的股
optional string code = 2; //股票代碼
optional string name = 3; //股票名稱
repeated DailyStatistic statisticList = 4; //統計數據列表,按交易日降序
optional bytes nextPageKey = 5; //分頁請求的key
}
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
- 接口調用結果,結構參見 RetType
協議 ID
3302
Example
import ftWebsocket from "futu-api";
import { Common, Qot_Common } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetOptionUnderlyingHisStatistic(){
const { RetType } = Common
const { QotMarket } = Qot_Common
let [addr, port, enable_ssl, key] = ["127.0.0.1", 11112, false, ''];
let websocket = new ftWebsocket();
websocket.onlogin = (ret, msg)=>{
if (ret) {
const req = {
c2s: {
owner: { market: QotMarket.QotMarket_US_Security, code: 'AAPL' },
beginTime: '2026-06-01',
endTime: '2026-06-15',
},
};
websocket.GetOptionUnderlyingHisStatistic(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetOptionUnderlyingHisStatistic: 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);
}
QotGetOptionUnderlyingHisStatistic()
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
GetOptionUnderlyingHisStatistic: errCode 0, retMsg , retType 0
{
"owner": { "market": 1, "code": "AAPL" },
"code": "US.AAPL",
"name": "Apple",
"statisticList": [
{
"time": "2026-06-12",
"timestamp": 1781237000,
"optionVolume": 1273240,
"callVolume": 782941,
"putVolume": 490299,
"putCallVolumeRatio": 0.626227,
"callOpenInterest": 0,
"putOpenInterest": 0,
"underlyingPrice": 291.13
},
{
"time": "2026-06-11",
"timestamp": 1781150000,
"optionVolume": 950737,
"callVolume": 580535,
"putVolume": 370202,
"putCallVolumeRatio": 0.637691,
"optionOpenInterest": 5403058,
"callOpenInterest": 3165108,
"putOpenInterest": 2237950,
"putCallOpenInterestRatio": 0.707069,
"underlyingPrice": 295.63
}
]
}
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
接口限制
- 30 秒內最多請求 60 次期權標的歷史統計接口(支持分頁的接口,僅首次調用納入統計)
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_option_underlying_his_statistic(code, index_option_type=IndexOptionType.NORMAL, begin_time=None, end_time=None, page_req_key=None)
介紹
獲取期權標的歷史統計數據,按交易日返回該標的對應期權的成交量、持倉量及 Put/Call 比率時間序列,支持分頁。
參數
參數 類型 說明 code str 標的股票代碼 如 'US.AAPL'index_option_type IndexOptionType 指數期權類型 NORMAL=普通期權(默認)、SMALL=小型指數期權begin_time str 開始日期,格式 'YYYY-MM-DD' 不傳默認 end_time 往前推 364 天end_time str 結束日期,格式 'YYYY-MM-DD' 與 begin_time 跨度最多 364 天page_req_key bytes 分頁請求 key 首次傳 None,續拉傳上次返回值返回
參數 類型 說明 ret RET_CODE 接口調用結果 data pandas.DataFrame 當 ret == RET_OK,返回統計數據 str 當 ret != RET_OK,返回錯誤描述 page_req_key bytes 下一頁 key,None 表示無更多數據 返回 DataFrame 字段:
字段 類型 說明 code str 股票代碼 name str 股票名稱 time str 交易日時間字符串 timestamp float 交易日時間戳(Unix 秒) option_volume int 期權總成交量(call_volume + put_volume) call_volume int 看漲期權成交量 put_volume int 看跌期權成交量 put_call_volume_ratio float Put/Call 成交量比 option_open_interest int 期權總持倉量 call_open_interest int 看漲期權持倉量(T-1 延遲) put_open_interest int 看跌期權持倉量(T-1 延遲) put_call_open_interest_ratio float Put/Call 持倉量比 underlying_price float 標的價格
Example
from moomoo import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data, page_req_key = quote_ctx.get_option_underlying_his_statistic(
'US.AAPL',
begin_time='2026-06-01',
end_time='2026-06-15'
)
if ret == RET_OK:
print(data)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- Output
code name time timestamp option_volume call_volume put_volume put_call_volume_ratio option_open_interest call_open_interest put_open_interest put_call_open_interest_ratio underlying_price
0 US.AAPL Apple 2026-06-12 1.781237e+09 1273240 782941 490299 0.626227 0 0 0 N/A 291.13
1 US.AAPL Apple 2026-06-11 1.781150e+09 950737 580535 370202 0.637691 5403058 3165108 2237950 0.707069 295.63
2 US.AAPL Apple 2026-06-10 1.781064e+09 1734799 1039630 695169 0.668670 5522747 3270454 2252293 0.688679 291.58
3 US.AAPL Apple 2026-06-09 1.780978e+09 1715749 1024046 691703 0.675461 5405022 3209586 2195436 0.684025 290.55
4 US.AAPL Apple 2026-06-08 1.780891e+09 2179789 1293656 886133 0.684983 5350402 3142828 2207574 0.702416 301.54
...
2
3
4
5
6
7
# Qot_GetOptionUnderlyingHisStatistic.proto
介紹
獲取期權標的歷史統計數據
參數
message C2S
{
required Qot_Common.Security owner = 1; //期權標的股
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType
required string beginTime = 3; //開始時間字符串
required string endTime = 4; //結束時間字符串
optional bytes nextPageKey = 5; //分頁請求的key
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 返回
message DailyStatistic
{
required string time = 1; //交易日時間字符串
optional double timestamp = 2; //交易日時間戳
optional int64 optionVolume = 3; //期權總成交量
required int64 callVolume = 4; //看漲期權成交量
required int64 putVolume = 5; //看跌期權成交量
optional double putCallVolumeRatio = 6; //Put/Call成交量比
optional int64 optionOpenInterest = 7; //期權總持倉量
required int64 callOpenInterest = 8; //看漲期權持倉量
required int64 putOpenInterest = 9; //看跌期權持倉量
optional double putCallOpenInterestRatio = 10; //Put/Call持倉量比
optional double underlyingPrice = 11; //標的價格
}
message S2C
{
required Qot_Common.Security owner = 1; //期權標的股
optional string code = 2; //股票代碼
optional string name = 3; //股票名稱
repeated DailyStatistic statisticList = 4; //統計數據列表,按交易日降序
optional bytes nextPageKey = 5; //分頁請求的key
}
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
- 接口調用結果,結構參見 RetType
協議 ID
3302
uint GetOptionUnderlyingHisStatistic(Qot_GetOptionUnderlyingHisStatistic.Request req); virtual void OnReply_GetOptionUnderlyingHisStatistic(MMAPI_Conn client, uint nSerialNo, Qot_GetOptionUnderlyingHisStatistic.Response rsp);
介紹
獲取期權標的歷史統計數據
參數
message C2S
{
required Qot_Common.Security owner = 1; //期權標的股
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType
required string beginTime = 3; //開始時間字符串
required string endTime = 4; //結束時間字符串
optional bytes nextPageKey = 5; //分頁請求的key
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 返回
message DailyStatistic
{
required string time = 1; //交易日時間字符串
optional double timestamp = 2; //交易日時間戳
optional int64 optionVolume = 3; //期權總成交量
required int64 callVolume = 4; //看漲期權成交量
required int64 putVolume = 5; //看跌期權成交量
optional double putCallVolumeRatio = 6; //Put/Call成交量比
optional int64 optionOpenInterest = 7; //期權總持倉量
required int64 callOpenInterest = 8; //看漲期權持倉量
required int64 putOpenInterest = 9; //看跌期權持倉量
optional double putCallOpenInterestRatio = 10; //Put/Call持倉量比
optional double underlyingPrice = 11; //標的價格
}
message S2C
{
required Qot_Common.Security owner = 1; //期權標的股
optional string code = 2; //股票代碼
optional string name = 3; //股票名稱
repeated DailyStatistic statisticList = 4; //統計數據列表,按交易日降序
optional bytes nextPageKey = 5; //分頁請求的key
}
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
- 接口調用結果,結構參見 RetType
協議 ID
3302
Example
public class Program : MMSPI_Qot, MMSPI_Conn
{
MMAPI_Qot qot = new MMAPI_Qot();
public Program()
{
qot.SetClientInfo("csharp", 1);
qot.SetConnCallback(this);
qot.SetQotCallback(this);
}
public void Start()
{
qot.InitConnect("127.0.0.1", (ushort)11111, false);
}
public void OnInitConnect(MMAPI_Conn client, long errCode, String desc)
{
if (errCode != 0) return;
var c2s = Qot_GetOptionUnderlyingHisStatistic.C2S.CreateBuilder()
// TODO: 按 proto 填充 c2s 字段
.Build();
var req = Qot_GetOptionUnderlyingHisStatistic.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetOptionUnderlyingHisStatistic(req);
Console.Write("Send GetOptionUnderlyingHisStatistic: {0}\n", seqNo);
}
public void OnReply_GetOptionUnderlyingHisStatistic(MMAPI_Conn client, uint nSerialNo, Qot_GetOptionUnderlyingHisStatistic.Response rsp)
{
Console.Write("Reply: {0} {1}\n", nSerialNo, rsp.ToString());
}
public static void Main(String[] args)
{
MMAPI.Init();
new Program().Start();
while (true) Thread.Sleep(1000 * 600);
}
}
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
Send GetOptionUnderlyingHisStatistic: 1
Reply: 1 {
"time": "2026-06-11",
"timestamp": 1781150000,
"optionVolume": 950737,
"callVolume": 580535,
"putVolume": 370202,
"putCallVolumeRatio": 0.637691,
"optionOpenInterest": 5403058,
"callOpenInterest": 3165108,
"putOpenInterest": 2237950,
"putCallOpenInterestRatio": 0.707069,
"underlyingPrice": 295.63
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
int getOptionUnderlyingHisStatistic(Qot_GetOptionUnderlyingHisStatistic.Request req) onReply_GetOptionUnderlyingHisStatistic(MMAPI_Conn client, int nSerialNo, Qot_GetOptionUnderlyingHisStatistic.Response rsp)
介紹
獲取期權標的歷史統計數據
參數
message C2S
{
required Qot_Common.Security owner = 1; //期權標的股
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType
required string beginTime = 3; //開始時間字符串
required string endTime = 4; //結束時間字符串
optional bytes nextPageKey = 5; //分頁請求的key
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 返回
message DailyStatistic
{
required string time = 1; //交易日時間字符串
optional double timestamp = 2; //交易日時間戳
optional int64 optionVolume = 3; //期權總成交量
required int64 callVolume = 4; //看漲期權成交量
required int64 putVolume = 5; //看跌期權成交量
optional double putCallVolumeRatio = 6; //Put/Call成交量比
optional int64 optionOpenInterest = 7; //期權總持倉量
required int64 callOpenInterest = 8; //看漲期權持倉量
required int64 putOpenInterest = 9; //看跌期權持倉量
optional double putCallOpenInterestRatio = 10; //Put/Call持倉量比
optional double underlyingPrice = 11; //標的價格
}
message S2C
{
required Qot_Common.Security owner = 1; //期權標的股
optional string code = 2; //股票代碼
optional string name = 3; //股票名稱
repeated DailyStatistic statisticList = 4; //統計數據列表,按交易日降序
optional bytes nextPageKey = 5; //分頁請求的key
}
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
- 接口調用結果,結構參見 RetType
協議 ID
3302
Example
public class Program implements MMSPI_Qot, MMSPI_Conn {
private MMAPI_Conn_Qot qot = new MMAPI_Conn_Qot();
public Program() {
qot.setClientInfo("java", 1);
qot.setConnCallback(this);
qot.setQotCallback(this);
}
public void start() {
qot.initConnect("127.0.0.1", (short) 11111, false);
}
@Override
public void onInitConnect(MMAPI_Conn client, long errCode, String desc) {
if (errCode != 0) return;
Qot_GetOptionUnderlyingHisStatistic.C2S c2s = Qot_GetOptionUnderlyingHisStatistic.C2S.newBuilder()
// TODO: 按 proto 填充 c2s 字段
.build();
Qot_GetOptionUnderlyingHisStatistic.Request req = Qot_GetOptionUnderlyingHisStatistic.Request.newBuilder()
.setC2S(c2s).build();
int seqNo = qot.getOptionUnderlyingHisStatistic(req);
System.out.println("Send getOptionUnderlyingHisStatistic: " + seqNo);
}
@Override
public void onReply_GetOptionUnderlyingHisStatistic(MMAPI_Conn client, int nSerialNo, Qot_GetOptionUnderlyingHisStatistic.Response rsp) {
System.out.println("Reply: " + nSerialNo + " " + rsp.toString());
}
public static void main(String[] args) {
MMAPI.init();
new Program().start();
while (true) {
try { Thread.sleep(1000 * 600); } catch (InterruptedException e) {}
}
}
}
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
Send getOptionUnderlyingHisStatistic: 1
Reply: 1 {
"time": "2026-06-11",
"timestamp": 1781150000,
"optionVolume": 950737,
"callVolume": 580535,
"putVolume": 370202,
"putCallVolumeRatio": 0.637691,
"optionOpenInterest": 5403058,
"callOpenInterest": 3165108,
"putOpenInterest": 2237950,
"putCallOpenInterestRatio": 0.707069,
"underlyingPrice": 295.63
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Moomoo::u32_t GetOptionUnderlyingHisStatistic(const Qot_GetOptionUnderlyingHisStatistic::Request &stReq);
virtual void OnReply_GetOptionUnderlyingHisStatistic(Moomoo::u32_t nSerialNo, const Qot_GetOptionUnderlyingHisStatistic::Response &stRsp) = 0;
介紹
獲取期權標的歷史統計數據
參數
message C2S
{
required Qot_Common.Security owner = 1; //期權標的股
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType
required string beginTime = 3; //開始時間字符串
required string endTime = 4; //結束時間字符串
optional bytes nextPageKey = 5; //分頁請求的key
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 返回
message DailyStatistic
{
required string time = 1; //交易日時間字符串
optional double timestamp = 2; //交易日時間戳
optional int64 optionVolume = 3; //期權總成交量
required int64 callVolume = 4; //看漲期權成交量
required int64 putVolume = 5; //看跌期權成交量
optional double putCallVolumeRatio = 6; //Put/Call成交量比
optional int64 optionOpenInterest = 7; //期權總持倉量
required int64 callOpenInterest = 8; //看漲期權持倉量
required int64 putOpenInterest = 9; //看跌期權持倉量
optional double putCallOpenInterestRatio = 10; //Put/Call持倉量比
optional double underlyingPrice = 11; //標的價格
}
message S2C
{
required Qot_Common.Security owner = 1; //期權標的股
optional string code = 2; //股票代碼
optional string name = 3; //股票名稱
repeated DailyStatistic statisticList = 4; //統計數據列表,按交易日降序
optional bytes nextPageKey = 5; //分頁請求的key
}
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
- 接口調用結果,結構參見 RetType
協議 ID
3302
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_GetOptionUnderlyingHisStatistic::Request req;
Qot_GetOptionUnderlyingHisStatistic::C2S *c2s = req.mutable_c2s();
// TODO: 按 proto 填充 c2s 字段
m_GetOptionUnderlyingHisStatisticSerialNo = m_pQotApi->GetOptionUnderlyingHisStatistic(req);
}
virtual void OnReply_GetOptionUnderlyingHisStatistic(Moomoo::u32_t nSerialNo, const Qot_GetOptionUnderlyingHisStatistic::Response &stRsp) {
if (nSerialNo != m_GetOptionUnderlyingHisStatisticSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
MMAPI_Qot *m_pQotApi;
Moomoo::u32_t m_GetOptionUnderlyingHisStatisticSerialNo = 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
getOptionUnderlyingHisStatistic(qotGetOptionUnderlyingHisStatistic)
介紹
獲取期權標的歷史統計數據
參數
message C2S
{
required Qot_Common.Security owner = 1; //期權標的股
optional int32 indexOptionType = 2; //Qot_Common.IndexOptionType
required string beginTime = 3; //開始時間字符串
required string endTime = 4; //結束時間字符串
optional bytes nextPageKey = 5; //分頁請求的key
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- 返回
message DailyStatistic
{
required string time = 1; //交易日時間字符串
optional double timestamp = 2; //交易日時間戳
optional int64 optionVolume = 3; //期權總成交量
required int64 callVolume = 4; //看漲期權成交量
required int64 putVolume = 5; //看跌期權成交量
optional double putCallVolumeRatio = 6; //Put/Call成交量比
optional int64 optionOpenInterest = 7; //期權總持倉量
required int64 callOpenInterest = 8; //看漲期權持倉量
required int64 putOpenInterest = 9; //看跌期權持倉量
optional double putCallOpenInterestRatio = 10; //Put/Call持倉量比
optional double underlyingPrice = 11; //標的價格
}
message S2C
{
required Qot_Common.Security owner = 1; //期權標的股
optional string code = 2; //股票代碼
optional string name = 3; //股票名稱
repeated DailyStatistic statisticList = 4; //統計數據列表,按交易日降序
optional bytes nextPageKey = 5; //分頁請求的key
}
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
- 接口調用結果,結構參見 RetType
協議 ID
3302
Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_Common } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetOptionUnderlyingHisStatistic(){
const { RetType } = Common
const { QotMarket } = Qot_Common
let [addr, port, enable_ssl, key] = ["127.0.0.1", 11112, false, ''];
let websocket = new mmWebsocket();
websocket.onlogin = (ret, msg)=>{
if (ret) {
const req = {
c2s: {
owner: { market: QotMarket.QotMarket_US_Security, code: 'AAPL' },
beginTime: '2026-06-01',
endTime: '2026-06-15',
},
};
websocket.GetOptionUnderlyingHisStatistic(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetOptionUnderlyingHisStatistic: 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);
}
QotGetOptionUnderlyingHisStatistic()
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
GetOptionUnderlyingHisStatistic: errCode 0, retMsg , retType 0
{
"owner": { "market": 1, "code": "AAPL" },
"code": "US.AAPL",
"name": "Apple",
"statisticList": [
{
"time": "2026-06-12",
"timestamp": 1781237000,
"optionVolume": 1273240,
"callVolume": 782941,
"putVolume": 490299,
"putCallVolumeRatio": 0.626227,
"callOpenInterest": 0,
"putOpenInterest": 0,
"underlyingPrice": 291.13
},
{
"time": "2026-06-11",
"timestamp": 1781150000,
"optionVolume": 950737,
"callVolume": 580535,
"putVolume": 370202,
"putCallVolumeRatio": 0.637691,
"optionOpenInterest": 5403058,
"callOpenInterest": 3165108,
"putOpenInterest": 2237950,
"putCallOpenInterestRatio": 0.707069,
"underlyingPrice": 295.63
}
]
}
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
接口限制
- 30 秒內最多請求 60 次期權標的歷史統計接口(支持分頁的接口,僅首次調用納入統計)