Hi all
If anyone has an answer to the following I'd be ever so grateful
When I make calls to option history (ie calls to option_hx = qb.GetOptionHistory(…) ), sometimes I get an incomplete dataframe back without ‘strike’, ‘expiry’, or ‘type’ levels for the indexes of the multiindex dataframe; there are only ‘symbol’ and ‘time’ levels. Hence the calls to option_hx.GetStrikes() and option_hx.GetExpiryDates() return empty lists. The option_hx.GetAllData() call does return a dataframe, but its only indexed with ‘symbol’ and ‘time’.
I am doing research looking only at premiums of options at particular strikes and expiration dates, so need to be able to access this. Any suggestions or help for a workaround?
thanks in advance
-a
Louis Szeto
Hi Anthony
Can you please provide an example of
for further assistance?
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.
Anthony Harris
Code snippet below:
opt1 = qb.AddOption('ARNA', Resolution.Daily)
opt1.SetFilter(-1, 1,timedelta(0),timedelta(180))
opt1hx = qb.GetOptionHistory(opt1.Symbol, 2020-07-16 00:00:00, 2020-07-16 00:00:00 + timedelta(days=1))
opt1data = opt1hx.GetAllData()
so for this example, for strikes = opt1hx.GetStrikes(), returns ONLY strikes = [75.0,65.0], regardless if I set the first 2 arguments in SetFilter higher (e.g. -10,10).
I want essentially only the straddle price data for a specific date. That is, I just want to the premium for the call/put straddle at a specific time. So when I look at opt1data, (after calls to GetStrikes(), GetExpiryDates() ), if I try to filter by expiry date, type, and strike (with repeated calls to opt1data[opt1data.index.get_level_values(X) == Y], where (X = expiry, strike, or type, and Y is the value I want to filter for), the resulting dataframe is empty.
Alexandre Catarino
Hi Anthony,
Thank you for your patience.
I couldn't reproduce the issue:
I think that it might have been a temporary data issue when you made the history requests that has been solved by the Data Team.
Best regards,
Alex
Anthony Harris
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!