Hello, I am creating my first options trading algorithm and I need to use Greeks as a part of the selection. I have found on the forums that apparently you need the "CrankNicolsonFD" Pricing Model in order to use greeks. Here is the code in the Initialize Method:
option = self.AddOption("SPX", Resolution.Minute)
option.PriceModel = OptionPriceModels.CrankNicolsonFD()
option.SetFilter(-2, +2, TimeSpan.FromDays(30), TimeSpan.FromDays(60))
self.SetWarmUp(60, Resolution.Daily)
However when I backtest, I get an error that "OptionPriceModels" is not defined. This is strange because every options algo has this very line of code but I can't get it to work and there seem to be no other threads of people having the same problem.
So my question is how do I fix this? And also it would be helpful if I could get some confirmation that I indeed need this pricing model in order to use Greeks.
.ekz.
Sorry you're facing this issue.Â
I'm just getting started on QC so I can't quite guide you, but I did want to point out a potential issue in your code: there is no SPX data available on platform so you won't be able to test your strategy.Â
The QC team is working on a path forward, but till then, consider switching to SPY, so you can at least validate your strategy logic.
Â
Â
Ethan Wertlieb
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!