I can't figure out why my algorithm is filling orders with stale prices, specifically for VIX index options. If I change the options to something else (eg. VXX or SPY), it fills at correct current prices, but with VIX index options it fills at stale prices. How do I correct this? I must be missing something.
The algorithm in the attached backtest is part of larger algorithm, but I trimmed it down to the section causing the issue.
Thanks in advance for any assistance with this.
Alexandre Catarino
Hi Bodhi ,
The algorithm is placing orders one minute after the market opens. If the security is not liquid in the first minute, meaning we don't have price data from the current day when the order is placed, the engine will use the last data available.
There are two alternatives: change the scheduled event to fire later, e.g. 10 minutes after the market opens, or move the logic to OnData and verify whether the price data in the Slice object is not fill-forward data.
Best regards,
Alex
Bodhi
Hi Alexandre, thanks for your response. I added logic to only purchase option contracts at 11am, which fixed the stale prices on purchase orders, but I'm still having issues with selling those options. Per your suggestion, I tried adding the following as a condition to liquidate the option prior to it's expiration:
…however it doesn't always work. It successfully liquidated the first option contract 2 days before expiration, but fails for the option contracts held thereafter.
Any help with this would be much appreciated. Thank you.
Louis Szeto
Hi Bodhi
There are missing data points in those periods so that there is no quote available as the trade counterpart. Please subscribe this and this data issue threads for updates. We apologize for your inconvenience.
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.
Bodhi
Okay, thanks for letting me know.
Bodhi
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!