Apparently, when the same option contract is accessed in different backtests, there is a mismatch in contract characteristics. In this particular example, GLD contract 111217P00165000 at 2011-09-21 15:35:00 shows zero and non-zero open interest.
Here is a backtest that seems to return a reasonable non-zero value of OI while following a chosel option contract intraday:
2011-09-21 15:35:00 GLD 111217P00165000,Bid=5.2000 Ask=5.4000 Last=5.1500 OI=13914; Underlying=173.5900
Pavel Paramonov
Now a different backtest that logs multiple contracts at a specified date/time, but showz zero OI for the contract in question:
2011-09-21 15:35:00 GLD 111217P00165000,Bid=5.2000 Ask=5.4000 Last=5.1500 OI=0 σ=0.000 NPV=0.000 Δ=0.000 Γ=0.000 ν=0.000 Ï=0.00 Θ=0.00 IV=0.276
Pavel Paramonov
On a separate note: while option greeks calculation is expected to be enabled as in Github examples,
var option = AddOption(UnderlyingTicker); option.EnableGreekApproximation = true;
why are all greeks zero in every option contract instance of the last example?
Alexandre Catarino
Pavel Paramonov, sorry for taking too long to answer.
We have been looking into the issue to determine the cause. Since you were using two different filters, we had to check whether they were producing the same universe and how the differences would result on the bug you found.
The bug has been pinned down and we will be working on it. I will keep you updated.
Alexandre Catarino
Pavel Paramonov, the zero open interest issue has been fixed by patch #1002.
Pavel Paramonov
The Open Interest issue seems to be fixed, indeed.
Alexandre Catarino how about the Greeks? They still come out as zero. There was apparently an API change for EnableGreekApproximation. Would it be possible to update the github example here ? Thanks!
Alexandre Catarino
Greeks come out as zero, because the default volatility model needs two days of data to start to return non-zero volatilily. Please add the following line in Initialize:
SetWarmup(TimeSpan.FromDays(2)); // if StartDate is Monday, add more days
We are going to look into that example. If we add the warmup period, we need to include more data as well.
Pavel Paramonov
Thank you Alexandre Catarino the Greeks come out fine after the warm-up period.
Still, since there were recent changes with `EnableGreekApproximation`, how could I, for example, turn off IV/Greeks calculations to speed up a backtest sorting through a wide-range option chain?
Jared Broad
instead of a wider filter. This will make it 10-15x faster
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.
Pavel Paramonov
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!