diff --git a/src/server/sparkd/cmds/spartan/md/mdp3/back_testing/matcher/FifoPriceLevelMatcher.cpp b/src/server/sparkd/cmds/spartan/md/mdp3/back_testing/matcher/FifoPriceLevelMatcher.cpp index eb1e78cc4..a463dff11 100644 --- a/src/server/sparkd/cmds/spartan/md/mdp3/back_testing/matcher/FifoPriceLevelMatcher.cpp +++ b/src/server/sparkd/cmds/spartan/md/mdp3/back_testing/matcher/FifoPriceLevelMatcher.cpp @@ -86,6 +86,7 @@ FifoPriceLevelMatcher::_one_pass_cross_order(MDP3OrderKey cross_ord_key, MDP3Quantity(filled), _price }; + UtilFunctions::validate_update(passive_upd); res->push_back(passive_upd); OrderUpdate agg_upd = { @@ -98,6 +99,7 @@ FifoPriceLevelMatcher::_one_pass_cross_order(MDP3OrderKey cross_ord_key, MDP3Quantity(filled), _price }; + UtilFunctions::validate_update(agg_upd); res->push_back(agg_upd); } if(_trace.log(o.key) || _trace.log(cross_ord_key)) diff --git a/src/server/sparkd/cmds/spartan/md/mdp3/back_testing/matcher/MatchingCommon.h b/src/server/sparkd/cmds/spartan/md/mdp3/back_testing/matcher/MatchingCommon.h index 34a078fd5..8d2bf9b79 100644 --- a/src/server/sparkd/cmds/spartan/md/mdp3/back_testing/matcher/MatchingCommon.h +++ b/src/server/sparkd/cmds/spartan/md/mdp3/back_testing/matcher/MatchingCommon.h @@ -3,6 +3,7 @@ // did not want to fwd decl everything specially // the templated classes (will fix later) #include "../../common/InstrumentSnapshot.h" +#include "../simulator/AlgoEvent.h" namespace bts::spartan::mdp3 { @@ -41,6 +42,17 @@ public: } }; +class UtilFunctions{ +public: + static void validate_update(const OrderUpdate& u){ + if (u.status == OrderUpdate::Status::PARTIALLY_FILLED || + u.status == OrderUpdate::Status::FILLED) + bts_assert(u.last_fills.value() > 0); + if (u.status == OrderUpdate::Status::CANCELED) + bts_assert(u.last_fills.value() == 0); + } +}; + struct MatcherIB { bool is_ib = false; MDP3Quantity show_qty = MDP3Quantity(0);