From a5b9e40b53e6fb2f426cdecd435eecf7f1ecfa79 Mon Sep 17 00:00:00 2001 From: Pedro Pinto Date: Wed, 9 Sep 2020 17:40:57 -0400 Subject: [PATCH] Skipped open when testing fifo --- src/server/sparkd/cmds/Spartan.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/server/sparkd/cmds/Spartan.cpp b/src/server/sparkd/cmds/Spartan.cpp index e5f3a763e..8529f219f 100644 --- a/src/server/sparkd/cmds/Spartan.cpp +++ b/src/server/sparkd/cmds/Spartan.cpp @@ -32,6 +32,8 @@ std::map const &)>> struct BackTesterHarness : IChannelObserver { std::unordered_map orders; std::unordered_map icebergs; + std::unordered_set ready_securities; + size_t passed_tests = 0; BackTesterHarness(std::string const &pcap) @@ -42,11 +44,26 @@ std::map const &)>> auto annotated_orders = s->orders(); add_iceberg_annotation(annotated_orders); orders.emplace(s->security_id(), annotated_orders); + if (s->trading_status() == + ::mdp3::SecurityTradingStatus::ReadyToTrade) + ready_securities.insert(s->security_id()); } } void on_real_time_event(MDP3Event const &ev) override { for (auto s : ev.affected_securities) { + + // We do not want to process the first event at + // the open since the matching at the open it + // works differently. + if (ready_securities.count(s->security_id()) == 0) { + if (s->trading_status() == + ::mdp3::SecurityTradingStatus::ReadyToTrade) { + ready_securities.insert(s->security_id()); + } + continue; + } + auto it = orders.find(s->security_id()); if (it == orders.end()) { bts_assert(s->orders().empty()); @@ -68,12 +85,11 @@ std::map const &)>> continue; if (deduced.size()) { - // We have deduced orders, lets see what the matcher // says add_iceberg_annotation(deduced); - FifoSecurityMatcher matcher(ev.event_id,old_orders); + FifoSecurityMatcher matcher(ev.event_id, old_orders); auto current_orders = s->orders(); add_iceberg_annotation(current_orders); for (auto &o : deduced)