enewhuis / liquibook

Modern C++ order matching engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to cancel stop order if it has not been triggered

Gordon-TheTurtle opened this issue · comments

OrderBook::cancel(const OrderPtr& order) function does not check for the order in stop orders during cancellation.
So if you place a cancel order for stop order that has not been triggered yet you will not be able to cancel it and a cancel reject callback is generated.

Correct behaviour:

  1. Try to cancel the order in normal orders.
  2. If order exists, generate cancel callback, else check for the order in stop orders.
  3. If order exists, generate cancel callback else cancel reject callback.

I can submit a pull request if required.

commented

I have confirmed a similar bug and may have a fix to merge soon after some additional scrutiny. Feel free to submit a PR and we can compare with other proposed fixes.

Great, I will start working on it.

Hi @enewhuis,

PR for the same has been created and tested.

commented

merged