-
Notifications
You must be signed in to change notification settings - Fork 70
FAQ Frequently Asked Questions
Order matcher stores orders in-memory for best performance.
Adding open again orders will result in same state before restart.
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.
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.
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.
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.