Hi, I want to build a model to forecast the price impact of a trade with additional features of LOB, like depth imbalance.
So I need a dataset kind of like the MarketDepth now but for each row, I want to know what action (trade/quote) trigger this LOB update. For example, each row should have:
Trade price, Trade Size + LOB L1-L10 immediately before the trade is executed (or immediately after the trade is executed).
Currently, I am downloading market depth and trade data separately and try to merge them. However, for trade in TimeAndSales, the time stamp doesn't match with MarketDepth
Is there any way, I can merge this two dataset correctly? Or using other dataset to derive the similar stuff?
Thank you!
Following are templates I used to extract trade and depth. And an example of the same trade but different time stamp in TimeAndSales and MarketDepth. In this example, the first row of two df should be matched, but their time stamp is very different and there might be duplicate time stamp as well.