# 期权异动
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_option_event(option_market, count=None, page=None, filter_list=None, sort=None)
介绍
获取期权异动列表,返回大单成交、扫单等期权异动记录,支持按标的、合约属性、成交信息、希腊值等多维度筛选和排序。
参数
参数 类型 说明 option_market OptionMarket 期权市场类型 US_SECURITY=美股股票期权、US_INDEX=美股指数期权、HK_SECURITY=港股股票期权、HK_INDEX=港股指数期权count int 每页数量 范围 [1,300]page str 分页标记 首次传空字符串,翻页传上次返回的 next_pagefilter_list list[EventFilter] 筛选条件列表 多条件为 AND 关系。支持按标的(OWNER_LIST)、行业板块、期权类型(CALL/PUT)、成交方向、成交量、成交额、IV、Delta 等筛选sort EventSort 排序 默认按时间降序筛选器(EventFilter)
通过 EventFilter 构造筛选条件,多个条件为 AND 关系。
EventFilter(indicator_type, value_list=None, interval_min=None, interval_max=None, min_inclusive=True, max_inclusive=True, security_list=None)1
2参数 类型 说明 indicator_type EventIndicatorType 筛选因子类型 value_list list 确切值列表(枚举值或整数) interval_min float 区间下限 interval_max float 区间上限 min_inclusive bool 下限是否闭区间,默认 True max_inclusive bool 上限是否闭区间,默认 True security_list list[str] 证券或板块代码列表 筛选因子(完整枚举见 EventIndicatorType),按筛选方式分组:
筛选方式 用哪个参数 适用因子 语义 security_list security_listOWNER_LIST、INDUSTRY_PLATE、CONCEPT_PLATE标的或板块代码列表 value_list value_listOPTION_TYPE、MONEY_TYPE、TICKER_TYPE、MAX_DAY_NUM、CORPORATE_ACTION、ORDER_TYPE、STRATEGY、SENTIMENT命中整数值集合 范围 interval_min/interval_maxMARKET_CAP、STRIKE_PRICE、EXPIRY_DAYS、OTM、VOLUME、TURNOVER、PRICE、TOTAL_VOLUME、TOTAL_OI、VO_RATIO、IV、DELTA、GAMMA、VEGA、THETA、RHO落在区间内 涉及百分比的因子(如 OTM、VO_RATIO)直接输入小数,0.2 代表 20%。一个条件只承载一种筛选方式,三种互斥,按因子所属方式对号入座。确切值因子均传整数,如 OPTION_TYPE(1=CALL, 2=PUT)、TICKER_TYPE(1=Buy, 2=Sell, 3=Neutral)、MAX_DAY_NUM(0=当天, 1=近2天…)。
返回
参数 类型 说明 ret RET_CODE 接口调用结果 data dict 当 ret == RET_OK,返回异动数据 str 当 ret != RET_OK,返回错误描述 data 字典包含:
字段 类型 说明 event_list pandas.DataFrame 异动记录列表 next_page str 下一页标记(空字符串表示无下一页) all_count int 总记录数 update_timestamp float 数据更新时间戳(Unix 秒) event_list DataFrame 字段:
字段 类型 说明 option_code str 期权合约代码 owner_code str 标的股票代码 symbol str 标的 display code(如 TSLA) fill_time str 成交时间 fill_timestamp float 成交时间戳(Unix 秒) ticker_type str 成交方向 BUY=主动买入、SELL=主动卖出、NEUTRAL=中性盘price float 成交价 volume int 成交量(张) turnover float 成交额 option_type str 期权类型 CALL/PUTstrike_price float 行权价 strike_time str 到期日 strike_timestamp float 到期日时间戳(Unix 秒) dte int 距到期天数 underlying_price float 标的价格 otm float 价外比率(百分比) bid_price float 买一价 ask_price float 卖一价 iv float 隐含波动率(百分比) total_volume int 期权当日总成交量 total_open_interest int 期权当日总持仓量 vo_ratio float 量仓比(百分比) delta float Delta gamma float Gamma vega float Vega theta float Theta rho float Rho sentiment str 市场情绪 BEARISH=看空、BULLISH=看多、NEUTRAL=中性order_type_list list 订单类型列表 NORMAL=普通、SWEEP=扫单、CROSS=对敲单、FLOOR=场内单strategy_type str 策略类型 SINGLE_LEG=单腿、MULTI_LEG=多腿策略earnings_time str 财报日期 earnings_pub_type int 财报发布类型 1=盘前、2=盘后corporate_action_list list 公司行动列表 industry_plate_list list 行业板块列表 concept_plate_list list 概念板块列表
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
# 筛选器用法引导(按需取消注释,构造后传入 filter_list,多条件为 AND 关系):
# # ① 标的列表筛选 — 只看指定标的的异动
# f_owner = EventFilter(EventIndicatorType.OWNER_LIST,
# security_list=['US.TSLA', 'US.AAPL'])
# # ② 确切值筛选 — 只要 PUT + 主动卖出 + 当天异动
# f_type = EventFilter(EventIndicatorType.OPTION_TYPE, value_list=[2]) # 2=PUT
# f_ticker = EventFilter(EventIndicatorType.TICKER_TYPE, value_list=[2]) # 2=Sell
# f_day = EventFilter(EventIndicatorType.MAX_DAY_NUM, value_list=[0]) # 0=当天
# # ③ 范围筛选 — 成交量 > 500 张、Delta 在 -0.5 ~ -0.1
# f_vol = EventFilter(EventIndicatorType.VOLUME, interval_min=500)
# f_delta = EventFilter(EventIndicatorType.DELTA, interval_min=-0.5, interval_max=-0.1)
ret, data = quote_ctx.get_option_event(OptionMarket.US_SECURITY, count=5)
if ret == RET_OK:
print(data['event_list'])
print('all_count:', data['all_count'])
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
- Output
option_code owner_code symbol fill_time fill_timestamp ticker_type price volume turnover option_type strike_price strike_time strike_timestamp dte underlying_price otm bid_price ask_price iv total_volume total_open_interest vo_ratio delta gamma vega theta rho sentiment order_type_list strategy_type earnings_time earnings_pub_type corporate_action_list industry_plate_list concept_plate_list
0 US.TLT260618C86000 US.TLT TLT 2026-06-12 16:14:00 1.781295e+09 SELL 0.280000 10000 280000.0 CALL 86.0 2026-06-18 1.781759e+09 3 85.77 0.268 0.28 0.30 8.240 70108 88849 0.78906 0.424382 0.432194 0.043077 -0.034441 0.005940 BEARISH [SWEEP, NORMAL] SINGLE_LEG N/A N/A N/A N/A N/A
1 US.TLT260618C86000 US.TLT TLT 2026-06-12 16:13:18 1.781295e+09 SELL 0.280000 7821 218988.0 CALL 86.0 2026-06-18 1.781759e+09 3 85.77 0.268 0.28 0.30 8.240 60104 88849 0.67647 0.424382 0.432194 0.043077 -0.034441 0.005940 BEARISH [SWEEP, NORMAL] SINGLE_LEG N/A N/A N/A N/A N/A
2 US.IWM260618P285000 US.IWM IWM 2026-06-12 16:07:53 1.781295e+09 SELL 1.320000 3002 396264.0 PUT 285.0 2026-06-18 1.781759e+09 3 292.96 2.717 1.32 1.35 28.323 57418 26731 2.14799 -0.214110 0.027402 0.109475 -0.256980 -0.009801 BULLISH [SWEEP, NORMAL] SINGLE_LEG N/A N/A [{'action_type': 7, 'action_time': '2026-06-15', 'action_timestamp': ...}] N/A N/A
3 US.SPY260717P706000 US.SPY SPY 2026-06-12 16:04:46 1.781295e+09 BUY 4.333523 3872 1677940.0 PUT 706.0 2026-07-17 1.784264e+09 32 741.77 4.822 4.29 4.35 19.000 22269 8169 2.72603 -0.177726 0.005982 0.596630 -0.150480 -0.113947 BEARISH [SWEEP, NORMAL] SINGLE_LEG N/A N/A N/A N/A [US.LIST2153]
4 US.SPY260717P704000 US.SPY SPY 2026-06-12 16:04:26 1.781295e+09 SELL 4.060235 6767 2747561.0 PUT 704.0 2026-07-17 1.784264e+09 32 741.77 5.091 4.05 4.10 19.214 17712 7842 2.25860 -0.167963 0.005705 0.575554 -0.147087 -0.107775 BULLISH [NORMAL] SINGLE_LEG N/A N/A N/A N/A [US.LIST2153]
all_count: 164620
2
3
4
5
6
7
# Qot_GetOptionEvent.proto
介绍
获取期权异动列表
参数
message EventIndicator
{
required int32 indicatorType = 1; //Qot_GetOptionEvent.EventIndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2;
}
message EventSort
{
required int32 indicatorType = 1; //EventIndicatorType(排序字段)
required bool isAsc = 2; //是否升序
}
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket
optional int32 count = 2; //每页数量[1,300]
optional string page = 3; //分页标记,首次为空字符串
repeated EventIndicator filterList = 4; //筛选条件列表(条件间AND逻辑)
optional EventSort sort = 5; //排序(默认按时间降序)
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
- 返回
message CorporateAction
{
optional int32 actionType = 1; //CorporateActionType
optional string actionTime = 2; //行动日期("yyyy-MM-dd")
optional double actionTimestamp = 3; //行动日期(Unix秒)
}
message EventItem
{
optional Qot_Common.Security option = 1; //期权合约标识
optional Qot_Common.Security owner = 2; //标的股票标识
optional string symbol = 3; //标的display code
optional string fillTime = 10; //成交时间
optional double fillTimestamp = 11; //成交时间(Unix秒)
optional int32 tickerType = 12; //TickerType,成交方向
optional double price = 13; //成交价
optional int64 volume = 14; //成交量(张)
optional double turnover = 15; //成交额
optional int32 optionType = 20; //Qot_Common.OptionType
optional double strikePrice = 21; //行权价
optional string strikeTime = 22; //到期日
optional double strikeTimestamp = 23; //到期日(Unix秒)
optional int32 dte = 24; //距到期天数
optional double underlyingPrice = 30; //标的价格
optional double otm = 31; //价外比率(百分比)
optional double bidPrice = 32; //买一价
optional double askPrice = 33; //卖一价
optional double iv = 34; //隐含波动率(百分比)
optional int64 totalVolume = 35; //期权当日总成交量
optional int64 totalOpenInterest = 36; //期权当日总持仓量
optional double voRatio = 37; //量仓比(百分比)
optional double delta = 40;
optional double gamma = 41;
optional double vega = 42;
optional double theta = 43;
optional double rho = 44;
optional int32 sentiment = 50; //MarketSentiment
repeated int32 orderTypeList = 51; //OptionOrderType列表
optional int32 strategyType = 52; //TickerStrategy
optional string earningsTime = 60; //财报日期
optional int32 earningsPubType = 61; //EarningsPubType
repeated CorporateAction corporateActionList = 63; //公司行动列表
repeated Qot_Common.Security industryPlateList = 64; //行业板块列表
repeated Qot_Common.Security conceptPlateList = 65; //概念板块列表
}
message S2C
{
repeated EventItem eventList = 1; //异动列表
optional string nextPage = 2; //下一页标记(空字符串=无下一页)
optional int32 allCount = 3; //总记录数
optional double updateTimestamp = 4; //列表更新时间(Unix秒)
}
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
- 接口调用结果,结构参见 RetType
协议 ID
3307
uint GetOptionEvent(Qot_GetOptionEvent.Request req); virtual void OnReply_GetOptionEvent(FTAPI_Conn client, uint nSerialNo, Qot_GetOptionEvent.Response rsp);
介绍
获取期权异动列表
参数
message EventIndicator
{
required int32 indicatorType = 1; //Qot_GetOptionEvent.EventIndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2;
}
message EventSort
{
required int32 indicatorType = 1; //EventIndicatorType(排序字段)
required bool isAsc = 2; //是否升序
}
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket
optional int32 count = 2; //每页数量[1,300]
optional string page = 3; //分页标记,首次为空字符串
repeated EventIndicator filterList = 4; //筛选条件列表(条件间AND逻辑)
optional EventSort sort = 5; //排序(默认按时间降序)
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
- 返回
message CorporateAction
{
optional int32 actionType = 1; //CorporateActionType
optional string actionTime = 2; //行动日期("yyyy-MM-dd")
optional double actionTimestamp = 3; //行动日期(Unix秒)
}
message EventItem
{
optional Qot_Common.Security option = 1; //期权合约标识
optional Qot_Common.Security owner = 2; //标的股票标识
optional string symbol = 3; //标的display code
optional string fillTime = 10; //成交时间
optional double fillTimestamp = 11; //成交时间(Unix秒)
optional int32 tickerType = 12; //TickerType,成交方向
optional double price = 13; //成交价
optional int64 volume = 14; //成交量(张)
optional double turnover = 15; //成交额
optional int32 optionType = 20; //Qot_Common.OptionType
optional double strikePrice = 21; //行权价
optional string strikeTime = 22; //到期日
optional double strikeTimestamp = 23; //到期日(Unix秒)
optional int32 dte = 24; //距到期天数
optional double underlyingPrice = 30; //标的价格
optional double otm = 31; //价外比率(百分比)
optional double bidPrice = 32; //买一价
optional double askPrice = 33; //卖一价
optional double iv = 34; //隐含波动率(百分比)
optional int64 totalVolume = 35; //期权当日总成交量
optional int64 totalOpenInterest = 36; //期权当日总持仓量
optional double voRatio = 37; //量仓比(百分比)
optional double delta = 40;
optional double gamma = 41;
optional double vega = 42;
optional double theta = 43;
optional double rho = 44;
optional int32 sentiment = 50; //MarketSentiment
repeated int32 orderTypeList = 51; //OptionOrderType列表
optional int32 strategyType = 52; //TickerStrategy
optional string earningsTime = 60; //财报日期
optional int32 earningsPubType = 61; //EarningsPubType
repeated CorporateAction corporateActionList = 63; //公司行动列表
repeated Qot_Common.Security industryPlateList = 64; //行业板块列表
repeated Qot_Common.Security conceptPlateList = 65; //概念板块列表
}
message S2C
{
repeated EventItem eventList = 1; //异动列表
optional string nextPage = 2; //下一页标记(空字符串=无下一页)
optional int32 allCount = 3; //总记录数
optional double updateTimestamp = 4; //列表更新时间(Unix秒)
}
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
- 接口调用结果,结构参见 RetType
协议 ID
3307
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_GetOptionEvent.C2S.CreateBuilder()
// TODO: 按 proto 填充 c2s 字段
.Build();
var req = Qot_GetOptionEvent.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetOptionEvent(req);
Console.Write("Send GetOptionEvent: {0}\n", seqNo);
}
public void OnReply_GetOptionEvent(FTAPI_Conn client, uint nSerialNo, Qot_GetOptionEvent.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
int getOptionEvent(Qot_GetOptionEvent.Request req) onReply_GetOptionEvent(FTAPI_Conn client, int nSerialNo, Qot_GetOptionEvent.Response rsp)
介绍
获取期权异动列表
参数
message EventIndicator
{
required int32 indicatorType = 1; //Qot_GetOptionEvent.EventIndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2;
}
message EventSort
{
required int32 indicatorType = 1; //EventIndicatorType(排序字段)
required bool isAsc = 2; //是否升序
}
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket
optional int32 count = 2; //每页数量[1,300]
optional string page = 3; //分页标记,首次为空字符串
repeated EventIndicator filterList = 4; //筛选条件列表(条件间AND逻辑)
optional EventSort sort = 5; //排序(默认按时间降序)
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
- 返回
message CorporateAction
{
optional int32 actionType = 1; //CorporateActionType
optional string actionTime = 2; //行动日期("yyyy-MM-dd")
optional double actionTimestamp = 3; //行动日期(Unix秒)
}
message EventItem
{
optional Qot_Common.Security option = 1; //期权合约标识
optional Qot_Common.Security owner = 2; //标的股票标识
optional string symbol = 3; //标的display code
optional string fillTime = 10; //成交时间
optional double fillTimestamp = 11; //成交时间(Unix秒)
optional int32 tickerType = 12; //TickerType,成交方向
optional double price = 13; //成交价
optional int64 volume = 14; //成交量(张)
optional double turnover = 15; //成交额
optional int32 optionType = 20; //Qot_Common.OptionType
optional double strikePrice = 21; //行权价
optional string strikeTime = 22; //到期日
optional double strikeTimestamp = 23; //到期日(Unix秒)
optional int32 dte = 24; //距到期天数
optional double underlyingPrice = 30; //标的价格
optional double otm = 31; //价外比率(百分比)
optional double bidPrice = 32; //买一价
optional double askPrice = 33; //卖一价
optional double iv = 34; //隐含波动率(百分比)
optional int64 totalVolume = 35; //期权当日总成交量
optional int64 totalOpenInterest = 36; //期权当日总持仓量
optional double voRatio = 37; //量仓比(百分比)
optional double delta = 40;
optional double gamma = 41;
optional double vega = 42;
optional double theta = 43;
optional double rho = 44;
optional int32 sentiment = 50; //MarketSentiment
repeated int32 orderTypeList = 51; //OptionOrderType列表
optional int32 strategyType = 52; //TickerStrategy
optional string earningsTime = 60; //财报日期
optional int32 earningsPubType = 61; //EarningsPubType
repeated CorporateAction corporateActionList = 63; //公司行动列表
repeated Qot_Common.Security industryPlateList = 64; //行业板块列表
repeated Qot_Common.Security conceptPlateList = 65; //概念板块列表
}
message S2C
{
repeated EventItem eventList = 1; //异动列表
optional string nextPage = 2; //下一页标记(空字符串=无下一页)
optional int32 allCount = 3; //总记录数
optional double updateTimestamp = 4; //列表更新时间(Unix秒)
}
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
- 接口调用结果,结构参见 RetType
协议 ID
3307
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_GetOptionEvent.C2S c2s = Qot_GetOptionEvent.C2S.newBuilder()
// TODO: 按 proto 填充 c2s 字段
.build();
Qot_GetOptionEvent.Request req = Qot_GetOptionEvent.Request.newBuilder()
.setC2S(c2s).build();
int seqNo = qot.getOptionEvent(req);
System.out.println("Send getOptionEvent: " + seqNo);
}
@Override
public void onReply_GetOptionEvent(FTAPI_Conn client, int nSerialNo, Qot_GetOptionEvent.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
Futu::u32_t GetOptionEvent(const Qot_GetOptionEvent::Request &stReq);
virtual void OnReply_GetOptionEvent(Futu::u32_t nSerialNo, const Qot_GetOptionEvent::Response &stRsp) = 0;
介绍
获取期权异动列表
参数
message EventIndicator
{
required int32 indicatorType = 1; //Qot_GetOptionEvent.EventIndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2;
}
message EventSort
{
required int32 indicatorType = 1; //EventIndicatorType(排序字段)
required bool isAsc = 2; //是否升序
}
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket
optional int32 count = 2; //每页数量[1,300]
optional string page = 3; //分页标记,首次为空字符串
repeated EventIndicator filterList = 4; //筛选条件列表(条件间AND逻辑)
optional EventSort sort = 5; //排序(默认按时间降序)
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
- 返回
message CorporateAction
{
optional int32 actionType = 1; //CorporateActionType
optional string actionTime = 2; //行动日期("yyyy-MM-dd")
optional double actionTimestamp = 3; //行动日期(Unix秒)
}
message EventItem
{
optional Qot_Common.Security option = 1; //期权合约标识
optional Qot_Common.Security owner = 2; //标的股票标识
optional string symbol = 3; //标的display code
optional string fillTime = 10; //成交时间
optional double fillTimestamp = 11; //成交时间(Unix秒)
optional int32 tickerType = 12; //TickerType,成交方向
optional double price = 13; //成交价
optional int64 volume = 14; //成交量(张)
optional double turnover = 15; //成交额
optional int32 optionType = 20; //Qot_Common.OptionType
optional double strikePrice = 21; //行权价
optional string strikeTime = 22; //到期日
optional double strikeTimestamp = 23; //到期日(Unix秒)
optional int32 dte = 24; //距到期天数
optional double underlyingPrice = 30; //标的价格
optional double otm = 31; //价外比率(百分比)
optional double bidPrice = 32; //买一价
optional double askPrice = 33; //卖一价
optional double iv = 34; //隐含波动率(百分比)
optional int64 totalVolume = 35; //期权当日总成交量
optional int64 totalOpenInterest = 36; //期权当日总持仓量
optional double voRatio = 37; //量仓比(百分比)
optional double delta = 40;
optional double gamma = 41;
optional double vega = 42;
optional double theta = 43;
optional double rho = 44;
optional int32 sentiment = 50; //MarketSentiment
repeated int32 orderTypeList = 51; //OptionOrderType列表
optional int32 strategyType = 52; //TickerStrategy
optional string earningsTime = 60; //财报日期
optional int32 earningsPubType = 61; //EarningsPubType
repeated CorporateAction corporateActionList = 63; //公司行动列表
repeated Qot_Common.Security industryPlateList = 64; //行业板块列表
repeated Qot_Common.Security conceptPlateList = 65; //概念板块列表
}
message S2C
{
repeated EventItem eventList = 1; //异动列表
optional string nextPage = 2; //下一页标记(空字符串=无下一页)
optional int32 allCount = 3; //总记录数
optional double updateTimestamp = 4; //列表更新时间(Unix秒)
}
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
- 接口调用结果,结构参见 RetType
协议 ID
3307
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_GetOptionEvent::Request req;
Qot_GetOptionEvent::C2S *c2s = req.mutable_c2s();
// TODO: 按 proto 填充 c2s 字段
m_GetOptionEventSerialNo = m_pQotApi->GetOptionEvent(req);
}
virtual void OnReply_GetOptionEvent(Futu::u32_t nSerialNo, const Qot_GetOptionEvent::Response &stRsp) {
if (nSerialNo != m_GetOptionEventSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
FTAPI_Qot *m_pQotApi;
Futu::u32_t m_GetOptionEventSerialNo = 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
getOptionEvent(qotGetOptionEvent)
介绍
获取期权异动列表
参数
message EventIndicator
{
required int32 indicatorType = 1; //Qot_GetOptionEvent.EventIndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2;
}
message EventSort
{
required int32 indicatorType = 1; //EventIndicatorType(排序字段)
required bool isAsc = 2; //是否升序
}
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket
optional int32 count = 2; //每页数量[1,300]
optional string page = 3; //分页标记,首次为空字符串
repeated EventIndicator filterList = 4; //筛选条件列表(条件间AND逻辑)
optional EventSort sort = 5; //排序(默认按时间降序)
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
- 返回
message CorporateAction
{
optional int32 actionType = 1; //CorporateActionType
optional string actionTime = 2; //行动日期("yyyy-MM-dd")
optional double actionTimestamp = 3; //行动日期(Unix秒)
}
message EventItem
{
optional Qot_Common.Security option = 1; //期权合约标识
optional Qot_Common.Security owner = 2; //标的股票标识
optional string symbol = 3; //标的display code
optional string fillTime = 10; //成交时间
optional double fillTimestamp = 11; //成交时间(Unix秒)
optional int32 tickerType = 12; //TickerType,成交方向
optional double price = 13; //成交价
optional int64 volume = 14; //成交量(张)
optional double turnover = 15; //成交额
optional int32 optionType = 20; //Qot_Common.OptionType
optional double strikePrice = 21; //行权价
optional string strikeTime = 22; //到期日
optional double strikeTimestamp = 23; //到期日(Unix秒)
optional int32 dte = 24; //距到期天数
optional double underlyingPrice = 30; //标的价格
optional double otm = 31; //价外比率(百分比)
optional double bidPrice = 32; //买一价
optional double askPrice = 33; //卖一价
optional double iv = 34; //隐含波动率(百分比)
optional int64 totalVolume = 35; //期权当日总成交量
optional int64 totalOpenInterest = 36; //期权当日总持仓量
optional double voRatio = 37; //量仓比(百分比)
optional double delta = 40;
optional double gamma = 41;
optional double vega = 42;
optional double theta = 43;
optional double rho = 44;
optional int32 sentiment = 50; //MarketSentiment
repeated int32 orderTypeList = 51; //OptionOrderType列表
optional int32 strategyType = 52; //TickerStrategy
optional string earningsTime = 60; //财报日期
optional int32 earningsPubType = 61; //EarningsPubType
repeated CorporateAction corporateActionList = 63; //公司行动列表
repeated Qot_Common.Security industryPlateList = 64; //行业板块列表
repeated Qot_Common.Security conceptPlateList = 65; //概念板块列表
}
message S2C
{
repeated EventItem eventList = 1; //异动列表
optional string nextPage = 2; //下一页标记(空字符串=无下一页)
optional int32 allCount = 3; //总记录数
optional double updateTimestamp = 4; //列表更新时间(Unix秒)
}
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
- 接口调用结果,结构参见 RetType
协议 ID
3307
Example
import ftWebsocket from "futu-api";
import { Common, Qot_OptionCommon } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetOptionEvent(){
const { RetType } = Common
const { OptionMarket } = 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,
count: 5,
},
};
websocket.GetOptionEvent(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetOptionEvent: 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);
}
QotGetOptionEvent()
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
- Output
GetOptionEvent: errCode 0, retMsg , retType 0
{
"eventList": [
{
"option": { "market": 1, "code": "TLT260618C86000" },
"owner": { "market": 1, "code": "TLT" },
"symbol": "TLT",
"fillTime": "2026-06-12 16:14:00",
"fillTimestamp": 1781295240,
"tickerType": 2,
"price": 0.28,
"volume": 10000,
"turnover": 280000,
"optionType": 1,
"strikePrice": 86,
"strikeTime": "2026-06-18",
"strikeTimestamp": 1781759000,
"dte": 3,
"underlyingPrice": 85.77,
"otm": 0.268,
"bidPrice": 0.28,
"askPrice": 0.3,
"iv": 8.24,
"totalVolume": 70108,
"totalOpenInterest": 88849,
"voRatio": 0.78906,
"delta": 0.424382,
"gamma": 0.432194,
"vega": 0.043077,
"theta": -0.034441,
"rho": 0.00594,
"sentiment": 2,
"orderTypeList": [2, 1],
"strategyType": 1
}
],
"allCount": 164620
}
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
接口限制
- 30 秒内最多请求 60 次期权异动接口(支持分页的接口,仅首次调用纳入统计)
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_option_event(option_market, count=None, page=None, filter_list=None, sort=None)
介绍
获取期权异动列表,返回大单成交、扫单等期权异动记录,支持按标的、合约属性、成交信息、希腊值等多维度筛选和排序。
参数
参数 类型 说明 option_market OptionMarket 期权市场类型 US_SECURITY=美股股票期权、US_INDEX=美股指数期权、HK_SECURITY=港股股票期权、HK_INDEX=港股指数期权count int 每页数量 范围 [1,300]page str 分页标记 首次传空字符串,翻页传上次返回的 next_pagefilter_list list[EventFilter] 筛选条件列表 多条件为 AND 关系。支持按标的(OWNER_LIST)、行业板块、期权类型(CALL/PUT)、成交方向、成交量、成交额、IV、Delta 等筛选sort EventSort 排序 默认按时间降序筛选器(EventFilter)
通过 EventFilter 构造筛选条件,多个条件为 AND 关系。
EventFilter(indicator_type, value_list=None, interval_min=None, interval_max=None, min_inclusive=True, max_inclusive=True, security_list=None)1
2参数 类型 说明 indicator_type EventIndicatorType 筛选因子类型 value_list list 确切值列表(枚举值或整数) interval_min float 区间下限 interval_max float 区间上限 min_inclusive bool 下限是否闭区间,默认 True max_inclusive bool 上限是否闭区间,默认 True security_list list[str] 证券或板块代码列表 筛选因子(完整枚举见 EventIndicatorType),按筛选方式分组:
筛选方式 用哪个参数 适用因子 语义 security_list security_listOWNER_LIST、INDUSTRY_PLATE、CONCEPT_PLATE标的或板块代码列表 value_list value_listOPTION_TYPE、MONEY_TYPE、TICKER_TYPE、MAX_DAY_NUM、CORPORATE_ACTION、ORDER_TYPE、STRATEGY、SENTIMENT命中整数值集合 范围 interval_min/interval_maxMARKET_CAP、STRIKE_PRICE、EXPIRY_DAYS、OTM、VOLUME、TURNOVER、PRICE、TOTAL_VOLUME、TOTAL_OI、VO_RATIO、IV、DELTA、GAMMA、VEGA、THETA、RHO落在区间内 涉及百分比的因子(如 OTM、VO_RATIO)直接输入小数,0.2 代表 20%。一个条件只承载一种筛选方式,三种互斥,按因子所属方式对号入座。确切值因子均传整数,如 OPTION_TYPE(1=CALL, 2=PUT)、TICKER_TYPE(1=Buy, 2=Sell, 3=Neutral)、MAX_DAY_NUM(0=当天, 1=近2天…)。
返回
参数 类型 说明 ret RET_CODE 接口调用结果 data dict 当 ret == RET_OK,返回异动数据 str 当 ret != RET_OK,返回错误描述 data 字典包含:
字段 类型 说明 event_list pandas.DataFrame 异动记录列表 next_page str 下一页标记(空字符串表示无下一页) all_count int 总记录数 update_timestamp float 数据更新时间戳(Unix 秒) event_list DataFrame 字段:
字段 类型 说明 option_code str 期权合约代码 owner_code str 标的股票代码 symbol str 标的 display code(如 TSLA) fill_time str 成交时间 fill_timestamp float 成交时间戳(Unix 秒) ticker_type str 成交方向 BUY=主动买入、SELL=主动卖出、NEUTRAL=中性盘price float 成交价 volume int 成交量(张) turnover float 成交额 option_type str 期权类型 CALL/PUTstrike_price float 行权价 strike_time str 到期日 strike_timestamp float 到期日时间戳(Unix 秒) dte int 距到期天数 underlying_price float 标的价格 otm float 价外比率(百分比) bid_price float 买一价 ask_price float 卖一价 iv float 隐含波动率(百分比) total_volume int 期权当日总成交量 total_open_interest int 期权当日总持仓量 vo_ratio float 量仓比(百分比) delta float Delta gamma float Gamma vega float Vega theta float Theta rho float Rho sentiment str 市场情绪 BEARISH=看空、BULLISH=看多、NEUTRAL=中性order_type_list list 订单类型列表 NORMAL=普通、SWEEP=扫单、CROSS=对敲单、FLOOR=场内单strategy_type str 策略类型 SINGLE_LEG=单腿、MULTI_LEG=多腿策略earnings_time str 财报日期 earnings_pub_type int 财报发布类型 1=盘前、2=盘后corporate_action_list list 公司行动列表 industry_plate_list list 行业板块列表 concept_plate_list list 概念板块列表
Example
from moomoo import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
# 筛选器用法引导(按需取消注释,构造后传入 filter_list,多条件为 AND 关系):
# # ① 标的列表筛选 — 只看指定标的的异动
# f_owner = EventFilter(EventIndicatorType.OWNER_LIST,
# security_list=['US.TSLA', 'US.AAPL'])
# # ② 确切值筛选 — 只要 PUT + 主动卖出 + 当天异动
# f_type = EventFilter(EventIndicatorType.OPTION_TYPE, value_list=[2]) # 2=PUT
# f_ticker = EventFilter(EventIndicatorType.TICKER_TYPE, value_list=[2]) # 2=Sell
# f_day = EventFilter(EventIndicatorType.MAX_DAY_NUM, value_list=[0]) # 0=当天
# # ③ 范围筛选 — 成交量 > 500 张、Delta 在 -0.5 ~ -0.1
# f_vol = EventFilter(EventIndicatorType.VOLUME, interval_min=500)
# f_delta = EventFilter(EventIndicatorType.DELTA, interval_min=-0.5, interval_max=-0.1)
ret, data = quote_ctx.get_option_event(OptionMarket.US_SECURITY, count=5)
if ret == RET_OK:
print(data['event_list'])
print('all_count:', data['all_count'])
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
- Output
option_code owner_code symbol fill_time fill_timestamp ticker_type price volume turnover option_type strike_price strike_time strike_timestamp dte underlying_price otm bid_price ask_price iv total_volume total_open_interest vo_ratio delta gamma vega theta rho sentiment order_type_list strategy_type earnings_time earnings_pub_type corporate_action_list industry_plate_list concept_plate_list
0 US.TLT260618C86000 US.TLT TLT 2026-06-12 16:14:00 1.781295e+09 SELL 0.280000 10000 280000.0 CALL 86.0 2026-06-18 1.781759e+09 3 85.77 0.268 0.28 0.30 8.240 70108 88849 0.78906 0.424382 0.432194 0.043077 -0.034441 0.005940 BEARISH [SWEEP, NORMAL] SINGLE_LEG N/A N/A N/A N/A N/A
1 US.TLT260618C86000 US.TLT TLT 2026-06-12 16:13:18 1.781295e+09 SELL 0.280000 7821 218988.0 CALL 86.0 2026-06-18 1.781759e+09 3 85.77 0.268 0.28 0.30 8.240 60104 88849 0.67647 0.424382 0.432194 0.043077 -0.034441 0.005940 BEARISH [SWEEP, NORMAL] SINGLE_LEG N/A N/A N/A N/A N/A
2 US.IWM260618P285000 US.IWM IWM 2026-06-12 16:07:53 1.781295e+09 SELL 1.320000 3002 396264.0 PUT 285.0 2026-06-18 1.781759e+09 3 292.96 2.717 1.32 1.35 28.323 57418 26731 2.14799 -0.214110 0.027402 0.109475 -0.256980 -0.009801 BULLISH [SWEEP, NORMAL] SINGLE_LEG N/A N/A [{'action_type': 7, 'action_time': '2026-06-15', 'action_timestamp': ...}] N/A N/A
3 US.SPY260717P706000 US.SPY SPY 2026-06-12 16:04:46 1.781295e+09 BUY 4.333523 3872 1677940.0 PUT 706.0 2026-07-17 1.784264e+09 32 741.77 4.822 4.29 4.35 19.000 22269 8169 2.72603 -0.177726 0.005982 0.596630 -0.150480 -0.113947 BEARISH [SWEEP, NORMAL] SINGLE_LEG N/A N/A N/A N/A [US.LIST2153]
4 US.SPY260717P704000 US.SPY SPY 2026-06-12 16:04:26 1.781295e+09 SELL 4.060235 6767 2747561.0 PUT 704.0 2026-07-17 1.784264e+09 32 741.77 5.091 4.05 4.10 19.214 17712 7842 2.25860 -0.167963 0.005705 0.575554 -0.147087 -0.107775 BULLISH [NORMAL] SINGLE_LEG N/A N/A N/A N/A [US.LIST2153]
all_count: 164620
2
3
4
5
6
7
# Qot_GetOptionEvent.proto
介绍
获取期权异动列表
参数
message EventIndicator
{
required int32 indicatorType = 1; //Qot_GetOptionEvent.EventIndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2;
}
message EventSort
{
required int32 indicatorType = 1; //EventIndicatorType(排序字段)
required bool isAsc = 2; //是否升序
}
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket
optional int32 count = 2; //每页数量[1,300]
optional string page = 3; //分页标记,首次为空字符串
repeated EventIndicator filterList = 4; //筛选条件列表(条件间AND逻辑)
optional EventSort sort = 5; //排序(默认按时间降序)
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
- 返回
message CorporateAction
{
optional int32 actionType = 1; //CorporateActionType
optional string actionTime = 2; //行动日期("yyyy-MM-dd")
optional double actionTimestamp = 3; //行动日期(Unix秒)
}
message EventItem
{
optional Qot_Common.Security option = 1; //期权合约标识
optional Qot_Common.Security owner = 2; //标的股票标识
optional string symbol = 3; //标的display code
optional string fillTime = 10; //成交时间
optional double fillTimestamp = 11; //成交时间(Unix秒)
optional int32 tickerType = 12; //TickerType,成交方向
optional double price = 13; //成交价
optional int64 volume = 14; //成交量(张)
optional double turnover = 15; //成交额
optional int32 optionType = 20; //Qot_Common.OptionType
optional double strikePrice = 21; //行权价
optional string strikeTime = 22; //到期日
optional double strikeTimestamp = 23; //到期日(Unix秒)
optional int32 dte = 24; //距到期天数
optional double underlyingPrice = 30; //标的价格
optional double otm = 31; //价外比率(百分比)
optional double bidPrice = 32; //买一价
optional double askPrice = 33; //卖一价
optional double iv = 34; //隐含波动率(百分比)
optional int64 totalVolume = 35; //期权当日总成交量
optional int64 totalOpenInterest = 36; //期权当日总持仓量
optional double voRatio = 37; //量仓比(百分比)
optional double delta = 40;
optional double gamma = 41;
optional double vega = 42;
optional double theta = 43;
optional double rho = 44;
optional int32 sentiment = 50; //MarketSentiment
repeated int32 orderTypeList = 51; //OptionOrderType列表
optional int32 strategyType = 52; //TickerStrategy
optional string earningsTime = 60; //财报日期
optional int32 earningsPubType = 61; //EarningsPubType
repeated CorporateAction corporateActionList = 63; //公司行动列表
repeated Qot_Common.Security industryPlateList = 64; //行业板块列表
repeated Qot_Common.Security conceptPlateList = 65; //概念板块列表
}
message S2C
{
repeated EventItem eventList = 1; //异动列表
optional string nextPage = 2; //下一页标记(空字符串=无下一页)
optional int32 allCount = 3; //总记录数
optional double updateTimestamp = 4; //列表更新时间(Unix秒)
}
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
- 接口调用结果,结构参见 RetType
协议 ID
3307
uint GetOptionEvent(Qot_GetOptionEvent.Request req); virtual void OnReply_GetOptionEvent(MMAPI_Conn client, uint nSerialNo, Qot_GetOptionEvent.Response rsp);
介绍
获取期权异动列表
参数
message EventIndicator
{
required int32 indicatorType = 1; //Qot_GetOptionEvent.EventIndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2;
}
message EventSort
{
required int32 indicatorType = 1; //EventIndicatorType(排序字段)
required bool isAsc = 2; //是否升序
}
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket
optional int32 count = 2; //每页数量[1,300]
optional string page = 3; //分页标记,首次为空字符串
repeated EventIndicator filterList = 4; //筛选条件列表(条件间AND逻辑)
optional EventSort sort = 5; //排序(默认按时间降序)
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
- 返回
message CorporateAction
{
optional int32 actionType = 1; //CorporateActionType
optional string actionTime = 2; //行动日期("yyyy-MM-dd")
optional double actionTimestamp = 3; //行动日期(Unix秒)
}
message EventItem
{
optional Qot_Common.Security option = 1; //期权合约标识
optional Qot_Common.Security owner = 2; //标的股票标识
optional string symbol = 3; //标的display code
optional string fillTime = 10; //成交时间
optional double fillTimestamp = 11; //成交时间(Unix秒)
optional int32 tickerType = 12; //TickerType,成交方向
optional double price = 13; //成交价
optional int64 volume = 14; //成交量(张)
optional double turnover = 15; //成交额
optional int32 optionType = 20; //Qot_Common.OptionType
optional double strikePrice = 21; //行权价
optional string strikeTime = 22; //到期日
optional double strikeTimestamp = 23; //到期日(Unix秒)
optional int32 dte = 24; //距到期天数
optional double underlyingPrice = 30; //标的价格
optional double otm = 31; //价外比率(百分比)
optional double bidPrice = 32; //买一价
optional double askPrice = 33; //卖一价
optional double iv = 34; //隐含波动率(百分比)
optional int64 totalVolume = 35; //期权当日总成交量
optional int64 totalOpenInterest = 36; //期权当日总持仓量
optional double voRatio = 37; //量仓比(百分比)
optional double delta = 40;
optional double gamma = 41;
optional double vega = 42;
optional double theta = 43;
optional double rho = 44;
optional int32 sentiment = 50; //MarketSentiment
repeated int32 orderTypeList = 51; //OptionOrderType列表
optional int32 strategyType = 52; //TickerStrategy
optional string earningsTime = 60; //财报日期
optional int32 earningsPubType = 61; //EarningsPubType
repeated CorporateAction corporateActionList = 63; //公司行动列表
repeated Qot_Common.Security industryPlateList = 64; //行业板块列表
repeated Qot_Common.Security conceptPlateList = 65; //概念板块列表
}
message S2C
{
repeated EventItem eventList = 1; //异动列表
optional string nextPage = 2; //下一页标记(空字符串=无下一页)
optional int32 allCount = 3; //总记录数
optional double updateTimestamp = 4; //列表更新时间(Unix秒)
}
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
- 接口调用结果,结构参见 RetType
协议 ID
3307
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_GetOptionEvent.C2S.CreateBuilder()
// TODO: 按 proto 填充 c2s 字段
.Build();
var req = Qot_GetOptionEvent.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetOptionEvent(req);
Console.Write("Send GetOptionEvent: {0}\n", seqNo);
}
public void OnReply_GetOptionEvent(MMAPI_Conn client, uint nSerialNo, Qot_GetOptionEvent.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
int getOptionEvent(Qot_GetOptionEvent.Request req) onReply_GetOptionEvent(MMAPI_Conn client, int nSerialNo, Qot_GetOptionEvent.Response rsp)
介绍
获取期权异动列表
参数
message EventIndicator
{
required int32 indicatorType = 1; //Qot_GetOptionEvent.EventIndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2;
}
message EventSort
{
required int32 indicatorType = 1; //EventIndicatorType(排序字段)
required bool isAsc = 2; //是否升序
}
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket
optional int32 count = 2; //每页数量[1,300]
optional string page = 3; //分页标记,首次为空字符串
repeated EventIndicator filterList = 4; //筛选条件列表(条件间AND逻辑)
optional EventSort sort = 5; //排序(默认按时间降序)
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
- 返回
message CorporateAction
{
optional int32 actionType = 1; //CorporateActionType
optional string actionTime = 2; //行动日期("yyyy-MM-dd")
optional double actionTimestamp = 3; //行动日期(Unix秒)
}
message EventItem
{
optional Qot_Common.Security option = 1; //期权合约标识
optional Qot_Common.Security owner = 2; //标的股票标识
optional string symbol = 3; //标的display code
optional string fillTime = 10; //成交时间
optional double fillTimestamp = 11; //成交时间(Unix秒)
optional int32 tickerType = 12; //TickerType,成交方向
optional double price = 13; //成交价
optional int64 volume = 14; //成交量(张)
optional double turnover = 15; //成交额
optional int32 optionType = 20; //Qot_Common.OptionType
optional double strikePrice = 21; //行权价
optional string strikeTime = 22; //到期日
optional double strikeTimestamp = 23; //到期日(Unix秒)
optional int32 dte = 24; //距到期天数
optional double underlyingPrice = 30; //标的价格
optional double otm = 31; //价外比率(百分比)
optional double bidPrice = 32; //买一价
optional double askPrice = 33; //卖一价
optional double iv = 34; //隐含波动率(百分比)
optional int64 totalVolume = 35; //期权当日总成交量
optional int64 totalOpenInterest = 36; //期权当日总持仓量
optional double voRatio = 37; //量仓比(百分比)
optional double delta = 40;
optional double gamma = 41;
optional double vega = 42;
optional double theta = 43;
optional double rho = 44;
optional int32 sentiment = 50; //MarketSentiment
repeated int32 orderTypeList = 51; //OptionOrderType列表
optional int32 strategyType = 52; //TickerStrategy
optional string earningsTime = 60; //财报日期
optional int32 earningsPubType = 61; //EarningsPubType
repeated CorporateAction corporateActionList = 63; //公司行动列表
repeated Qot_Common.Security industryPlateList = 64; //行业板块列表
repeated Qot_Common.Security conceptPlateList = 65; //概念板块列表
}
message S2C
{
repeated EventItem eventList = 1; //异动列表
optional string nextPage = 2; //下一页标记(空字符串=无下一页)
optional int32 allCount = 3; //总记录数
optional double updateTimestamp = 4; //列表更新时间(Unix秒)
}
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
- 接口调用结果,结构参见 RetType
协议 ID
3307
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_GetOptionEvent.C2S c2s = Qot_GetOptionEvent.C2S.newBuilder()
// TODO: 按 proto 填充 c2s 字段
.build();
Qot_GetOptionEvent.Request req = Qot_GetOptionEvent.Request.newBuilder()
.setC2S(c2s).build();
int seqNo = qot.getOptionEvent(req);
System.out.println("Send getOptionEvent: " + seqNo);
}
@Override
public void onReply_GetOptionEvent(MMAPI_Conn client, int nSerialNo, Qot_GetOptionEvent.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
Moomoo::u32_t GetOptionEvent(const Qot_GetOptionEvent::Request &stReq);
virtual void OnReply_GetOptionEvent(Moomoo::u32_t nSerialNo, const Qot_GetOptionEvent::Response &stRsp) = 0;
介绍
获取期权异动列表
参数
message EventIndicator
{
required int32 indicatorType = 1; //Qot_GetOptionEvent.EventIndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2;
}
message EventSort
{
required int32 indicatorType = 1; //EventIndicatorType(排序字段)
required bool isAsc = 2; //是否升序
}
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket
optional int32 count = 2; //每页数量[1,300]
optional string page = 3; //分页标记,首次为空字符串
repeated EventIndicator filterList = 4; //筛选条件列表(条件间AND逻辑)
optional EventSort sort = 5; //排序(默认按时间降序)
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
- 返回
message CorporateAction
{
optional int32 actionType = 1; //CorporateActionType
optional string actionTime = 2; //行动日期("yyyy-MM-dd")
optional double actionTimestamp = 3; //行动日期(Unix秒)
}
message EventItem
{
optional Qot_Common.Security option = 1; //期权合约标识
optional Qot_Common.Security owner = 2; //标的股票标识
optional string symbol = 3; //标的display code
optional string fillTime = 10; //成交时间
optional double fillTimestamp = 11; //成交时间(Unix秒)
optional int32 tickerType = 12; //TickerType,成交方向
optional double price = 13; //成交价
optional int64 volume = 14; //成交量(张)
optional double turnover = 15; //成交额
optional int32 optionType = 20; //Qot_Common.OptionType
optional double strikePrice = 21; //行权价
optional string strikeTime = 22; //到期日
optional double strikeTimestamp = 23; //到期日(Unix秒)
optional int32 dte = 24; //距到期天数
optional double underlyingPrice = 30; //标的价格
optional double otm = 31; //价外比率(百分比)
optional double bidPrice = 32; //买一价
optional double askPrice = 33; //卖一价
optional double iv = 34; //隐含波动率(百分比)
optional int64 totalVolume = 35; //期权当日总成交量
optional int64 totalOpenInterest = 36; //期权当日总持仓量
optional double voRatio = 37; //量仓比(百分比)
optional double delta = 40;
optional double gamma = 41;
optional double vega = 42;
optional double theta = 43;
optional double rho = 44;
optional int32 sentiment = 50; //MarketSentiment
repeated int32 orderTypeList = 51; //OptionOrderType列表
optional int32 strategyType = 52; //TickerStrategy
optional string earningsTime = 60; //财报日期
optional int32 earningsPubType = 61; //EarningsPubType
repeated CorporateAction corporateActionList = 63; //公司行动列表
repeated Qot_Common.Security industryPlateList = 64; //行业板块列表
repeated Qot_Common.Security conceptPlateList = 65; //概念板块列表
}
message S2C
{
repeated EventItem eventList = 1; //异动列表
optional string nextPage = 2; //下一页标记(空字符串=无下一页)
optional int32 allCount = 3; //总记录数
optional double updateTimestamp = 4; //列表更新时间(Unix秒)
}
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
- 接口调用结果,结构参见 RetType
协议 ID
3307
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_GetOptionEvent::Request req;
Qot_GetOptionEvent::C2S *c2s = req.mutable_c2s();
// TODO: 按 proto 填充 c2s 字段
m_GetOptionEventSerialNo = m_pQotApi->GetOptionEvent(req);
}
virtual void OnReply_GetOptionEvent(Moomoo::u32_t nSerialNo, const Qot_GetOptionEvent::Response &stRsp) {
if (nSerialNo != m_GetOptionEventSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
MMAPI_Qot *m_pQotApi;
Moomoo::u32_t m_GetOptionEventSerialNo = 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
getOptionEvent(qotGetOptionEvent)
介绍
获取期权异动列表
参数
message EventIndicator
{
required int32 indicatorType = 1; //Qot_GetOptionEvent.EventIndicatorType
optional Qot_OptionCommon.IndicatorValue indicatorValue = 2;
}
message EventSort
{
required int32 indicatorType = 1; //EventIndicatorType(排序字段)
required bool isAsc = 2; //是否升序
}
message C2S
{
required int32 optionMarket = 1; //Qot_OptionCommon.OptionMarket
optional int32 count = 2; //每页数量[1,300]
optional string page = 3; //分页标记,首次为空字符串
repeated EventIndicator filterList = 4; //筛选条件列表(条件间AND逻辑)
optional EventSort sort = 5; //排序(默认按时间降序)
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
- 返回
message CorporateAction
{
optional int32 actionType = 1; //CorporateActionType
optional string actionTime = 2; //行动日期("yyyy-MM-dd")
optional double actionTimestamp = 3; //行动日期(Unix秒)
}
message EventItem
{
optional Qot_Common.Security option = 1; //期权合约标识
optional Qot_Common.Security owner = 2; //标的股票标识
optional string symbol = 3; //标的display code
optional string fillTime = 10; //成交时间
optional double fillTimestamp = 11; //成交时间(Unix秒)
optional int32 tickerType = 12; //TickerType,成交方向
optional double price = 13; //成交价
optional int64 volume = 14; //成交量(张)
optional double turnover = 15; //成交额
optional int32 optionType = 20; //Qot_Common.OptionType
optional double strikePrice = 21; //行权价
optional string strikeTime = 22; //到期日
optional double strikeTimestamp = 23; //到期日(Unix秒)
optional int32 dte = 24; //距到期天数
optional double underlyingPrice = 30; //标的价格
optional double otm = 31; //价外比率(百分比)
optional double bidPrice = 32; //买一价
optional double askPrice = 33; //卖一价
optional double iv = 34; //隐含波动率(百分比)
optional int64 totalVolume = 35; //期权当日总成交量
optional int64 totalOpenInterest = 36; //期权当日总持仓量
optional double voRatio = 37; //量仓比(百分比)
optional double delta = 40;
optional double gamma = 41;
optional double vega = 42;
optional double theta = 43;
optional double rho = 44;
optional int32 sentiment = 50; //MarketSentiment
repeated int32 orderTypeList = 51; //OptionOrderType列表
optional int32 strategyType = 52; //TickerStrategy
optional string earningsTime = 60; //财报日期
optional int32 earningsPubType = 61; //EarningsPubType
repeated CorporateAction corporateActionList = 63; //公司行动列表
repeated Qot_Common.Security industryPlateList = 64; //行业板块列表
repeated Qot_Common.Security conceptPlateList = 65; //概念板块列表
}
message S2C
{
repeated EventItem eventList = 1; //异动列表
optional string nextPage = 2; //下一页标记(空字符串=无下一页)
optional int32 allCount = 3; //总记录数
optional double updateTimestamp = 4; //列表更新时间(Unix秒)
}
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
- 接口调用结果,结构参见 RetType
协议 ID
3307
Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_OptionCommon } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetOptionEvent(){
const { RetType } = Common
const { OptionMarket } = 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,
count: 5,
},
};
websocket.GetOptionEvent(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetOptionEvent: 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);
}
QotGetOptionEvent()
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
- Output
GetOptionEvent: errCode 0, retMsg , retType 0
{
"eventList": [
{
"option": { "market": 1, "code": "TLT260618C86000" },
"owner": { "market": 1, "code": "TLT" },
"symbol": "TLT",
"fillTime": "2026-06-12 16:14:00",
"fillTimestamp": 1781295240,
"tickerType": 2,
"price": 0.28,
"volume": 10000,
"turnover": 280000,
"optionType": 1,
"strikePrice": 86,
"strikeTime": "2026-06-18",
"strikeTimestamp": 1781759000,
"dte": 3,
"underlyingPrice": 85.77,
"otm": 0.268,
"bidPrice": 0.28,
"askPrice": 0.3,
"iv": 8.24,
"totalVolume": 70108,
"totalOpenInterest": 88849,
"voRatio": 0.78906,
"delta": 0.424382,
"gamma": 0.432194,
"vega": 0.043077,
"theta": -0.034441,
"rho": 0.00594,
"sentiment": 2,
"orderTypeList": [2, 1],
"strategyType": 1
}
],
"allCount": 164620
}
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
接口限制
- 30 秒内最多请求 60 次期权异动接口(支持分页的接口,仅首次调用纳入统计)