# 異常取引アラート設定

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 moomoo 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回の異常取引アラート設定インターフェースリクエスト