vgreg / MeatPy

Market Empirical Analysis Toolbox for Python
BSD 3-Clause "New" or "Revised" License
21 stars 5 forks source link

Priority Execution #2

Closed judmejiabe closed 1 year ago

judmejiabe commented 1 year ago

Hi,

while running some example code on the sample data available in this link I get the warning below. Looks like this is something related to the execution priority. Can I get some insight on why this is happening? Does this have a significant impact on the LOB reconstruction?

Warning, ALGN, Level:execute_trade, "Order ID 3521821 not first in line, 10609505 is. (34611896907865)"

Thanks in advance!

vgreg commented 1 year ago

This warning means that there is an execution, at which time order 10609505 is at the front of the queue, but order 3521821 is the one that gets the execution. If you only get one such message, the most likely cause is there were two executions simultaneously (i.e. one market order hit two limit orders), but Nasdaq pushed the execution messages in the wrong order. If that is the case, the impact is minimal on LOB reconstruction.

If you get multiple messages like this with the same order at the front of the queue not being executed, then it is a sign that something is wrong with LOB reconstruction (the order most likely got canceled or executed, but MeatPy is not handling it properly).

Let me know if you figure out what is going on so I can fix any issue in the code.