Skip to content

FAQ Frequently Asked Questions

ArjunVachhani-CCM edited this page Jun 30, 2023 · 3 revisions

Where does order-matcher stores order?

Order matcher stores orders in-memory for best performance.

How to re-initialize order-matcher after restart?

Adding open again orders will result in same state before restart.

Does order-matcher maintains/keep track balance?

No order matcher does not maintain/keep track balance or update balance. Proper balance check should be made before adding order to order matcher. On cancel and order match event update balance accordingly.

Is order-matcher multi-threaded?

No order-matcher is not multi threaded. MatchingEngine must be signle threaded because of the price-time priority matching implementation. It has been observed that multi threaded MatchingEngine will not increase performance. For better performance IO should be handled by separate thread and order-matching can be handled by separate thread. Pipeline approach can be used to increase the performance.

How can I get more peformance?

Price, Quantity and Amount type abstracts underlying types. decimal is used as underlying type for simplicity. If you are ok with complexity and need more performance you can change underlying type to long. long type uses less storage and is computationally faster then decimal.

How to have multiple markets?

One object instance of MatchingEngine will handle one market, Create one object instance of MatchineEngine per market. Suppose you have 25 markets then you need to create 25 instances.