# Warrant Screening V2
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_warrant_screen(request)
Description
Warrant screening V2. Compared with the legacy get_warrant, this API returns 43 columns of warrant attributes, supports HK / Singapore / Malaysia markets, and supports a count-only mode (only_count). All numeric fields accept raw values; OpenD performs magnification conversion internally.
Parameters
Parameter Type Description request WarrantScreenRequest Warrant screening request object; warrant_market must be passed at construction WarrantScreenRequest fields:
Field Type Description warrant_market WarrantMarket Market HK=1, SG=4, MY=15is_delay bool Whether to use delayed market data Defaults to Falseonly_count bool Whether to return only the total count (no detailed records) Defaults to False; when True only all_count is filled and DataFrame is emptypage_from int Pagination start position Defaults to 0page_count int Maximum results per page Defaults to 200Filter builder methods (each call appends one filter condition):
Method Description add_interval_filter(field_id, min_val=None, max_val=None, min_included=True, max_included=True) Interval filter field_id comes from WarrantField; min_val / max_val are passed as raw values (OpenD performs magnification automatically, e.g. current price 5 → 5.0, street ratio 50% → 50.0, effective leverage > 3 → 3.0); both min_val and max_val are optional, and omitting both makes this condition a no-op (equivalent to no filter)add_choice_filter(field_id, choices) Choice filter choices may be int enums or string codes; e.g. STOCK_OWNER accepts ["HK.00700"], WARRANT_TYPE accepts [WarrantType.CALL, WarrantType.PUT]add_sort(field_id, desc=False) Sort desc=True for descending; ascending by defaultCommon WarrantField field_id (full list see WarrantField):
field_id Meaning Filter type 4 ISSUER_ID choice 5 STOCK_OWNER underlying choice Accepts code strings like ["HK.00700"]6 WARRANT_TYPE choice 1=Call, 2=Put, 3=Bull, 4=Bear, 5=Inline; see WarrantType8 CURRENT_PRICE interval 9 STREET_RATIO interval 10 VOLUME interval 16 LEVERAGE_RATIO interval 19 STATUS choice 0=Normal, 1=Suspended, 2=Pre-IPO; see WarrantStatus23 EFFECTIVE_LEVERAGE interval
Returns
Parameter Type Description ret RET_CODE API result data tuple When ret == RET_OK, returns (last_page, all_count, DataFrame) str When ret != RET_OK, an error description is returned Returned DataFrame fields (43 columns total):
Field Type Description stock_id int Warrant stock ID stock_owner int Underlying stock ID issuer_id int Issuer ID warrant_type int Warrant type 1=Call, 2=Put, 3=Bull, 4=Bear, 5=Inlinestrike_price float Strike price maturity_date str Maturity date last_trade_date str Last trade date conversion_ratio float Conversion ratio last_close_price float Previous close price recovery_price float Recovery price (Bull/Bear only) stock_owner_price float Underlying stock price current_price float Current price volume int Volume turnover float Turnover sell_vol int Ask volume buy_vol int Bid volume sell_price float Ask price buy_price float Bid price street_rate float Street ratio high_price float High low_price float Low implied_volatility float Implied volatility (Call/Put only) delta float Delta (Call/Put only) status int Warrant status 0=Normal, 1=Suspended, 2=Pre-IPOstreet_rate_new float Street ratio (new) score float Composite score premium float Premium leverage float Leverage effective_leverage float Effective leverage break_even_point float Break-even point ipop float In/Out of the money amplitude float Amplitude fx_score float SG score ipo_time str IPO time street_vol int Street volume lot_size int Lot size issue_size int Issue size ipo_price float IPO price upper_strike_price float Upper strike price (Inline only) lower_strike_price float Lower strike price (Inline only) iw_price_status int Inside / outside the range sensitivity float Sensitivity price_recovery_ratio float Underlying distance to recovery price (Bull/Bear only)
Example
from futu import (
OpenQuoteContext, RET_OK, WarrantScreenRequest,
WarrantMarket, WarrantField, WarrantType,
)
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
# Example 1: HK low-priced high-leverage Call / Put warrants
req = WarrantScreenRequest(warrant_market=WarrantMarket.HK)
req.add_choice_filter(field_id=WarrantField.WARRANT_TYPE,
choices=[WarrantType.CALL, WarrantType.PUT]) # Call + Put
req.add_interval_filter(field_id=WarrantField.CURRENT_PRICE,
min_val=0.1, max_val=5.0) # Current price 0.1~5
req.add_interval_filter(field_id=WarrantField.EFFECTIVE_LEVERAGE,
min_val=3.0) # Effective leverage > 3
req.add_interval_filter(field_id=WarrantField.STREET_RATIO, max_val=50.0) # Street ratio < 50%
req.add_sort(field_id=WarrantField.VOLUME, desc=True) # Volume descending
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)
# Example 2: Return only the total count of matching records
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"Total Call warrants matching: {all_count}")
# Example 3: Filter by underlying stock code (choice accepts code string)
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]) # Bull + 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
Total Call warrants matching: 98
2
3
4
5
6
7
# Qot_WarrantScreen.proto
Description
Warrant screening V2
Parameters
message Boundary
{
required double value = 1;
optional bool includes = 2; // Closed interval, defaults to true
}
message Interval
{
optional Boundary filterMin = 1;
optional Boundary filterMax = 2;
}
message Choice
{
required int32 contentType = 1; // 1=numeric, 2=text
optional string text = 2;
optional int64 value = 3;
}
// One filter condition: interval / choices, choose one
message ScreenGroup
{
required int32 fieldId = 1; // WarrantField enum
optional Interval interval = 2; // Interval filter
repeated Choice choices = 3; // Choice filter
}
message Sort
{
required int32 sortFieldId = 1;
required int32 direction = 2; // 0=ascending, 1=descending
}
message C2S
{
required int32 marketType = 1; // Market: HK=1, SG=4, MY=15
optional bool isDelay = 2;
repeated ScreenGroup filterList = 3;
repeated Sort sortList = 4;
optional bool onlyCount = 5; // Return only the total count
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
- Returns
message WarrantItem
{
optional int64 stockId = 1;
optional int64 stockOwner = 2;
optional int32 issuerId = 3;
optional int32 warrantType = 4; // 1=Call, 2=Put, 3=Bull, 4=Bear, 5=Inline
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
- API result; structure see RetType
Proto ID
3254
uint WarrantScreen(QotWarrantScreen.Request req); virtual void OnReply_WarrantScreen(FTAPI_Conn client, uint nSerialNo, QotWarrantScreen.Response rsp);
Description
Warrant screening V2
Parameters
See the request structure of Qot_WarrantScreen.proto in the Proto tab.
Returns
See the response structure of Qot_WarrantScreen.proto in the Proto tab.
Proto ID
3254
int warrantScreen(QotWarrantScreen.Request req) onReply_WarrantScreen(FTAPI_Conn client, int nSerialNo, QotWarrantScreen.Response rsp)
Description
Warrant screening V2
Parameters
See the request structure of Qot_WarrantScreen.proto in the Proto tab.
Returns
See the response structure of Qot_WarrantScreen.proto in the Proto tab.
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)
Description
Warrant screening V2
Parameters
See the request structure of Qot_WarrantScreen.proto in the Proto tab.
Returns
See the response structure of Qot_WarrantScreen.proto in the Proto tab.
Proto ID
3254
warrantScreen(qotWarrantScreen)
Description
Warrant screening V2
Parameters
See the request structure of Qot_WarrantScreen.proto in the Proto tab.
Returns
See the response structure of Qot_WarrantScreen.proto in the Proto tab.
Proto ID
3254
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_warrant_screen(request)
Description
Warrant screening V2. Parameters and return fields are identical to the nn tab.
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
See the Proto content in the nn tab. Proto ID 3254.
uint WarrantScreen(QotWarrantScreen.Request req); virtual void OnReply_WarrantScreen(FTAPI_Conn client, uint nSerialNo, QotWarrantScreen.Response rsp);
See the Proto content in the nn tab. Proto ID 3254.
int warrantScreen(QotWarrantScreen.Request req) onReply_WarrantScreen(FTAPI_Conn client, int nSerialNo, QotWarrantScreen.Response rsp)
See the Proto content in the nn tab. 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)
See the Proto content in the nn tab. Proto ID 3254.
warrantScreen(qotWarrantScreen)
See the Proto content in the nn tab. Proto ID 3254.