简体   繁体   English

ib_insync,提取所有选项

[英]ib_insync, extraction of all options

I need to extract all options from interactive brokers for a particular underlying.我需要从交互式经纪人中提取特定底层证券的所有选项。 For example, I need all options with expiration date in the next 3 months for ADS underlying.例如,对于ADS标的,我需要所有到期日期在未来 3 个月内的期权。 I am using ib_insync wrapper to extract the necessary information like bid and ask , etc. It works well, but I need the list of available options.我正在使用ib_insync包装器来提取必要的信息,例如bidask等。它运作良好,但我需要可用选项的列表。

Thus, I need something like (ie, pseudo-code below):因此,我需要类似的东西(即下面的伪代码):

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

Appreciate any help!感谢任何帮助!

Came across this question when searching for the answer myself.自己搜索答案时遇到了这个问题。 I found the answer in the ib_insync documentation here .我在这里ib_insync文档中找到了答案。

spx = Index('SPX', 'CBOE')
chains = ib.reqSecDefOptParams(spx.symbol, '', spx.secType, spx.conId)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM