Now that the L1 Equity Quote Data is available, I wonder if we could create better and more realistic Market Impact Models.
I've already written something about this in the L1 Equity Quote Data Thread.
According to the Documentation, you can build your own Market Impact Models (is called Slippage there).
Consider the following situation:
A market participant wants to buy 1,000 shares of XYZ and the current bid price is $ 100.00, but as only 100 shares are offered at that price level, the order will not be executed in full at $ 100.00. Instead it will reach the next level in the order book and execute the next orders at $ 100.01 and so on.
As a result, the average execution price wil be higher than current backtesting suggests.
If you want to display it 100% realistically, you would need the complete history with the highest granularity (Tick) of the entire order book (Full DOM or at least Level 2 Data). You can imagine that this would pose completely new challenges to the hardware performance as the data volumes would be enormous. Therefore it makes sense to work with models that are very close to reality.
A good and scientifically accepted approach would be the square-root formula for market impact, which we can use now where L1 Quote Data and thus the Spreads are available.
Theoretically, you could simply build this into your Algo. The only problem is that the backtest durations would significantly increase then, because of the additional computations for the market impact model for each security at tick resolution. This brings me to my questions:
1.) @Community
How do you handle it? Have you tried to extend the existing slippage model since the L1 Quote Data is available?
2.) @Quantconnect
Would you consider extending and improving the Constant Slippage Model currently used for Alpha Streams Brokerage by including L1 Quote Data?
Derek Melchin
Hi Arthur,
In regards to the question directed to the QC team:
We are always working hard to make LEAN trading as realistic as possible. If we have access to a model that is proven to more accurately predict slippage, we would consider incorporating it into LEAN. Our L1 Quote Data is quite new, so these improvements are still ahead of us. If a user implements this model, I suggest they make a PR to our GitHub repo.
Best,
Derek Melchin
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.
Arthur Asenheimer
Hi Derek,
thanks for your input. It's good to know that QC is basically interested in improving the existing slippage models to make the backtests even more realistic.
When I find the time, I will do some analysis and play around with different slippage models and share my findings here with the community (other members of the community are of course welcome to contribute, too).
But first I have a question regarding the L1 Equity Quote Data:
Jared's comment suggests that the L1 Quote Data are available in Tick Resolution. But when I try to do some backtesting with TickType.Quote (which is tick.TickType == 1 in python) I only get empty lists (see attached backtest and screenshot from debugging).
Backtesting with QuoteBars (e.g. Second Resolution) is not a problem, but the backtesting with Tick Quotes.
Maybe I just misunderstood something and you can enlighten us ...? Or was it always about QuoteBars?
Screenshot:
https://i.imgur.com/cl7rJ6y.png
Derek Melchin
Hi Arthur,
To access the quote ticks, we need to ensure we loop through `data.Ticks`:
def OnData(self, data): if not data.ContainsKey(self.symbol): return for tick in data.Ticks[self.symbol]: if tick.TickType == TickType.Trade: self.trade_ticks = True if tick.TickType == TickType.Quote: self.quote_ticks = True
See the attached backtest for reference.
Best,
Derek Melchin
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.
Arthur Asenheimer
Hi Derek,
thank you for the explanation!
However, I will code the custom slippage model by using QuoteBars with Second Resolution instead of quote ticks as 1.) backtesting with tick data is very time consuming and 2.) there will be latency of >100 ms in live trading (between submission of order and completed execution of orders) and 3.) QuoteBars with second resolution will give us a good approximation for the Bid-Ask-Spreads.
Derek Melchin
Hi Arthur,
Sounds good! Please share the model with the community by attaching it to this thread after it's developed.
Best,
Derek Melchin
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.
Arthur Asenheimer
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!