# オプションスクリーニング
get_option_screen(request)
説明
オプションスクリーニング。原資産属性(underlying)とオプション属性(option)を組み合わせてフィルタリングします。同一グループ内で原資産属性(underlying)とオプション属性(option)を同時にフィルタリングすることはできないため、SDK は必要に応じて自動的に新しいフィルタグループを開きます。デフォルトでは各フィルタ条件が AND で連結(新グループを開く)され、同じ indicator_type で
or_with_previous=Trueを明示的に指定した場合のみ前条件と OR(同一グループ)になります。パラメータ
パラメータ タイプ 説明 request OptionScreenRequest オプションスクリーニングリクエストオブジェクト、構築時に market_categories 必須 OptionScreenRequest フィールド:
フィールド タイプ 説明 market_categories list[int] オプション市場カテゴリリスト page_from int ページング開始位置 page_count int 1 ページあたりの最大返却件数 フィルタ条件 builder メソッド(デフォルトで呼び出すごとに新しいフィルタグループが自動的に開かれ、前条件と AND;同じ indicator_type かつ
or_with_previous=Trueの場合のみ前条件と OR で同一グループに追加。同一グループ内で原資産属性(underlying)とオプション属性(option)を同時にフィルタリングすることはできません):メソッド 説明 add_underlying_filter(indicator_type, values=None, lower=None, upper=None, plate_list=None, parent_plate_id=None, or_with_previous=False) 原資産属性フィルタ add_option_filter(indicator_type, values=None, lower=None, upper=None, or_with_previous=False) オプション属性フィルタ new_filter_group() 手動で新しいフィルタグループを開始 add_sort(indicator_type, desc=False) ソート add_option_retrieve(indicator_type) 追加で返すオプションフィールドを宣言 add_underlying_retrieve(indicator_type) 返す原資産フィールドを宣言
戻り値
パラメータ タイプ 説明 ret RET_CODE API 呼び出し結果 data tuple ret == RET_OK のとき、(last_page, all_count, DataFrame) を返す str ret != RET_OK のとき、エラー記述を返す 戻り値 DataFrame フィールド:
フィールド タイプ 説明 code str オプションコード option_name str オプション名称 strike_price float 権利行使価格 strike_date str 権利行使日 option_type int コール/プット exercise_type int 権利行使方式 expiration_type int 満期タイプ in_the_money bool イン・ザ・マネーか否か left_day int 残日数 price float オプション価格 mid_price float 仲値 bid_price float 買い気配値 ask_price float 売り気配値 bid_ask_spread float ビッド・アスクスプレッド bid_volume int 買い気配数量 ask_volume int 売り気配数量 bid_ask_volume_ratio float 買い/売り数量比 change_ratio float 変化率 volume int 出来高 turnover float 売買代金 open_interest int 未決済建玉数(建玉) open_interest_market_cap float 建玉時価総額 vol_oi_ratio float 出来高/建玉 premium float プレミアム implied_volatility float インプライド・ボラティリティ history_volatility float ヒストリカル・ボラティリティ iv_hv_ratio float IV/HV delta float ギリシャ文字 Delta gamma float ギリシャ文字 Gamma vega float ギリシャ文字 Vega theta float ギリシャ文字 Theta rho float ギリシャ文字 Rho leverage_ratio float レバレッジ比率 effective_gearing float 実効レバレッジ itm_probability float イン・ザ・マネー確率 buy_to_bep float 買いから損益分岐点までの比率 sell_to_bep float 売りから損益分岐点までの比率 buy_profit_probability float 買い利益確率 sell_profit_probability float 売り利益確率 intrinsic_value_per float 本質的価値割合 time_value_per float 時間的価値割合 itm_degree float イン・ザ・マネー度合い otm_degree float アウト・オブ・ザ・マネー度合い otm_probability float アウト・オブ・ザ・マネー確率 sell_annualized_return float 売り年率収益率 interval_return float 売り区間収益率 underlying dict 原資産情報(add_underlying_retrieve を呼び出した場合のみ返却)
Example
from moomoo import (
OpenQuoteContext, RET_OK, OptionScreenRequest,
OptMarketCategory, OptIndicator, OptUnderlyingIndicator,
)
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
# 例 1:米国株原資産 IV>30% + アット・ザ・マネー付近の CALL
req = OptionScreenRequest(market_categories=[OptMarketCategory.US_STOCK])
req.add_underlying_filter(OptUnderlyingIndicator.IV, lower=0.3) # 原資産 IV ≥ 30%(小数)
req.add_option_filter(OptIndicator.OPTION_TYPE, values=[1]) # CALL
req.add_option_filter(OptIndicator.DELTA, lower=0.3, upper=0.7) # Delta 0.3~0.7
req.add_option_filter(OptIndicator.LEFT_DAY, lower=7, upper=60) # 残り 7~60 日
req.add_sort(OptIndicator.VOLUME, desc=True) # 出来高降順
req.add_option_retrieve(OptIndicator.DELTA)
req.add_option_retrieve(OptIndicator.VOLUME)
req.page_count = 30
ret, data = quote_ctx.get_option_screen(req)
if ret == RET_OK:
last_page, all_count, df = data
print(df[['code', 'option_name', 'delta', 'volume']].head(10))
else:
print('error: ', data)
# 例 2:香港株で指定原資産のオプションをフィルタ + 原資産情報も取得
# 注:STOCK_LIST には証券コード文字列をそのまま渡す(例:"HK.00700"、"US.AAPL")
req = OptionScreenRequest(market_categories=[OptMarketCategory.HK_STOCK])
req.add_underlying_filter(OptUnderlyingIndicator.STOCK_LIST,
values=["HK.00700"]) # 原資産=テンセント
req.add_option_filter(OptIndicator.OPTION_TYPE, values=[1]) # CALL
req.add_option_filter(OptIndicator.OPTION_TYPE, values=[2],
or_with_previous=True) # 前条件と OR:CALL + PUT
req.add_underlying_retrieve(OptUnderlyingIndicator.IV)
req.add_underlying_retrieve(OptUnderlyingIndicator.MARKET_CAP)
req.add_sort(OptIndicator.OPEN_INTEREST, desc=True) # 建玉降順
req.page_count = 50
ret, data = quote_ctx.get_option_screen(req)
if ret == RET_OK:
last_page, all_count, df = data
print(df[['code', 'option_name', 'option_type', 'open_interest', 'underlying']].head(10))
else:
print('error: ', data)
quote_ctx.close()
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
# 例 1:
code option_name delta volume
0 US.GT260717C7000 GT 260717 7.00C 0.33809 38831
1 US.INTC260717C150000 INTC 260717 150.00C 0.30582 19548
2 US.MU260626C1050000 MU 260626 1050.00C 0.43334 18949
3 US.TSLA260710C400000 TSLA 260710 400.00C 0.58114 16002
4 US.CRWV260717C120000 CRWV 260717 120.00C 0.30415 15932
5 US.COMP260717C9000 COMP 260717 9.00C 0.47409 15645
6 US.SLV260717C65500 SLV 260717 65.50C 0.35809 13291
7 US.TSLA260710C410000 TSLA 260710 410.00C 0.50861 13010
8 US.SPCE260717C5000 SPCE 260717 5.00C 0.41268 12701
9 US.HOOD260717C100000 HOOD 260717 100.00C 0.41248 12572
# 例 2:
code option_name option_type open_interest underlying
0 HK.TCH260730C610000 腾讯 260730 610.00 购 1 70474 {'stock_id': 54047868453564, 'iv': 0.36337, 'h...
1 HK.TCH260629C500000 腾讯 260629 500.00 购 1 56334 {'stock_id': 54047868453564, 'iv': 0.36406, 'h...
2 HK.TCH260929C550000 腾讯 260929 550.00 购 1 46470 {'stock_id': 54047868453564, 'iv': 0.36406, 'h...
3 HK.TCH260730C520000 腾讯 260730 520.00 购 1 44071 {'stock_id': 54047868453564, 'iv': 0.36406, 'h...
4 HK.TCH260929C650000 腾讯 260929 650.00 购 1 38316 {'stock_id': 54047868453564, 'iv': 0.36406, 'h...
5 HK.TCH260629C530000 腾讯 260629 530.00 购 1 34532 {'stock_id': 54047868453564, 'iv': 0.36406, 'h...
6 HK.TCH260629C540000 腾讯 260629 540.00 购 1 34085 {'stock_id': 54047868453564, 'iv': 0.36406, 'h...
7 HK.TCH270330P230000 腾讯 270330 230.00 沽 2 30586 {'stock_id': 54047868453564, 'iv': 0.36337, 'h...
8 HK.TCH270330C230000 腾讯 270330 230.00 购 1 30000 {'stock_id': 54047868453564, 'iv': 0.36337, 'h...
9 HK.TCH260629C600000 腾讯 260629 600.00 购 1 27394 {'stock_id': 54047868453564, 'iv': 0.36406, 'h...
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
フィールド別例(カテゴリ別)
以下の例はすべて US_STOCK 市場を対象とします:まず
req = OptionScreenRequest(market_categories=[OptMarketCategory.US_STOCK])、 続けて各セクションのフィルタ / 取得 / ソート条件を重ね、最後にquote_ctx.get_option_screen(req)で(last_page, all_count, df)を取得します。 実測のheadは返却された DataFrame からそのまま取得し、原資産属性のサンプルにあるunderlying.<field>列はadd_underlying_retrieve(...)で展開されたものです。# 原資産属性 OptUnderlyingIndicator
add_underlying_filter(indicator_type, lower, upper, values, ...)で渡す。IV/HV/IV_RANK 等のパーセンテージ系指標は 小数で渡し(30% は 0.3)、underlyingdict に値を表示するにはadd_underlying_retrieve(...)が必要#
IV(id=203 · interval · OptUnderlyingIndicator) 原資産インプライドボラティリティ単位:% ;SDK は小数で直接渡す(30% は 0.3)。underlying dict に値を表示するには add_underlying_retrieve が必要
req.add_underlying_filter(OptUnderlyingIndicator.IV, lower=0.3) req.add_underlying_retrieve(OptUnderlyingIndicator.IV) req.add_sort(OptIndicator.VOLUME, desc=True)1
2
3実測返却(US_STOCK · all_count=1456207、ヒット 10 行、head 先頭 5):
code option_name volume underlying.iv US.NVDA260612C205000 NVDA 260612 205.00C 226041 0.45135 US.NVDA260612P200000 NVDA 260612 200.00P 184565 0.45135 US.NVDA260612C202500 NVDA 260612 202.50C 163991 0.45135 US.NVDA260612C210000 NVDA 260612 210.00C 147236 0.45135 US.NVDA260612C207500 NVDA 260612 207.50C 143944 0.451351
2
3
4
5
6#
HV(id=204 · interval · OptUnderlyingIndicator) 原資産ヒストリカルボラティリティ単位:% ;SDK は小数で直接渡す
req.add_underlying_filter(OptUnderlyingIndicator.HV, lower=0.3) req.add_underlying_retrieve(OptUnderlyingIndicator.HV) req.add_sort(OptIndicator.VOLUME, desc=True)1
2
3実測返却(US_STOCK · all_count=1336194、ヒット 10 行、head 先頭 5):
code option_name volume underlying.hv US.NVDA260612C205000 NVDA 260612 205.00C 226041 0.46845 US.NVDA260612P200000 NVDA 260612 200.00P 184565 0.46845 US.NVDA260612C202500 NVDA 260612 202.50C 163991 0.46845 US.NVDA260612C210000 NVDA 260612 210.00C 147236 0.46845 US.NVDA260612C207500 NVDA 260612 207.50C 143944 0.468451
2
3
4
5
6#
IV_RANK(id=205 · interval · OptUnderlyingIndicator) 原資産 IV ランク0~100;現在の IV が過去レンジ内に占める相対位置
req.add_underlying_filter(OptUnderlyingIndicator.IV_RANK, lower=50.0) req.add_underlying_retrieve(OptUnderlyingIndicator.IV_RANK) req.add_sort(OptIndicator.VOLUME, desc=True)1
2
3実測返却(US_STOCK · all_count=0、ヒット 0 行):データなし。理由:OpenD サンプリングにデータなし。lower 閾値を下げて再試行可
#
MARKET_CAP(id=401 · interval · OptUnderlyingIndicator) 原資産時価総額単位:通貨建て;SDK は元の値を直接渡す(百億は 10_000_000_000 と書く)
req.add_underlying_filter(OptUnderlyingIndicator.MARKET_CAP, lower=100_000_000_000.0) req.add_underlying_retrieve(OptUnderlyingIndicator.MARKET_CAP) req.add_sort(OptIndicator.VOLUME, desc=True)1
2
3実測返却(US_STOCK · all_count=357921、ヒット 10 行、head 先頭 5):
code option_name volume underlying.market_cap US.NVDA260612C205000 NVDA 260612 205.00C 226041 4957854000000.0 US.NVDA260612P200000 NVDA 260612 200.00P 184565 4957854000000.0 US.NVDA260612C202500 NVDA 260612 202.50C 163991 4957854000000.0 US.NVDA260612C210000 NVDA 260612 210.00C 147236 4957854000000.0 US.NVDA260612C207500 NVDA 260612 207.50C 143944 4957854000000.01
2
3
4
5
6#
STOCK_PRICE(id=402 · interval · OptUnderlyingIndicator) 原資産価格単位:通貨建て;SDK は元の価格をそのまま渡す
req.add_underlying_filter(OptUnderlyingIndicator.STOCK_PRICE, lower=50.0, upper=500.0) req.add_underlying_retrieve(OptUnderlyingIndicator.STOCK_PRICE) req.add_sort(OptIndicator.VOLUME, desc=True)1
2
3実測返却(US_STOCK · all_count=1055665、ヒット 10 行、head 先頭 5):
code option_name volume underlying.price US.NVDA260612C205000 NVDA 260612 205.00C 226041 204.87 US.NVDA260612P200000 NVDA 260612 200.00P 184565 204.87 US.NVDA260612C202500 NVDA 260612 202.50C 163991 204.87 US.NVDA260612C210000 NVDA 260612 210.00C 147236 204.87 US.NVDA260612C207500 NVDA 260612 207.50C 143944 204.871
2
3
4
5
6# オプション属性 OptIndicator
add_option_filter(indicator_type, lower, upper, values, ...)で渡す。Greeks(DELTA/GAMMA/THETA/VEGA/RHO)および各種確率(ITM_PROBABILITY 等)は 0~1 の小数 で渡す#
STRIKE_PRICE(id=1001 · interval · OptIndicator) 権利行使価格単位:通貨建て;SDK は元の価格をそのまま渡す
req.add_option_filter(OptIndicator.STRIKE_PRICE, lower=50.0, upper=100.0) req.add_sort(OptIndicator.VOLUME, desc=True)1
2実測返却(US_STOCK · all_count=400354、ヒット 10 行、head 先頭 5):
code option_name strike_price volume US.HYG260717P75000 HYG 260717 75.00P 75.0 72679 US.BAC260618C55000 BAC 260618 55.00C 55.0 55636 US.TQQQ260612P72000 TQQQ 260612 72.00P 72.0 43326 US.IEF260618C95000 IEF 260618 95.00C 95.0 42077 US.HYG260918P75000 HYG 260918 75.00P 75.0 420121
2
3
4
5
6#
LEFT_DAY(id=1002 · interval · OptIndicator) 残存日数単位:日;整数。近月は通常 < 30
req.add_option_filter(OptIndicator.LEFT_DAY, lower=7, upper=60) req.add_sort(OptIndicator.VOLUME, desc=True)1
2実測返却(US_STOCK · all_count=553649、ヒット 10 行、head 先頭 5):
code option_name left_day volume US.HYG260717P75000 HYG 260717 75.00P 35 72679 US.POET260717P17000 POET 260717 17.00P 35 60754 US.HYG260717P78000 HYG 260717 78.00P 35 40594 US.HYG260717P79000 HYG 260717 79.00P 35 34919 US.IEF260717P93000 IEF 260717 93.00P 35 348071
2
3
4
5
6#
OPTION_TYPE(id=1003 · values · OptIndicator) コール/プット区分列挙値:1=CALL、2=PUT;values に列挙値の配列を渡す
req.add_option_filter(OptIndicator.OPTION_TYPE, values=[1]) # CALL req.add_sort(OptIndicator.VOLUME, desc=True)1
2実測返却(US_STOCK · all_count=972181、ヒット 10 行、head 先頭 5):
code option_name option_type volume US.NVDA260612C205000 NVDA 260612 205.00C 1 226041 US.NVDA260612C202500 NVDA 260612 202.50C 1 163991 US.NVDA260612C210000 NVDA 260612 210.00C 1 147236 US.NVDA260612C207500 NVDA 260612 207.50C 1 143944 US.SPY260612C740000 SPY 260612 740.00C 1 1149061
2
3
4
5
6#
IN_THE_MONEY(id=2001 · values · OptIndicator) インザマネーかどうか列挙値:1=ITM、0=OTM
req.add_option_filter(OptIndicator.IN_THE_MONEY, values=[1]) # 仅价内 req.add_sort(OptIndicator.VOLUME, desc=True)1
2実測返却(US_STOCK · all_count=972389、ヒット 10 行、head 先頭 5):
code option_name in_the_money volume US.NVDA260612C202500 NVDA 260612 202.50C 1 163991 US.AAPL260612C295000 AAPL 260612 295.00C 1 87879 US.SPY260612C735000 SPY 260612 735.00C 1 77126 US.TSLA260612C390000 TSLA 260612 390.00C 1 70408 US.SPY260612C730000 SPY 260612 730.00C 1 628811
2
3
4
5
6#
PRICE(id=2002 · interval · OptIndicator) オプション価格単位:通貨建て;SDK は元の価格をそのまま渡す
req.add_option_filter(OptIndicator.PRICE, lower=1.0, upper=10.0) req.add_sort(OptIndicator.VOLUME, desc=True)1
2実測返却(US_STOCK · all_count=644732、ヒット 10 行、head 先頭 5):
code option_name price volume US.NVDA260612C205000 NVDA 260612 205.00C 2.0 226041 US.NVDA260612C202500 NVDA 260612 202.50C 3.55 163991 US.NVDA260612C207500 NVDA 260612 207.50C 1.04 143944 US.SPY260612C740000 SPY 260612 740.00C 2.97 114906 US.TSLA260612C400000 TSLA 260612 400.00C 6.45 937561
2
3
4
5
6#
VOLUME(id=2011 · interval · OptIndicator) 出来高単位:枚
req.add_option_filter(OptIndicator.VOLUME, lower=1000) req.add_sort(OptIndicator.VOLUME, desc=True)1
2実測返却(US_STOCK · all_count=8010、ヒット 10 行、head 先頭 5):
code option_name volume US.NVDA260612C205000 NVDA 260612 205.00C 226041 US.NVDA260612P200000 NVDA 260612 200.00P 184565 US.NVDA260612C202500 NVDA 260612 202.50C 163991 US.NVDA260612C210000 NVDA 260612 210.00C 147236 US.NVDA260612C207500 NVDA 260612 207.50C 1439441
2
3
4
5
6#
OPEN_INTEREST(id=2013 · interval · OptIndicator) 未決済建玉数単位:枚
req.add_option_filter(OptIndicator.OPEN_INTEREST, lower=1000) req.add_sort(OptIndicator.OPEN_INTEREST, desc=True)1
2実測返却(US_STOCK · all_count=92911、ヒット 10 行、head 先頭 5):
code option_name open_interest US.HYG260618P79000 HYG 260618 79.00P 451310 US.BKLN260717P20000 BKLN 260717 20.00P 406177 US.HYG261120C81000 HYG 261120 81.00C 386200 US.HYG260618P77000 HYG 260618 77.00P 332022 US.HYG260618P75000 HYG 260618 75.00P 3240961
2
3
4
5
6#
IMPLIED_VOLATILITY(id=3001 · interval · OptIndicator) インプライドボラティリティ単位:% ;SDK は小数で直接渡す(50% は 0.5)
req.add_option_filter(OptIndicator.IMPLIED_VOLATILITY, lower=0.3) req.add_sort(OptIndicator.VOLUME, desc=True)1
2実測返却(US_STOCK · all_count=1480382、ヒット 10 行、head 先頭 5):
code option_name implied_volatility volume US.NVDA260612C205000 NVDA 260612 205.00C 0.70232 226041 US.NVDA260612P200000 NVDA 260612 200.00P 0.77927 184565 US.NVDA260612C202500 NVDA 260612 202.50C 0.72661 163991 US.NVDA260612C210000 NVDA 260612 210.00C 0.76536 147236 US.NVDA260612C207500 NVDA 260612 207.50C 0.72576 1439441
2
3
4
5
6#
DELTA(id=3004 · interval · OptIndicator) Greeks DeltaCALL∈[0,1]、PUT∈[-1,0];SDK は小数で直接渡す
req.add_option_filter(OptIndicator.DELTA, lower=0.3, upper=0.7) req.add_sort(OptIndicator.VOLUME, desc=True)1
2実測返却(US_STOCK · all_count=219233、ヒット 10 行、head 先頭 5):
code option_name delta volume US.NVDA260612C205000 NVDA 260612 205.00C 0.49538 226041 US.NVDA260612C202500 NVDA 260612 202.50C 0.68114 163991 US.NVDA260612C207500 NVDA 260612 207.50C 0.31335 143944 US.SPY260612C740000 SPY 260612 740.00C 0.45037 114906 US.TSLA260612C400000 TSLA 260612 400.00C 0.48887 937561
2
3
4
5
6#
GAMMA(id=3005 · interval · OptIndicator) Greeks Gamma≥0;SDK は小数で直接渡す
req.add_option_filter(OptIndicator.GAMMA, lower=0.01) req.add_sort(OptIndicator.VOLUME, desc=True)1
2実測返却(US_STOCK · all_count=810281、ヒット 10 行、head 先頭 5):
code option_name gamma volume US.NVDA260612C205000 NVDA 260612 205.00C 0.07901 226041 US.NVDA260612P200000 NVDA 260612 200.00P 0.0477 184565 US.NVDA260612C202500 NVDA 260612 202.50C 0.06835 163991 US.NVDA260612C210000 NVDA 260612 210.00C 0.0481 147236 US.NVDA260612C207500 NVDA 260612 207.50C 0.06793 1439441
2
3
4
5
6#
THETA(id=3007 · interval · OptIndicator) Greeks Theta通常 ≤0(タイムディケイ)、SDK は小数で直接渡す
req.add_option_filter(OptIndicator.THETA, upper=-0.01) req.add_sort(OptIndicator.VOLUME, desc=True)1
2実測返却(US_STOCK · all_count=1238755、ヒット 10 行、head 先頭 5):
code option_name theta volume US.NVDA260612C205000 NVDA 260612 205.00C -2.30979 226041 US.NVDA260612P200000 NVDA 260612 200.00P -1.67055 184565 US.NVDA260612C202500 NVDA 260612 202.50C -2.13163 163991 US.NVDA260612C210000 NVDA 260612 210.00C -1.62903 147236 US.NVDA260612C207500 NVDA 260612 207.50C -2.10361 1439441
2
3
4
5
6#
ITM_PROBABILITY(id=3019 · interval · OptIndicator) ITM 確率0~1 の小数;SDK はそのまま渡す
req.add_option_filter(OptIndicator.ITM_PROBABILITY, lower=0.3, upper=0.7) req.add_sort(OptIndicator.VOLUME, desc=True)1
2実測返却(US_STOCK · all_count=417899、ヒット 10 行、head 先頭 5):
code option_name itm_probability volume US.NVDA260612C205000 NVDA 260612 205.00C 0.48389 226041 US.SPY260612C740000 SPY 260612 740.00C 0.36646 114906 US.TSLA260612C400000 TSLA 260612 400.00C 0.46733 93756 US.AAPL260612C295000 AAPL 260612 295.00C 0.57372 87879 US.SPY260612C735000 SPY 260612 735.00C 0.66411 771261
2
3
4
5
6
APIレート制限
- 30秒以内にオプションスクリーニング API を最大10回までリクエスト可能です