简体   繁体   中英

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. 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.

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 .

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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