# 篩選窩輪

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

介面限制

  • 港股 BMP 權限不支援呼叫此介面
  • 每 30 秒內最多請求 60 次篩選窩輪介面
  • 每次請求的數據個數上限為 200 個