ArjunVachhani / order-matcher

simple, fast and feature rich order matching engine supports limit, market, stop-loss, iceberg, IOC, FOK, GTD orders
MIT License
137 stars 70 forks source link

Matching engine should be deterministic #15

Closed ArjunVachhani closed 4 years ago

ArjunVachhani commented 4 years ago

Add order cancels expired good till date orders before executing incoming order. This behavior makes add order method non deterministic. All the methods should be deterministic this may help in replication/high availability implementation.

ArjunVachhani commented 4 years ago

It's ok to cancel expired good till date order during AddOrder, as far as it is deterministic. Actually MatchingEngine should not have a dependency on any non-deterministic function/type. ITimeProvider is non-deterministic. instead of passing ITimeProvider to the constructor of MatchingEngine. the timestamp should be passed when adding a new order.