I am trying to get a basic framework to trade SPX options going.
I am stuck on the first step…if never produces and OptionChain in
public override void OnData(Slice slice){
foreach (var optionChain in slice.OptionChains)
The program just spins for awhile (10+ minutes), when it finally enters OnData, the slice.OptionChains is always empty.
This seems to be how the examples and documentation are laid out, so I'm sure I'm just doing something simple wrong.
Thank you for any insight.
Greg
Varad Kabade
Hi Greg
We recommend using the following :
for accessing the option chains and the contracts in each chain. In the following backtest we can see that the algorithm has data.
Best,Varad Kabade
Greg Smythe
Varad, Thank you for the great example, it is very helpful.
I cloned this and attempting to step through your sample using breakpoints.
I set a breakpoint on each of the foreach in:
foreach (var chain in slice.OptionChains.Values)
{
foreach (var contract in chain.Contracts.Values)
And the breakpoint is never reached, but if I set a breakpoint anywhere in initialization it breaks as expected.
The algorithm never progresses, but the breakpoint is never hit.
If I remove the breakpoints, the algorithm progresses as expected. I even upgraded to a b8-16 node in case there just wasn't enough horsepower.
Any suggestions? I using Windows 10 and have tried with Chrome and Edge browsers. Internet connection is symmetric gig fiber.
Thank you, I'm fairly new to QC and still trying to put all this together.
Greg
Louis Szeto
Hi Gerg
It is because the EMA indicators are not warmed-up-ready. Please add the following line in the Initialize method:
We also recommend you filter the options for a faster backtest.
Best
Louis
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.
Greg Smythe
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!