# 筛选窝轮

get_warrant(stock_owner='', req=None)

  • 介绍

    筛选窝轮(仅用于筛选香港市场的窝轮、牛熊证、界内证)

  • 参数

    参数 类型 说明
    stock_owner str 所属正股的股票代码
    req WarrantRequest 筛选参数组合
    • WarrantRequest 类型字段说明如下:
      字段 类型 说明
      begin int 数据起始点
      num int 请求数据个数
      sort_field SortField 根据哪个字段排序
      ascend bool 排序方向
      type_list list 窝轮类型过滤列表
      issuer_list list 发行人过滤列表
      maturity_time_min str 到期日过滤范围的开始时间
      maturity_time_max str 到期日过滤范围的结束时间
      ipo_period IpoPeriod 上市时段
      price_type PriceType 价内/价外
      status WarrantStatus 窝轮状态
      cur_price_min float 最新价的过滤下限
      cur_price_max float 最新价的过滤上限
      strike_price_min float 行使价的过滤下限
      strike_price_max float 行使价的过滤上限
      street_min float 街货占比的过滤下限
      street_max float 街货占比的过滤上限
      conversion_min float 换股比率的过滤下限
      conversion_max float 换股比率的过滤上限
      vol_min int 成交量的过滤下限
      vol_max int 成交量的过滤上限
      premium_min float 溢价的过滤下限
      premium_max float 溢价的过滤上限
      leverage_ratio_min float 杠杆比率的过滤下限
      leverage_ratio_max float 杠杆比率的过滤上限
      delta_min float 对冲值的过滤下限
      delta_max float 对冲值的过滤上限
      implied_min float 引伸波幅的过滤下限
      implied_max float 引伸波幅的过滤上限
      recovery_price_min float 收回价的过滤下限
      recovery_price_max float 收回价的过滤上限
      price_recovery_ratio_min float 正股距收回价的过滤下限
      price_recovery_ratio_max float 正股距收回价的过滤上限
  • 返回

    参数 类型 说明
    ret RET_CODE 接口调用结果
    data tuple 当 ret == RET_OK,返回窝轮数据
    str 当 ret != RET_OK,返回错误描述
    • 窝轮数据组成如下:

      字段 类型 说明
      warrant_data_list pd.DataFrame 筛选后的窝轮数据
      last_page bool 是否是最后一页
      all_count int 筛选结果中的窝轮总数量
      • warrant_data_list 返回的 pd dataframe 数据格式:
        字段 类型 说明
        stock str 窝轮代码
        stock_owner str 所属正股
        type WrtType 窝轮类型
        issuer Issuer 发行人
        maturity_time str 到期日
        list_time str 上市时间
        last_trade_time str 最后交易日
        recovery_price float 收回价
        conversion_ratio float 换股比率
        lot_size int 每手数量
        strike_price float 行使价
        last_close_price float 昨收价
        name str 名称
        cur_price float 当前价
        price_change_val float 涨跌额
        status WarrantStatus 窝轮状态
        bid_price float 买入价
        ask_price float 卖出价
        bid_vol int 买量
        ask_vol int 卖量
        volume int 成交量
        turnover float 成交额
        score float 综合评分
        premium float 溢价
        break_even_point float 打和点
        leverage float 杠杆比率
        ipop float 价内/价外
        price_recovery_ratio float 正股距收回价
        conversion_price float 换股价
        street_rate float 街货占比
        street_vol int 街货量
        amplitude float 振幅
        issue_size int 发行量
        high_price float 最高价
        low_price float 最低价
        implied_volatility float 引伸波幅
        delta float 对冲值
        effective_leverage float 有效杠杆
        upper_strike_price float 上限价
        lower_strike_price float 下限价
        inline_price_status PriceType 界内界外
  • 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:  # 先判断接口返回是否正常,再取数据
    warrant_data_list, last_page, all_count = ls
    print(len(warrant_data_list), all_count, warrant_data_list)
    print(warrant_data_list['stock'][0])    # 取第一条的窝轮代码
    print(warrant_data_list['stock'].values.tolist())   # 转为 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()  # 所有接口结尾加上这条 close,防止连接条数用尽
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  腾讯麦银零乙购A.C    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.198    2.008            598.28    62.393  -0.404                   NaN              9.40        4.400     1584000      0.000    36000000       0.000      0.000              31.751  0.479              29.886    1.561565e+09          1.606234e+09        1.606752e+09                 NaN                 NaN                  NaN
1   HK.16545  腾讯法兴一二购B.C    HK.00700  CALL     SG    2021-02-26  2020-07-14      2021-02-22             NaN             100.0     10000        700.00             0.147      0.144            -0.003    -2.040816  NORMAL      0.141      0.144  28000000  28000000           0          0.0  81.506   21.807            714.40    40.729 -16.214                   NaN             14.40        1.420     2130000      0.000   150000000       0.000      0.000              40.643  0.226               9.204    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  平安瑞银零乙购A.C    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.641    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  平安中银零乙购A.C    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.174  0.672              11.699    1.513613e+09          1.608739e+09        1.609344e+09                 NaN                 NaN                 NaN
......
198  HK.56886  恒指瑞银三一牛F.C   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.627   -2.884         25740.000     5.712   25.613             25.021179          4640.000         0.01       40000        0.0   400000000         0.0        0.0                 NaN    NaN               5.712    1.584979e+09          1.674749e+09        1.675008e+09                 NaN                 NaN                 NaN
199  HK.56895  小米瑞银零乙牛D.C    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    0.938            26.900     1.380  250.657            233.125000            19.300         0.10       60000        0.0    60000000         0.0        0.0                 NaN    NaN               1.380    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