migrate recent iceberg improvements over to DirectMatcher, and disable implied matching (need to resolve slowness in the MergedMatcher)
This commit is contained in:
1 parent
511b9551e3
commit
710e05b029
3 files changed
+36
-7
No files matched your search
@@ -244,14 +244,42 @@ void DirectMatcher::match(ChangeSrc,
|
||||
std::vector<std::pair<MDP3SecurityID, CheckedMatcher*>> dirty;
|
||||
dirty.reserve(_matcher_map.size());
|
||||
|
||||
for (const auto& c : changes){
|
||||
_trace.log_incoming_change(c);
|
||||
MatcherUtils::validate_incoming_order_change(c);
|
||||
auto it = _matcher_map.find(c.order.security);
|
||||
for (const auto& c : changes) {
|
||||
auto new_ch = c;
|
||||
auto it = _matcher_map.find(new_ch.order.security);
|
||||
bts_assert (it != _matcher_map.end());
|
||||
auto& sec_matcher = it->second.matcher;
|
||||
sec_matcher.on_order_change(c, res);
|
||||
dirty.emplace_back(c.order.security,&it->second);
|
||||
switch (c.change) {
|
||||
case OrderChange::ChangeType::added:
|
||||
if (new_ch.order.iceberg_quantity.has_value())
|
||||
icebergs.insert(std::make_pair(new_ch.order.key, new_ch.order.iceberg_quantity.value()));
|
||||
break;
|
||||
case OrderChange::ChangeType::updated: {
|
||||
auto* old_ord = std::get<1>(sec_matcher.find_order(c.order.key));
|
||||
if (old_ord == nullptr) {
|
||||
// the matcher may not have this order anymore;
|
||||
// it may have been filled already due to an algo shot.
|
||||
continue;
|
||||
}
|
||||
OrderChange big_ch;
|
||||
big_ch.change = c.change;
|
||||
big_ch.previous_order = to_mdp3_order(*old_ord);
|
||||
big_ch.order = c.order;
|
||||
if (big_ch.order.iceberg_quantity.has_value()) {
|
||||
iceberg_helper::detect_show_qty_changes(big_ch, icebergs);
|
||||
auto it = icebergs.find(big_ch.order.key);
|
||||
bts_assert(it != icebergs.end());
|
||||
big_ch.order.iceberg_quantity = it->second;
|
||||
}
|
||||
new_ch.order = big_ch.order;
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
_trace.log_incoming_change(new_ch);
|
||||
MatcherUtils::validate_incoming_order_change(new_ch);
|
||||
sec_matcher.on_order_change(new_ch, res);
|
||||
dirty.emplace_back(new_ch.order.security,&it->second);
|
||||
}
|
||||
for(const auto& u : *res)
|
||||
_trace.log_outgoing_update(std::get<OrderUpdate>(u));
|
||||
|
||||
@@ -69,6 +69,7 @@ private:
|
||||
bool dirty = false;
|
||||
};
|
||||
std::map<MDP3SecurityID,CheckedMatcher> _matcher_map;
|
||||
boost::container::flat_map<MDP3OrderKey, IcebergQuantity> icebergs;
|
||||
Trace _trace;
|
||||
size_t _match_count;
|
||||
size_t _match_count_this_per;
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
// i need to dedicate more ram to my vm).
|
||||
// If you want to run the simulator with implied matching,
|
||||
// just uncomment the line below.
|
||||
#define ENABLE_IMPLIED_MATCHING
|
||||
//#define ENABLE_IMPLIED_MATCHING
|
||||
namespace bts::spartan::mdp3 {
|
||||
|
||||
#ifdef ENABLE_IMPLIED_MATCHING
|
||||
|
||||
Reference in new issue
Block a user