Hello,
I thank you in advance for your input. I have an algo that assembles a matrix of puts and calls to determine the best collar to trade. As I assemble the matrix, I add each option contract and set its price model so I can query the Greeks in the next OnData() cycle as follows:
Adding option contract
tempOption = AddOptionContract(optSymbol);
tempOption.PriceModel = OptionPriceModels.BlackScholes();
callOptionsList.Add(tempOption);
Retrieving Greeks (Delta)
foreach (var newChain in data.OptionChains)
{
var testVol = Securities[newChain.Key.Underlying].VolatilityModel.Volatility;
Debug("At " + data.Time + ", Symbol, Bid, Ask, Last, Open Interest, Volatility, Theoretical Price, Delta, Implied Vol");
foreach (var thisContract in newChain.Value)
{
Debug("At " + data.Time + ", " + thisContract.Symbol.Value + ", " + thisContract.BidPrice + ", " + thisContract.AskPrice + ", " + thisContract.LastPrice + ", " +
thisContract.OpenInterest + ", "+ testVol + ", " + thisContract.TheoreticalPrice + ", " + thisContract.Greeks.Delta + ", " + thisContract.ImpliedVolatility);
}
}
Although values are logged for the prices, OpenInterest, and ImpliedVolatility, I get 0's for volatility, theoretical price and delta.
Am I missing something please?
Derek Melchin
Hi Craig,
Volatility, theoretical price and delta can be 0 when we don't properly warm-up the algorithm. Ensure
self.SetWarmUp(30, Resolution.Daily)
is in the Initialize method.
Additionally, there is a reported issue of the BlackScholes model producing 0 values for greeks. We can use the BinomialTian pricing model as a workaround for now.
See the attached backtest for reference.
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.
Derek Melchin
Hi Craig,
See the attached backtest for an example of how we can get non-zero values for these attributes when using AddOptionContract. Note that we need to set the underlying VolatilityModel in this case. When using AddOption, it's done under the hood.
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.
Derek Melchin
Hi Craig,
The algorithm needs to specify the volatility model of thisSymbol in the Initialize method. We can accomplish this with
Securities[thisSymbol].VolatilityModel = new StandardDeviationOfReturnsVolatilityModel(30);
See the attached backtest for reference.
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.
Derek Melchin
Hi Craig,
We've created a GitHub Issue to have this added to the documentation. Track our progress here.
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!