1

我需要从交互式经纪人中提取特定底层证券的所有选项。例如,我需要所有到期日在未来 3 个月内的期权作为ADS底层证券。我正在使用ib_insync包装器来提取必要的信息,例如bidandask等。它运行良好,但我需要可用选项的列表。

因此,我需要类似的东西(即下面的伪代码):

contracts = []
for underlying in ["ADS", "VOW"]:
   tmp = **give me a list of all options (i.e., strikes, expiration date) for *underlying***
   contracts.append(tmp)
   

感谢任何帮助!

4

1 回答 1

0

自己搜索答案时遇到了这个问题。我在这里ib_insync的文档中找到了答案。

spx = Index('SPX', 'CBOE')
chains = ib.reqSecDefOptParams(spx.symbol, '', spx.secType, spx.conId)
于 2021-09-25T00:13:53.660 回答