enewhuis / liquibook

Modern C++ order matching engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Order replace issue

chavanrc opened this issue · comments

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(order_listener_)
{
order_listener_->on_replace(cb.order,
cb.delta,
cb.price);
}
break;

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