enewhuis / liquibook

Modern C++ order matching engine
Other
1.15k stars 380 forks source link

Order replace issue #32

Open chavanrc opened 3 years ago

chavanrc commented 3 years ago

In order_book.h there is issue with order replace. Instead of quantity on market, original quantity is used for modification. It corrupts the book and causes issue in CloseOrder for price modify while deleting older order.

In order_book.h

case TypedCallback::cb_order_replace: on_replace(cb.order, cb.order->order_qty(), cb.order->order_qty() + cb.delta, cb.price); if(orderlistener) { orderlistener->on_replace(cb.order, cb.delta, cb.price); } break;

Should be case TypedCallback::cb_order_replace: onreplace(cb.order, cb.quantity, cb.quantity_ + cb.delta, cb.price); if(orderlistener) { orderlistener->on_replace(cb.order, cb.delta, cb.price); } break;