Hi,
I'm trying to implement a strategy that buys a protective put with a strike price 30% below the current market price of the underlying with a 3 month expiracy at the start of each month. I have some doubts:
First, I read the options strategies and in all of them I saw the SetFilter() function at Initialize method. I understand the min/maxStrike is the min/max strike rank relative to mkt price, but its not clear to me how to get options with a strike 30% below the current mkt price. In my code you can see my current aproach.
Also, I'm getting this error:
Runtime Error: cannot instantiate an open generic type
at OptionReebalance
chain = DataDictionary().OptionChains.get(self.symbol)
at Python.Runtime.PythonException.ThrowLastAsClrException() at D:\QuantConnect\MyLean\PythonnetEnterprise\src\runtime\PythonException.cs:line 52
at Python.Runtime.PyObject.Invoke(PyObject[] args) at D:\QuantConnect\MyLean\PythonnetEnterprise\src\runtime\PythonTypes\PyObject.cs:line 787
at QuantConnect.Scheduling.ScheduleManager.c__DisplayClass15_0.b__0(String name in main.py: line 71
I'm pretty sure it has to do with the schedule event but I'm not sure about why is this error happening.
Any help is appreciated.
I don't really know a lot about options trading but I've read all QC option related documentation.
Thanks!
Renata
Here's the code
Ashutosh
Hi@renata
The error is in view that OptionsChains can be accessed via slice in the algorithm.
One was to pass slice object to OptionRebalance method is to update it through the OnData method.
As per your problem case to get put with a strike price 30% below the current market price you can use something like this:
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.
Renata
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!