Originally Posted by jcl
A limit order is filled when an order book entry matches the limit.


They're also filled when your limit order is on the top of the order book and someone places a market order, thereby taking your order from the book. These market orders never make it to the order book, no?

I think using ask/bid data is close enough for simulation but this data usually doesn't have size attached to it (but from some sources it might) whereas trades data tends to have the trade size attached, therefore you can accurately simulate how much of your order would be filled.