From 8bba52d3b997bde527ebf560446dcd22f2df7872 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 24 Mar 2022 17:19:02 +0100 Subject: [PATCH] kraken: engine: expose 'process_single_order' --- src/engine/engine.cc | 8 ++++++-- src/engine/engine.hh | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/engine/engine.cc b/src/engine/engine.cc index 5288690..caaae1d 100644 --- a/src/engine/engine.cc +++ b/src/engine/engine.cc @@ -91,10 +91,14 @@ Engine::Engine(std::shared_ptr listener, CrossBehaviour cross_behaviour) : listener_(listener), cross_behaviour_(cross_behaviour) {} +void Engine::process_single_order(Order const& order) { + std::visit([this](auto const& trade_order) { (*this)(trade_order); }, + order); +} + void Engine::process_orders(std::vector const& orders) { for (auto const& order : orders) { - std::visit([this](auto const& trade_order) { (*this)(trade_order); }, - order); + process_single_order(order); } } diff --git a/src/engine/engine.hh b/src/engine/engine.hh index e02fedb..9250383 100644 --- a/src/engine/engine.hh +++ b/src/engine/engine.hh @@ -25,6 +25,9 @@ struct Engine { Engine(std::shared_ptr listener, CrossBehaviour cross_behaviour = CrossBehaviour::REJECT); + /// Process a single order, triggerring the listener appropriately. + void process_single_order(Order const& order); + /// Process orders, triggerring the listener on each event. void process_orders(std::vector const& orders);