kraken: engine: expose 'process_single_order'

This commit is contained in:
Bruno BELANYI 2022-03-24 17:19:02 +01:00
parent e601250e7b
commit 8bba52d3b9
2 changed files with 9 additions and 2 deletions

View file

@ -91,10 +91,14 @@ Engine::Engine(std::shared_ptr<EngineListener> listener,
CrossBehaviour cross_behaviour)
: listener_(listener), cross_behaviour_(cross_behaviour) {}
void Engine::process_orders(std::vector<Order> const& orders) {
for (auto const& order : orders) {
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<Order> const& orders) {
for (auto const& order : orders) {
process_single_order(order);
}
}

View file

@ -25,6 +25,9 @@ struct Engine {
Engine(std::shared_ptr<EngineListener> 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<Order> const& orders);