Batched new secs in a single call to limiter.
This commit is contained in:
1 parent
3d08755ffe
commit
e53c186ea9
4 files changed
+9
-3
No files matched your search
@@ -56,12 +56,15 @@ void OrderManager::on_securities(
|
||||
const mercury::Update<NewSecuritiesEvent> &update) {
|
||||
if (update.events) {
|
||||
|
||||
// update our security db
|
||||
// update our security db and accumulate for the sake of the limiter
|
||||
std::vector<api::Security const*> secs;
|
||||
for (auto const &ev : *(update.events)) {
|
||||
auto sec_ptr = ev.security;
|
||||
secs.push_back(sec_ptr);
|
||||
me->services_data.sec_db.securities[SecurityKey(sec_ptr->id())] =
|
||||
sec_ptr;
|
||||
}
|
||||
me->services_data.limiter.add_securities(secs);
|
||||
|
||||
if (me->state == State::WAIT_SEC) {
|
||||
LOG(OrderMan, Info, "Order manager received initial set of {} "
|
||||
|
||||
@@ -14,6 +14,7 @@ Limiter::~Limiter() {}
|
||||
|
||||
void Limiter::update(api::admin::AdminData const &) {}
|
||||
|
||||
void Limiter::add_securities(std::vector<api::Security const*> const&) {}
|
||||
void Limiter::add_security(api::Security const &) {}
|
||||
|
||||
void Limiter::add(api::Security const &, AccountID, api::Side, Quantity) {}
|
||||
|
||||
@@ -18,6 +18,7 @@ class Limiter {
|
||||
Limiter();
|
||||
void update(api::admin::AdminData const &);
|
||||
|
||||
void add_securities(std::vector<api::Security const*> const&secs);
|
||||
void add_security(api::Security const &new_sec);
|
||||
|
||||
void add(api::Security const &, AccountID, api::Side, Quantity);
|
||||
|
||||
@@ -195,7 +195,7 @@ public:
|
||||
if (it == _sec_map.end())
|
||||
return nullptr;
|
||||
else
|
||||
&it->second;
|
||||
return &it->second;
|
||||
}
|
||||
ProductLimitTree* find_product(api::Product& product){
|
||||
for(auto it=_prod_map.begin(); it!= _prod_map.end(); it++){
|
||||
@@ -279,4 +279,5 @@ private:
|
||||
return _prod_map.back();
|
||||
}
|
||||
};
|
||||
}}
|
||||
}}
|
||||
|
||||
Reference in new issue
Block a user