Most of the exchanges provide aggressor side property of trades (e.g. Tag=5797 AggressorSide on CME) in their raw data. But many data providers do not provide this information via their datafeed API's. I need an algorithm to estimate with high precision the trade's aggressor side.
Suppose, I receive depth data updates and trades updates. The simplest algorithm is (in Java code):
public static int get_aggressor(int bid, int ask, int trade_price){
int aggr = Tags.UNKNOWN_SIDE;
if (bid < ask){ // i.e. no cross
if (trade_price >= ask){
aggr = Tags.BUY_SIDE;
} else if (trade_price <= bid){
aggr = Tags.SELL_SIDE;
}
}
return aggr;
}
where bid
and ask
are best bid/ask prices at a time when the trade was received. This algorithm may fail to detect the aggressor when the trade in the question affects the best bid/ask.
Question: Suppose I have the history of recent price updates. How to improve the precision of the aggressor detection algorithm? Also, consider two types of data feed:
- The trades always arrive before the resulted price updates
- The order of updates arrival in #1 is not guaranteed.
Please let me know if there are published researches on this topic.