Does anyone know if the options chains are from 1 or from more than 1 exchange?
I've tried to iterate through an OptionChains IEnumerable variable, and I cannot tell if there's more than one contract at every right/strike/expiry point.
QUANTCONNECT COMMUNITY
Does anyone know if the options chains are from 1 or from more than 1 exchange?
I've tried to iterate through an OptionChains IEnumerable variable, and I cannot tell if there's more than one contract at every right/strike/expiry point.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Jared Broad
Our options data is the entire OPRA tick feed condensed into Minute bars. This covers all the exchanges.
We have a Buy and Hold Options Boot Camp lesson coming up soon. Hopefully, we'll get it published later this week. If you complete the rest of the Boot Camps options will become easier.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Craig McWilliams
Thank you Jared. I did complete 3 more Boot Camps this morning.
I look forward to the Buy and Hold Options Boot Camp. I'll keep an eye out.
I am building a collared strategy using dividend stocks. Eventually, I want to evaluate various put/call pairs at expirations that correlate to 2, 3, & 4 future dividends and strikes that are -3, -2, -1, 0, & +1 to the current underlying price. From all that I have read thus far, it is not a) apparent that an OptionsChain has only 1 memeber at a given <Right, Expriration, Strike> combination nor b) how to iterate through OptionsChains members to select a chain.
Can you tell me how many chains correspond to any given <Right, Expiration, Strike> combination?
Can you tell me how select unique combinations please?
Derek Melchin
Hi Craig,
It is correct that each OptionChain only has 1 member at a given <Right, Expiration, Strike> combination. See the attached backtest's log for reference.
To iterate through the OptionChains, we can write
for symbol, chain in slice.OptionChains.items(): chain # OptionChain
To determine how many chains correspond to a given Right, Expiration, Strike> combination, we can use the following snippet inside OnData:
self.combinations = pd.DataFrame() for symbol, chain in slice.OptionChains.items(): for contract in chain: row = pd.DataFrame({'symbol': [contract.Symbol], 'right': [contract.Right], 'expiry': [contract.Expiry], 'strike': [contract.Strike]}) self.combinations = self.combinations.append(row) # Calculate number of chains per combination chains_per_combo = pd.DataFrame() df = self.combinations for i, row in df.iterrows(): num_chains = df[(df.right == row.right) & (df.expiry == row.expiry) & (df.strike == row.strike)].shape[0] if chains_per_combo.shape[0] == 0 or \ chains_per_combo[(chains_per_combo.right == row.right) & (chains_per_combo.expiry == row.expiry) & (chains_per_combo.strike == row.strike)].shape[0] == 0: sub_row = pd.DataFrame({'chains':[num_chains], 'right': [row.right], 'expiry': [row.expiry], 'strike': [row.strike]}) chains_per_combo = chains_per_combo.append(sub_row)
To select a unique combination for a single symbol, just select a contract while looping through the chain as each symbol has unique <Right, Expiration, Strike> combinations.
for symbol, chain in slice.OptionChains.items(): for contract in chain: contract
See the attached backtest for a full example.
Best,
Derek Melchin
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Craig McWilliams
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!