Back

Options Historical Data

Hello 

I'm new to QC and was playing around with the notebook example. Could someone help me with the following questions please -

 

 a) Noticed that historical options data is not available for recent business days. To illustrate, last available date (as of today) for AMZN is Nov 27, 2018. Is there a way to pull more recent history?

amzn = qb.AddOption("AMZN")

amzn.SetFilter(-2, 2, timedelta(0), timedelta(180))

option_history = qb.GetOptionHistory(amzn.Symbol, datetime(2018, 11, 27))
print (option_history.GetStrikes())
print (option_history.GetExpiryDates())
h7 = option_history.GetAllData()

b) How do I use option_history object to query specific expiry days?

 

Many Thanks!

Update Backtest







0

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.


re 1: Historical options data is not currently up to date (Nov 29 was the latest as I write this) but QC are currently working on installing new infrastructure to speed up the update of this data. I've been waiting patiently for this - hopefully will be in place soon. You can check the data status by using the data explorer.
re 2: I don't think it's possible to query specific expiry days. You can only get a specific lookback period of data and then process each date as needed.

0

Hi all,

To answer your questions:

1) We're still working on updating our options data right now, so data is only available up until Nov 30, 2018. Once it is, then you can pull any of the available data using the methods outlined in the documentation here.

2) Currently, it isn't possible to specify an expiry date as an argument in GetOptionHistory, but you can filter the Pandas DataFrame that it returns to find the options with the expiry date you want to filter for. Working with the code from the original post, a way to filter the historical data would be

## Print out the unique expiry dates
print(h7.index.get_level_values('expiry').unique())

## Once updated data is available, you could use a boolean accessor to find
## the options with expiry 2019-1-18 and assign them to a new DataFrame 'df'
boolean = h7.index.get_level_values('expiry') == datetime(2019,1,18)
df = h7.loc[boolean]

We are working on a more direct way to accomplish this and hope to have a solution soon.

0

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.


Thanks for sharing your thoughts and code snippets. Do we know if weeklies are going to be added soon? 

0

Hi QuantExplorer:

Weeklys are available. You can use IncludeWeeklys to get weekly contracts in addition to the default monthly contracts or use WeeklysOnly to get weekly contracts only. Please check out this example!

Thanks for your support!

0

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.


Update Backtest





0

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.


Loading...

This discussion is closed