# 設置異動提醒

set_option_event_alert(op, alert_list=None)

  • 介紹

    新增、修改、刪除或啟用/禁用期權異動提醒。

  • 參數

    參數 類型 說明
    op AlertOpType 操作類型
    alert_list OptionEventAlertItem 或 list[OptionEventAlertItem] 提醒條目
    • OptionEventAlertItem 各字段:

      字段 類型 說明
      key int 告警唯一標識(修改/刪除/啟用/禁用時必填)
      enable bool 告警開關
      option_market OptionMarket 監控的期權市場(三選一)
      watchlist_group_name str 自選股分組名稱(三選一)
      underlying str 指定標的代碼,如 'US.AAPL'(三選一)
      option_type OptionType 期權類型(CALL/PUT)
      side_type_list list[EventTickerType] 成交方向列表
      order_type_list list[AlertOrderType] 訂單類型列表
      market_cap_range_min float 標的市值下限
      market_cap_range_max float 標的市值上限
      market_cap_min_inclusive bool 標的市值下限是否閉區間(默認 True)
      market_cap_max_inclusive bool 標的市值上限是否閉區間(默認 True)
      expiry_days_range_min float 距到期天數下限
      expiry_days_range_max float 距到期天數上限
      expiry_days_min_inclusive bool 距到期天數下限是否閉區間(默認 True)
      expiry_days_max_inclusive bool 距到期天數上限是否閉區間(默認 True)
      price_range_min float 異動成交價下限
      price_range_max float 異動成交價上限
      price_min_inclusive bool 異動成交價下限是否閉區間(默認 True)
      price_max_inclusive bool 異動成交價上限是否閉區間(默認 True)
      size_range_min float 異動成交量下限(張)
      size_range_max float 異動成交量上限(張)
      size_min_inclusive bool 異動成交量下限是否閉區間(默認 True)
      size_max_inclusive bool 異動成交量上限是否閉區間(默認 True)
      premium_range_min float 異動成交額下限
      premium_range_max float 異動成交額上限
      premium_min_inclusive bool 異動成交額下限是否閉區間(默認 True)
      premium_max_inclusive bool 異動成交額上限是否閉區間(默認 True)
      iv_range_min float 隱含波動率下限(%)
      iv_range_max float 隱含波動率上限(%)
      iv_min_inclusive bool 隱含波動率下限是否閉區間(默認 True)
      iv_max_inclusive bool 隱含波動率上限是否閉區間(默認 True)
      earnings_date_begin str 財報時間篩選起始日期(yyyy-MM-dd)
      earnings_date_end str 財報時間篩選截止日期(yyyy-MM-dd)
      note str 備註(最多 20 字符)

    監控範圍option_marketwatchlist_group_nameunderlying 三者互斥,新增時需設置其中之一。

  • 返回

    參數 類型 說明
    ret RET_CODE 接口調用結果
    data str 當 ret == RET_OK,返回空字符串
    str 當 ret != RET_OK,返回錯誤描述
  • Example

from futu import *

quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)

# 新增一個提醒:監控美股股票期權市場的 CALL 掃單,成交量 > 100(開區間)
item = OptionEventAlertItem(
    option_market=OptionMarket.US_SECURITY,
    option_type=OptionType.CALL,
    order_type_list=[AlertOrderType.SWEEP],
    size_range_min=100,
    size_min_inclusive=False,
    note='test'
)
ret, data = quote_ctx.set_option_event_alert(AlertOpType.ADD, item)
if ret == RET_OK:
    print('新增成功')
else:
    print('error:', data)

quote_ctx.close()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  • Output
新增成功
1

接口限制

  • 30 秒內最多請求 60 次設置異動提醒接口