I am using a ConstantFeeModel of 0.0 and a slippage model as well of 0.0. Hence I expected the fill price of market order to be exactly same as closing price. But even then there's a difference in both of about 0.01. Could you please let me know what could be the reason behind this. Example:
Log:
2020-07-08 09:31:00 :Entered Short Position at 2020-07-08 09:31:00 at its Close(313.196130625)
Order:
2020-07-08 09:31:00SPYSell MarketFill: $313.1861705 USD
-318Filled
As shown above, Close:313.1961..., Fill: 313.1861..., a difference of about 0.01, have noticed this difference in all fills. How can I make these same?
Jared Broad
LEAN has L1 spread; so the bid and ask price for market orders are used for the fills. I wouldn't recommend removing this as it makes your backtest more realistic. If you want to though, you can set a custom fill model and force the fill price to be the last trade or some midpoint of the bid-ask.
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.
Abhishek Gupta
Right! Thanks for providing both the reason and solution. I agree on the realistic part, but sometimes I like to see how strategy performs given a perfect execution.
Abhishek Gupta
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!