# 篩選期權

get_option_screen(request)

  • 介紹

    期權選股,參數與返回字段同 nn 標籤頁。

  • Example

from moomoo import (
    OpenQuoteContext, RET_OK, OptionScreenRequest,
    OptMarketCategory, OptIndicator, OptUnderlyingIndicator,
)

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

req = OptionScreenRequest(market_categories=[OptMarketCategory.US_STOCK])
req.add_underlying_filter(OptUnderlyingIndicator.IV, lower=0.3)  # 30%(小數)
req.add_option_filter(OptIndicator.OPTION_TYPE, values=[1])
req.add_option_filter(OptIndicator.DELTA, lower=0.3, upper=0.7)
req.add_sort(OptIndicator.VOLUME, desc=True)
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)

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