Skipped open when testing fifo
This commit is contained in:
1 parent
6c6dd86c02
commit
a5b9e40b53
1 file changed
+18
-2
@@ -32,6 +32,8 @@ std::map<std::string, std::function<int(std::vector<std::string> const &)>>
|
||||
struct BackTesterHarness : IChannelObserver {
|
||||
std::unordered_map<MDP3SecurityID, Orders> orders;
|
||||
std::unordered_map<MDP3OrderKey, DeducedIceberg> icebergs;
|
||||
std::unordered_set<MDP3SecurityID> ready_securities;
|
||||
|
||||
size_t passed_tests = 0;
|
||||
|
||||
BackTesterHarness(std::string const &pcap)
|
||||
@@ -42,11 +44,26 @@ std::map<std::string, std::function<int(std::vector<std::string> 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<std::string, std::function<int(std::vector<std::string> 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)
|
||||
|
||||
Reference in new issue
Block a user