# Get Filtered Warrant

get_warrant(stock_owner='', req=None)

  • Description

    Get Filtered Warrant (only warrants, CBBCs and Inline Warrants of HK market are surpported)

  • Parameters

    Parameter Type Description
    stock_owner str Code of the underlying stock.
    req WarrantRequest Filter parameter combination.
    • WarrantRequest's details as follows:
      Field Type Description
      begin int Data start point
      num int The number of requested data.
      sort_field SortField According to which field to sort.
      ascend bool The sort direction.
      type_list list Warrant Type Filter List.
      issuer_list list Issuer filter list.
      maturity_time_min str The start time of the maturity date filter range.
      maturity_time_max str The end time of the maturity date filter range.
      ipo_period IpoPeriod Listing period.
      price_type PriceType In/out of the money.
      status WarrantStatus Warrant Status.
      cur_price_min float The filter lower limit (closed interval) of the latest price.
      cur_price_max float The filter upper limit (closed interval) of the latest price.
      strike_price_min float The lower filter limit (closed interval) of the strike price.
      strike_price_max float The upper filter limit (closed interval) of the strike price.
      street_min float The lower limit (closed interval) of Outstanding percentage.
      street_max float The upper limit (closed interval) of Outstanding percentage.
      conversion_min float The lower filter limit (closed interval) of the conversion ratio.
      conversion_max float The upper filter limit (closed interval) of the conversion ratio.
      vol_min int The lower filter limit (closed interval) of the volume.
      vol_max int The upper filter limit (closed interval) of the volume.
      premium_min float The lower filter limit (closed interval) of premium value.
      premium_max float The upper filter limit (closed interval) of premium value.
      leverage_ratio_min float The lower filter limit (closed interval) of the leverage ratio.
      leverage_ratio_max float The upper filter limit (closed interval) of the leverage ratio.
      delta_min float The lower filter limit (closed interval) of the hedge value Delta.
      delta_max float The upper filter limit (closed interval) of the hedge value Delta.
      implied_min float The lower filter limit (closed interval) of the implied volatility.
      implied_max float The upper filter limit (closed interval) of the implied volatility.
      recovery_price_min float The lower filter limit (closed interval) of the recovery price.
      recovery_price_max float The upper filter limit (closed interval) of the recovery price.
      price_recovery_ratio_min float The lower filter limit (closed interval) of the price recovery ratio.
      price_recovery_ratio_max float The upper filter limit (closed interval) of the price recovery ratio.
  • Return

    Field Type Description
    ret RET_CODE Interface result.
    data pd.DataFrame If ret == RET_OK, warrant data is returned.
    str If ret != RET_OK, error description is returned.
    • Warrant data format as follows:

      Field Type Description
      warrant_data_list pd.DataFrame Warrant data after filtering.
      last_page bool Weather is the last page.
      all_count int The total number of warrants in the filtered result.
      • Warrant_data_list's detail as follows:
        Field Type Description
        stock str Warrant code.
        stock_owner str Underlying stock.
        type WrtType Warrant type.
        issuer Issuer Issuer.
        maturity_time str Maturity date.
        list_time str Listing time.
        last_trade_time str Last trading day.
        recovery_price float Recovery price.
        conversion_ratio float Conversion ratio.
        lot_size int Quantity per lot.
        strike_price float Strike price.
        last_close_price float Yesterday's close.
        name str Name.
        cur_price float Current price.
        price_change_val float Price change.
        status WarrantStatus Warrant status.
        bid_price float Bid price.
        ask_price float Ask price.
        bid_vol int Bid volume.
        ask_vol int Ask volume.
        volume unsigned int Volume.
        turnover float Turnover.
        score float Comprehensive score.
        premium float Premium.
        break_even_point float Breakeven point.
        leverage float Leverage ratio.
        ipop float In/out of the money.
        price_recovery_ratio float Price recovery ratio.
        conversion_price float Conversion price.
        street_rate float Outstanding percentage.
        street_vol int Outstanding quantity.
        amplitude float Amplitude.
        issue_size int Issue size.
        high_price float High.
        low_price float Low.
        implied_volatility float Implied volatility.
        delta float Hedging value.
        effective_leverage float Effective leverage.
        upper_strike_price float Upper bound price.
        lower_strike_price float Lower bound price.
        inline_price_status PriceType In/out of bounds.
  • Example

from moomoo import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)

req = WarrantRequest()
req.sort_field = SortField.TURNOVER
req.type_list = WrtType.CALL
req.cur_price_min = 0.1
req.cur_price_max = 0.2
ret, ls = quote_ctx.get_warrant("HK.00700", req)
if ret == RET_OK: # First judge whether the interface return is normal, and then fetch the data
    warrant_data_list, last_page, all_count = ls
    print(len(warrant_data_list), all_count, warrant_data_list)
    print(warrant_data_list['stock'][0]) # Take the first warrant code
    print(warrant_data_list['stock'].values.tolist()) # Convert to list
else:
    print('error: ', ls)
    
