This algo has 2 additional functions to OnData function that are strike_selection, which select call and put options to trade, and the find_support function to get limit order price based on the nearest sma.
The issues with this algo that I need to fix are the following:
1- Sometimes the algo doesn't buy options in certain dates. This algo is designed to buy SPY when VIX is high and at the same time, sell call and put options for each SPY purchase.
There are certain dates such as 10/10/2018 that algo buy SPY but doesn't buy options. Why can this happen?
2- Second issue is that the algo run to slow. Do you know what can be the cause of this??
I really appreciate the support.
Regards,
Nicolás
Douglas Stridsberg
Regarding speed - how many data points per second are you processing? This is shown at the end of an algorithm executing.
I suspect the cause of a low speed is a) the complexity of your algorithm and b) the fact that you're using minute-level data.
Halldor Andersen
Hi Nicolas.
On the 10/10/2018 the VIX level is 15.95, which is below the value of 18, your threshold criteria, so the code within your first if statement in the method OnData() does not execute your option contract selection function, strike_selection().
You can increase the speed of the backtest by selecting fewer options using the method SetFilter().
For an example, instead of
option.SetFilter(-30, +30, timedelta(0), timedelta(90))
Select fewer contracts by limiting the spread of strikes and expiration dates:
option.SetFilter(-10, +10, timedelta(30), timedelta(60))
This way the algorithm loops through fewer contracts each time you run your custom function strike_selection().
Nicolas Ferrari
Hello Haldor, thanks for your support, It was the big filter of chains that was causing the slow running.
Nicolás
Nicolas Ferrari
Halldor Andersen I have some question to ask you about the same algo. For some dates, the algo is not getting any option contracts from the option chain. These dates are 17-12-2018, 28-12-2018, 02-01-2018 and 23-01-2019 where the slice.OptionChains.Count is equal to zero in the strike_selection function.
What might be happen in those cases?
Thanks for your further support!
Nicolás
Link Liang
Hi Nicolas,
Please check your new post for latest updates. Thanks for your support!
Nicolas Ferrari
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!