# 筛选窝轮 V2
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_warrant_screen(request)
介绍
窝轮筛选 V2。相比旧接口 get_warrant,返回 43 列窝轮属性,支持港股 / 新加坡 / 马来西亚市场,且支持仅返回总数(only_count)。所有数值字段直接传原始值,OpenD 内部完成倍率转换。
参数
参数 类型 说明 request WarrantScreenRequest 窝轮筛选请求对象,构造时必传 warrant_market WarrantScreenRequest 字段:
字段 类型 说明 warrant_market WarrantMarket 市场 HK=1、SG=4、MY=15is_delay bool 是否使用延时行情 不传默认为 Falseonly_count bool 是否仅返回总数(不返回明细) 不传默认为 False;True 时仅填充 all_count,DataFrame 为空page_from int 分页起始位置 不传默认为 0page_count int 单页最大返回数 不传默认为 200筛选条件 builder 方法(每次调用追加一条筛选条件):
方法 说明 add_interval_filter(field_id, min_val=None, max_val=None, min_included=True, max_included=True) 区间筛选 field_id 取自 WarrantField;min_val / max_val 直接传原始值(OpenD 自动倍率转换,如现价 5 元传 5.0、街货占比 50% 传 50.0、有效杠杆 > 3 传 3.0);min_val / max_val 均为可选,全部不传时该条件不会生效(等同于不筛选)add_choice_filter(field_id, choices) 多选筛选 choices 元素可为 int 枚举或 str 代码,例如 STOCK_OWNER 字段可直接传 ["HK.00700"],WARRANT_TYPE 可传 [WarrantType.CALL, WarrantType.PUT]add_sort(field_id, desc=False) 排序 desc=True 为降序,默认升序常用 WarrantField field_id(完整列表见 WarrantField):
field_id 含义 筛选方式 4 ISSUER_ID 发行商 ID choice 5 STOCK_OWNER 正股 choice 可传 ["HK.00700"] 这样的 code 字符串6 WARRANT_TYPE 窝轮类型 choice 1=认购、2=认沽、3=牛证、4=熊证、5=界内证;详见 WarrantType8 CURRENT_PRICE 当前价 interval 9 STREET_RATIO 街货占比 interval 10 VOLUME 成交量 interval 16 LEVERAGE_RATIO 杠杆比率 interval 19 STATUS 状态 choice 0=正常、1=终止交易、2=待上市;详见 WarrantStatus23 EFFECTIVE_LEVERAGE 有效杠杆 interval
返回
参数 类型 说明 ret RET_CODE 接口调用结果 data tuple 当 ret == RET_OK,返回 (last_page, all_count, DataFrame) str 当 ret != RET_OK,返回错误描述 返回 DataFrame 字段(共 43 列):
字段 类型 说明 stock_id int 窝轮股票 ID stock_owner int 所属正股 ID issuer_id int 发行商 ID warrant_type int 窝轮类型 1=认购,2=认沽,3=牛证,4=熊证,5=界内证strike_price float 行权价 maturity_date str 到期日 last_trade_date str 最后交易日 conversion_ratio float 换股比率 last_close_price float 昨收价 recovery_price float 收回价(仅牛熊证) stock_owner_price float 正股价 current_price float 现价 volume int 成交量 turnover float 成交额 sell_vol int 卖量 buy_vol int 买量 sell_price float 卖价 buy_price float 买价 street_rate float 街货比 high_price float 最高价 low_price float 最低价 implied_volatility float 引伸波幅(仅认购认沽) delta float 对冲值(仅认购认沽) status int 窝轮状态 0=正常,1=终止交易,2=待上市street_rate_new float 街货比(新) score float 综合评分 premium float 溢价 leverage float 杠杆 effective_leverage float 有效杠杆 break_even_point float 打和点 ipop float 价内/价外 amplitude float 振幅 fx_score float 法兴评分 ipo_time str 上市时间 street_vol int 街货量 lot_size int 每手数量 issue_size int 发行量 ipo_price float 发行价 upper_strike_price float 上限价(仅界内证) lower_strike_price float 下限价(仅界内证) iw_price_status int 界内/界外 sensitivity float 敏感度 price_recovery_ratio float 正股距收回价(仅牛熊证)
Example
from futu import (
OpenQuoteContext, RET_OK, WarrantScreenRequest,
WarrantMarket, WarrantField, WarrantType,
)
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
# 示例 1:港股低价高杠杆认购证 / 认沽证
req = WarrantScreenRequest(warrant_market=WarrantMarket.HK)
req.add_choice_filter(field_id=WarrantField.WARRANT_TYPE,
choices=[WarrantType.CALL, WarrantType.PUT]) # 认购 + 认沽
req.add_interval_filter(field_id=WarrantField.CURRENT_PRICE,
min_val=0.1, max_val=5.0) # 现价 0.1~5
req.add_interval_filter(field_id=WarrantField.EFFECTIVE_LEVERAGE,
min_val=3.0) # 有效杠杆 > 3
req.add_interval_filter(field_id=WarrantField.STREET_RATIO, max_val=50.0) # 街货占比 < 50%
req.add_sort(field_id=WarrantField.VOLUME, desc=True) # 成交量降序
req.page_count = 20
ret, data = quote_ctx.get_warrant_screen(req)
if ret == RET_OK:
last_page, all_count, df = data
print(df[['stock_id', 'warrant_type', 'current_price', 'effective_leverage']].head())
else:
print('error: ', data)
# 示例 2:仅查满足条件的总数
req = WarrantScreenRequest(warrant_market=WarrantMarket.HK)
req.only_count = True
req.add_choice_filter(field_id=WarrantField.WARRANT_TYPE, choices=[WarrantType.CALL])
req.add_interval_filter(field_id=WarrantField.CURRENT_PRICE, min_val=1.0)
ret, data = quote_ctx.get_warrant_screen(req)
if ret == RET_OK:
_, all_count, _ = data
print(f"满足条件的认购证总数:{all_count}")
# 示例 3:按正股代码筛选(choice 直接传 code 字符串)
req = WarrantScreenRequest(warrant_market=WarrantMarket.HK)
req.add_choice_filter(field_id=WarrantField.STOCK_OWNER, choices=["HK.00700"])
req.add_choice_filter(field_id=WarrantField.WARRANT_TYPE,
choices=[WarrantType.BULL, WarrantType.BEAR]) # 牛证 + 熊证
req.add_sort(field_id=WarrantField.TURNOVER, desc=True)
req.page_count = 50
ret, data = quote_ctx.get_warrant_screen(req)
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
- Output
stock_id warrant_type current_price effective_leverage
0 87930865475960 1 0.107 4.337
1 87939455410698 1 0.108 4.307
2 88231513189723 1 0.120 4.996
3 87969520182112 1 0.110 3.604
4 88356067241952 1 0.127 6.827
满足条件的认购证总数:98
2
3
4
5
6
7
# Qot_WarrantScreen.proto
介绍
窝轮筛选 V2
参数
message Boundary
{
required double value = 1;
optional bool includes = 2; // 是否闭区间,默认 true
}
message Interval
{
optional Boundary filterMin = 1;
optional Boundary filterMax = 2;
}
message Choice
{
required int32 contentType = 1; // 1=数值, 2=文本
optional string text = 2;
optional int64 value = 3;
}
// 一条筛选条件:interval / choices 二选一
message ScreenGroup
{
required int32 fieldId = 1; // WarrantField 枚举
optional Interval interval = 2; // 区间筛选
repeated Choice choices = 3; // 多选筛选
}
message Sort
{
required int32 sortFieldId = 1;
required int32 direction = 2; // 0=升序, 1=降序
}
message C2S
{
required int32 marketType = 1; // 市场,HK=1、SG=4、MY=15
optional bool isDelay = 2;
repeated ScreenGroup filterList = 3;
repeated Sort sortList = 4;
optional bool onlyCount = 5; // 仅返回总数
optional int32 pageFrom = 6;
optional int32 pageCount = 7;
}
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
- 返回
message WarrantItem
{
optional int64 stockId = 1;
optional int64 stockOwner = 2;
optional int32 issuerId = 3;
optional int32 warrantType = 4; // 1=认购,2=认沽,3=牛证,4=熊证,5=界内证
optional double strikePrice = 5;
optional string maturityDate = 6;
optional string lastTradeDate = 7;
optional double conversionRatio = 8;
optional double lastclosePrice = 9;
optional double recoveryPrice = 10;
optional double stockOwnerPrice = 11;
optional double currentPrice = 12;
optional int64 volume = 13;
optional double turnover = 14;
optional int64 sellVol = 15;
optional int64 buyVol = 16;
optional double sellPrice = 17;
optional double buyPrice = 18;
optional double streetRate = 19;
optional double highPrice = 20;
optional double lowPrice = 21;
optional double impliedVolatility = 22;
optional double delta = 23;
optional int32 status = 24;
optional double streetRateNew = 25;
optional double score = 26;
optional double premium = 27;
optional double leverage = 28;
optional double effectiveLeverage = 29;
optional double breakEvenPoint = 30;
optional double ipop = 31;
optional double amplitude = 32;
optional double fxScore = 33;
optional string ipoTime = 34;
optional int64 streetVol = 35;
optional int32 lotSize = 36;
optional int64 issueSize = 37;
optional double ipoPrice = 38;
optional double upperStrikePrice = 39;
optional double lowerStrikePrice = 40;
optional int32 iwPriceStatus = 41;
optional double sensitivity = 42;
optional double priceRecoveryRatio = 43;
}
message S2C
{
required bool lastPage = 1;
required int32 allCount = 2;
repeated WarrantItem warrants = 3;
}
message Response
{
required int32 retType = 1 [default = -400];
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
3254
uint WarrantScreen(QotWarrantScreen.Request req); virtual void OnReply_WarrantScreen(FTAPI_Conn client, uint nSerialNo, QotWarrantScreen.Response rsp);
介绍
窝轮筛选 V2
参数
参考 Proto 标签页中 Qot_WarrantScreen.proto 的请求结构。
返回
参考 Proto 标签页中 Qot_WarrantScreen.proto 的响应结构。
协议 ID
3254
int warrantScreen(QotWarrantScreen.Request req) onReply_WarrantScreen(FTAPI_Conn client, int nSerialNo, QotWarrantScreen.Response rsp)
介绍
窝轮筛选 V2
参数
参考 Proto 标签页中 Qot_WarrantScreen.proto 的请求结构。
返回
参考 Proto 标签页中 Qot_WarrantScreen.proto 的响应结构。
协议 ID
3254
bool WarrantScreen(uint32_t & nSerialNo, const Qot_WarrantScreen::Request & stReq); virtual void OnReply_WarrantScreen(FTAPI_Conn* pConn, uint32_t nSerialNo, const Qot_WarrantScreen::Response & stRsp)
介绍
窝轮筛选 V2
参数
参考 Proto 标签页中 Qot_WarrantScreen.proto 的请求结构。
返回
参考 Proto 标签页中 Qot_WarrantScreen.proto 的响应结构。
协议 ID
3254
warrantScreen(qotWarrantScreen)
介绍
窝轮筛选 V2
参数
参考 Proto 标签页中 Qot_WarrantScreen.proto 的请求结构。
返回
参考 Proto 标签页中 Qot_WarrantScreen.proto 的响应结构。
协议 ID
3254
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_warrant_screen(request)
介绍
窝轮筛选 V2,参数与返回字段同 nn 标签页。
Example
from moomoo import (
OpenQuoteContext, RET_OK, WarrantScreenRequest,
WarrantMarket, WarrantField, WarrantType,
)
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
req = WarrantScreenRequest(warrant_market=WarrantMarket.HK)
req.add_choice_filter(field_id=WarrantField.WARRANT_TYPE,
choices=[WarrantType.CALL, WarrantType.PUT])
req.add_interval_filter(field_id=WarrantField.CURRENT_PRICE,
min_val=0.1, max_val=5.0)
req.add_interval_filter(field_id=WarrantField.EFFECTIVE_LEVERAGE, min_val=3.0)
req.add_sort(field_id=WarrantField.VOLUME, desc=True)
req.page_count = 20
ret, data = quote_ctx.get_warrant_screen(req)
if ret == RET_OK:
last_page, all_count, df = data
print(df[['stock_id', 'warrant_type', 'current_price', 'effective_leverage']].head())
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
# Qot_WarrantScreen.proto
参考 nn 标签页 Proto 内容,协议 ID 3254。
uint WarrantScreen(QotWarrantScreen.Request req); virtual void OnReply_WarrantScreen(FTAPI_Conn client, uint nSerialNo, QotWarrantScreen.Response rsp);
参考 nn 标签页 Proto 内容,协议 ID 3254。
int warrantScreen(QotWarrantScreen.Request req) onReply_WarrantScreen(FTAPI_Conn client, int nSerialNo, QotWarrantScreen.Response rsp)
参考 nn 标签页 Proto 内容,协议 ID 3254。
bool WarrantScreen(uint32_t & nSerialNo, const Qot_WarrantScreen::Request & stReq); virtual void OnReply_WarrantScreen(FTAPI_Conn* pConn, uint32_t nSerialNo, const Qot_WarrantScreen::Response & stRsp)
参考 nn 标签页 Proto 内容,协议 ID 3254。
warrantScreen(qotWarrantScreen)
参考 nn 标签页 Proto 内容,协议 ID 3254。