Options historical data, vertical spread code example

Dear community,
dear QC staff,
I would like to know if one may find an example of code for strategy vertical spread buy or sell.

I started myself as a python programer beginer according to the code in the research enviroment to downlad the options data but I am getting some sort of error message that has something to do with an oldrer version of python I guess. I cannot solve it myself. The code is below and so the error. Thanks for any feedback.





Python code

Historical Options Data Requests
  • Select the option data
  • Sets the filter, otherwise the default will be used SetFilter(-1, 1, timedelta(0), timedelta(35))
  • Get the OptionHistory, an object that has information about the historical options data

goog = qb.AddOption("GOOG")
goog.SetFilter(-2, 2, timedelta(0), timedelta(180))

option_history = qb.GetOptionHistory(goog.Symbol, datetime(2017, 1, 4))
print (option_history.GetStrikes())
print (option_history.GetExpiryDates())
h7 = option_history.GetAllData()



/opt/miniconda3/lib/python3.6/site-packages/ FutureWarning: Sorting because non-concatenation axis is not aligned. A future version
of pandas will change to not sort by default.

To accept the future behavior, pass 'sort=False'.

To retain the current behavior and silence the warning, pass 'sort=True'.

"""Entry point for launching an IPython kernel.
Update Backtest

Update Backtest


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.


This discussion is closed