Sorted match effects so that price updates are delivered before order updates.

This commit is contained in:
Pedro Pinto committed 2020-12-29 08:06:27 -05:00
1 parent c4e4ff57d8
commit 5223529af1
1 file changed
+6 -1
@@ -437,7 +437,12 @@ void Sim::match_and_send_effects(MDP3TimeStamp transact_time,
std::vector<MergedMatcher::MatchEffect> effects;
simulation.matcher.match(MergedMatcher::SIMULATOR_INPUT, matcher_input,
&effects);
std::sort(effects.begin(), effects.end(),
[](auto const &ef1, auto const &ef2) {
auto rankf1 = std::holds_alternative<MBPUpdate>(ef1) ? 0 : 1;
auto rankf2 = std::holds_alternative<MBPUpdate>(ef2) ? 0 : 1;
return rankf1 < rankf2;
});
EventHeader header{me->event_id, transact_time, me->time};
for (auto &ef : effects)