req = WarrantRequest()
req.sort_field = SortField.TURNOVER
req.issuer_list = ['UB','CS','BI']
ret, ls = quote_ctx.get_warrant(Market.HK, req)
if ret == RET_OK: 
    warrant_data_list, last_page, all_count = ls
    print(len(warrant_data_list), all_count, warrant_data_list)
else:
    print('error: ', ls)

quote_ctx.close()  # After using the connection, remember to close it to prevent the number of connections from running out
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
  • Output
2 2 
    stock        name stock_owner  type issuer maturity_time   list_time last_trade_time  recovery_price  conversion_ratio  lot_size  strike_price  last_close_price  cur_price  price_change_val  change_rate  status  bid_price  ask_price   bid_vol  ask_vol    volume   turnover   score  premium  break_even_point  leverage    ipop  price_recovery_ratio  conversion_price  street_rate  street_vol  amplitude  issue_size  high_price  low_price  implied_volatility  delta  effective_leverage  list_timestamp  last_trade_timestamp  maturity_timestamp  upper_strike_price  lower_strike_price  inline_price_status
0   HK.20306  MBTENCT@EC2012A    HK.00700  CALL     MB    2020-12-01  2019-06-27      2020-11-25             NaN              50.0      5000        588.88             0.188      0.188             0.000     0.000000  NORMAL      0.000      0.188         0     10000           0          0.0   0.196    1.921            598.28    62.446  -0.319                   NaN              9.40        4.400     1584000      0.000    36000000       0.000      0.000              32.487  0.473              29.536    1.561565e+09          1.606234e+09        1.606752e+09                 NaN                 NaN                  NaN
1   HK.16545  SGTENCT@EC2102B    HK.00700  CALL     SG    2021-02-26  2020-07-14      2021-02-22             NaN             100.0     10000        700.00             0.147      0.143            -0.004    -2.721088  NORMAL      0.141      0.143  28000000  28000000           0          0.0  82.011   21.686            714.30    41.048 -16.142                   NaN             14.30        1.420     2130000      0.000   150000000       0.000      0.000              40.657  0.225               9.235    1.594656e+09          1.613923e+09        1.614269e+09                 NaN                 NaN                  NaN
HK.20306
['HK.20306', 'HK.16545']

200 358
    stock        name stock_owner    type issuer maturity_time   list_time last_trade_time  recovery_price  conversion_ratio  lot_size  strike_price  last_close_price  cur_price  price_change_val  change_rate      status  bid_price  ask_price   bid_vol   ask_vol  volume  turnover   score  premium  break_even_point  leverage     ipop  price_recovery_ratio  conversion_price  street_rate  street_vol  amplitude  issue_size  high_price  low_price  implied_volatility  delta  effective_leverage  list_timestamp  last_trade_timestamp  maturity_timestamp  upper_strike_price  lower_strike_price inline_price_status
0    HK.19839   PINGANRUIYINLINGYIGOUAC    HK.02318    CALL     UB    2020-12-31  2017-12-11      2020-12-24             NaN             100.0     50000         83.88             0.057      0.046            -0.011   -19.298246      NORMAL      0.043      0.046  30000000  30000000       0       0.0  39.585    1.642            88.480    18.923    3.779                   NaN             4.600         1.25     6250000        0.0   500000000         0.0        0.0              25.129  0.692              13.094    1.512922e+09          1.608739e+09        1.609344e+09                 NaN                 NaN                 NaN
1    HK.20084   PINGANZHONGYINLINGYIGOUAC    HK.02318    CALL     BI    2020-12-31  2017-12-19      2020-12-24             NaN             100.0     50000         83.88             0.059      0.050            -0.009   -15.254237      NORMAL      0.044      0.050  10000000  10000000       0       0.0   0.064    2.102            88.880    17.410    3.779                   NaN             5.000         0.07      350000        0.0   500000000         0.0        0.0              29.510  0.668              11.629    1.513613e+09          1.608739e+09        1.609344e+09                 NaN                 NaN                 NaN
......
198  HK.56886   UB#HSI  RC2301F   HK.800000    BULL     UB    2023-01-30  2020-03-24      2023-01-27         21200.0           20000.0     10000      21100.00             0.230      0.232             0.002     0.869565      NORMAL      0.232      0.233  30000000  30000000       0       0.0  46.619   -2.916         25740.000     5.714   25.655             25.062689          4640.000         0.01       40000        0.0   400000000         0.0        0.0                 NaN    NaN               5.714    1.584979e+09          1.674749e+09        1.675008e+09                 NaN                 NaN                 NaN
199  HK.56895   UB#XIAMIRC2012D    HK.01810    BULL     UB    2020-12-30  2020-03-24      2020-12-29             8.0              10.0      2000          7.60             2.010      1.930            -0.080    -3.980100      NORMAL      1.910      1.930   6000000   6000000       0       0.0   0.040    1.127            26.900     1.378  250.000            232.500000            19.300         0.10       60000        0.0    60000000         0.0        0.0                 NaN    NaN               1.378    1.584979e+09          1.609171e+09        1.609258e+09                 NaN                 NaN                 NaN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Interface Limitations

  • Hong Kong stock BMP permission does not support calling this API
  • A maximum of 60 requests per 30 seconds
  • The maximum number of data per request is 200