# ワラントスクリーニング V2
get_warrant_screen(request)
説明
ワラントスクリーニング V2。旧 API get_warrant と比較して、43 列のワラント属性を返却し、香港 / シンガポール / マレーシア市場をサポートします。総数のみ返却(only_count)にも対応。すべての数値フィールドは原始値を直接渡し、OpenD 内部で倍率変換を行います。
パラメータ
パラメータ タイプ 説明 request WarrantScreenRequest ワラントスクリーニングリクエストオブジェクト、構築時に warrant_market 必須 WarrantScreenRequest フィールド:
フィールド タイプ 説明 warrant_market WarrantMarket 市場 is_delay bool 遅延相場を使用するか only_count bool 総数のみ返却するか(明細を返さない) page_from int ページング開始位置 page_count int 1 ページあたりの最大返却件数 フィルタ条件 builder メソッド(呼び出すごとにフィルタ条件を 1 件追加):
メソッド 説明 add_interval_filter(field_id, min_val=None, max_val=None, min_included=True, max_included=True) 区間フィルタ add_choice_filter(field_id, choices) 選択肢フィルタ add_sort(field_id, desc=False) ソート よく使う WarrantField field_id(完全なリストは WarrantField を参照):
field_id 意味 フィルタ方式 4 ISSUER_ID 発行体 ID choice 5 STOCK_OWNER 原株 choice 6 WARRANT_TYPE ワラントタイプ choice 8 CURRENT_PRICE 現在値 interval 9 STREET_RATIO ストリート比率 interval 10 VOLUME 出来高 interval 16 LEVERAGE_RATIO レバレッジ比率 interval 19 STATUS ステータス choice 23 EFFECTIVE_LEVERAGE 実効レバレッジ interval
戻り値
パラメータ タイプ 説明 ret RET_CODE API 呼び出し結果 data tuple ret == RET_OK のとき、(last_page, all_count, DataFrame) を返す str ret != RET_OK のとき、エラー記述を返す 戻り値 DataFrame フィールド(計 43 列):
フィールド タイプ 説明 stock_id int ワラント銘柄 ID stock_owner int 所属原株 ID issuer_id int 発行体 ID warrant_type int ワラントタイプ strike_price float 権利行使価格 maturity_date str 満期日 last_trade_date str 最終取引日 conversion_ratio float 転換比率 last_close_price float 前日終値 recovery_price float コールバック価格(ブル/ベア証のみ) stock_owner_price float 原株価格 current_price float 現在値 volume int 出来高 turnover float 売買代金 sell_vol int 売り数量 buy_vol int 買い数量 sell_price float 売り気配値 buy_price float 買い気配値 street_rate float ストリート比率 high_price float 高値 low_price float 安値 implied_volatility float インプライド・ボラティリティ(コール/プットのみ) delta float ヘッジ値(コール/プットのみ) status int ワラントステータス street_rate_new float ストリート比率(新) score float 総合スコア premium float プレミアム leverage float レバレッジ effective_leverage float 実効レバレッジ break_even_point float 損益分岐点 ipop float イン・ザ・マネー/アウト・オブ・ザ・マネー amplitude float 振幅 fx_score float ソシエテ・ジェネラルスコア ipo_time str 上場日時 street_vol int ストリート出来高 lot_size int 単元株数 issue_size int 発行量 ipo_price float 発行価格 upper_strike_price float 上限価格(インライン証のみ) lower_strike_price float 下限価格(インライン証のみ) iw_price_status int インライン/アウトオブライン sensitivity float 感応度 price_recovery_ratio float 原株からコールバック価格までの距離(ブル/ベア証のみ)
Example
from moomoo import (
OpenQuoteContext, RET_OK, WarrantScreenRequest,
WarrantMarket, WarrantField, WarrantType,
)
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
# 例 1:香港株の低価格・高レバレッジコール / プット
req = WarrantScreenRequest(warrant_market=WarrantMarket.HK)
req.add_choice_filter(field_id=WarrantField.WARRANT_TYPE,
choices=[WarrantType.CALL, WarrantType.PUT]) # コール + プット
req.add_interval_filter(field_id=WarrantField.CURRENT_PRICE,
min_val=0.1, max_val=5.0) # 現在値 0.1~5
req.add_interval_filter(field_id=WarrantField.EFFECTIVE_LEVERAGE,
min_val=3.0) # 実効レバレッジ > 3
req.add_interval_filter(field_id=WarrantField.STREET_RATIO, max_val=50.0) # ストリート比率 < 50%
req.add_sort(field_id=WarrantField.VOLUME, desc=True) # 出来高降順
req.page_count = 20
ret, data = quote_ctx.get_warrant_screen(req)
if ret == RET_OK:
last_page, all_count, df = data
print(df[['stock_id', 'warrant_type', 'current_price', 'effective_leverage']].head())
else:
print('error: ', data)
# 例 2:条件を満たす総数のみを取得
req = WarrantScreenRequest(warrant_market=WarrantMarket.HK)
req.only_count = True
req.add_choice_filter(field_id=WarrantField.WARRANT_TYPE, choices=[WarrantType.CALL])
req.add_interval_filter(field_id=WarrantField.CURRENT_PRICE, min_val=1.0)
ret, data = quote_ctx.get_warrant_screen(req)
if ret == RET_OK:
_, all_count, _ = data
print(f"条件を満たすコールの総数:{all_count}")
# 例 3:原株コードでフィルタ(choice に code 文字列を直接渡す)
req = WarrantScreenRequest(warrant_market=WarrantMarket.HK)
req.add_choice_filter(field_id=WarrantField.STOCK_OWNER, choices=["HK.00700"])
req.add_choice_filter(field_id=WarrantField.WARRANT_TYPE,
choices=[WarrantType.BULL, WarrantType.BEAR]) # ブル証 + ベア証
req.add_sort(field_id=WarrantField.TURNOVER, desc=True)
req.page_count = 50
ret, data = quote_ctx.get_warrant_screen(req)
quote_ctx.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
- Output
stock_id warrant_type current_price effective_leverage
0 87930865475960 1 0.107 4.337
1 87939455410698 1 0.108 4.307
2 88231513189723 1 0.120 4.996
3 87969520182112 1 0.110 3.604
4 88356067241952 1 0.127 6.827
条件を満たすコールの総数:98
1
2
3
4
5
6
7
2
3
4
5
6
7
APIレート制限
- 30秒以内にワラントスクリーニング API を最大60回までリクエスト可能です