validation of incoming OrderChange

This commit is contained in:
Taha Afzal committed 2020-10-08 13:26:18 -04:00
1 parent 385de5108e
commit 2f45ee3fe3
1 file changed
+12 -5
@@ -2,6 +2,12 @@
namespace bts::spartan::mdp3{
void validate_order_change(const OrderChange& c){
if(c.change == OrderChange::ChangeType::added ||
c.change == OrderChange::ChangeType::updated)
bts_assert(c.order.quantity.value()>0);
}
Matcher::Matcher()
:
_matcher_map(){
@@ -21,11 +27,12 @@ void Matcher::match(ChangeSrc,
const std::vector<OrderChange>& changes,
std::vector<MatchEffect>* res) {
for (const auto& c : changes){
auto it = _matcher_map.find(c.order.security);
bts_assert (it != _matcher_map.end());
auto& sec_matcher = it->second.matcher;
sec_matcher.on_order_change(c, res);
it->second.dirty = true;
validate_order_change(c);
auto it = _matcher_map.find(c.order.security);
bts_assert (it != _matcher_map.end());
auto& sec_matcher = it->second.matcher;
sec_matcher.on_order_change(c, res);
it->second.dirty = true;
}
// all order activity is not reflecting in the
// books