chronoxor / CppTrader

High performance components for building Trading Platform such as ultra fast matching engine, order book processor
MIT License
833 stars 254 forks source link

Executed Price for "All Or None" Order are Using Highest Price even there is an order with lower price. #28

Closed devararendy closed 2 years ago

devararendy commented 2 years ago

Hi @chronoxor thank You for sharing this great matching engine library.

I would like to ask about AON (All Or None) Order. I'm using an example app "cpptrader-example-matching_engine". Below is a sequence of order that i enter:

  1. Add AON Limit Sell Order : Price = 5; Qty = 100;
  2. Add GTC Limit Buy : Price = 99999999; Qty = 50;
  3. Add GTC Limit Buy : Price = 5; Qty = 25;
  4. Add GTC Limit Buy : Price = 5; Qty = 25;

Now all orders executed, Order Id 2 has executed price = 99999999. But for Order Id 3 and 4 the executed price are also 99999999. For Order Id 3 and 4 it should be executed with price = 5 right ?

Below is a screen shot of the example app.

image

chronoxor commented 2 years ago

Confirm. There is an issue with

// Execute orders in the matching chain
ExecuteMatchingChain(order_book_ptr, bid_level_ptr, bid_order_ptr->Price, chain);
ExecuteMatchingChain(order_book_ptr, ask_level_ptr, ask_order_ptr->Price, chain);

Will fix soon!

devararendy commented 2 years ago

Thank You very much :)

Best Regards

chronoxor commented 2 years ago

@devararendy, please try a fix for AON issue

devararendy commented 2 years ago

@devararendy, please try a fix for AON issue

Great thank you so much, let me try the fix ;D

devararendy commented 2 years ago

Hi @chronoxor We have tested the new commit (using commit : 43b8cfbc438373d3fb9b784025f6018f453e4e72), now the executed price is correct.

thank you so much Best Regards