default sec and prod position limits

This commit is contained in:
Taha Afzal committed 2018-05-10 10:10:00 -04:00
1 parent f4a2b788ff
commit be062cc014
3 files changed
+22

No files matched your search

@@ -693,6 +693,20 @@ public:
for(int j=0; j<data.accounts_size();j++)
data.mutable_accounts(j)->mutable_connections()->add_exchange_connection_names(conn_name);
}
// add user permissions for account1
auto acct_1_sec_limit = account_1->add_security_position_limits();
acct_1_sec_limit->mutable_security()->set_exchange(api::Venue::VENUE_GLBX);
acct_1_sec_limit->mutable_security()->set_security_type(api::SecurityType::SECURITYTYPE_FUTURE);
acct_1_sec_limit->mutable_security()->set_security_symbol("*");
acct_1_sec_limit->set_long_position_limit (10000);
acct_1_sec_limit->set_short_position_limit (10000);
auto acct_1_prod_limit = account_1->add_product_position_limits();
acct_1_prod_limit->mutable_product()->set_exchange(api::Venue::VENUE_GLBX);
acct_1_prod_limit->mutable_product()->set_security_type(api::SecurityType::SECURITYTYPE_FUTURE);
acct_1_prod_limit->mutable_product()->set_security_symbol("*");
acct_1_prod_limit->set_long_position_limit(1000000);
acct_1_prod_limit->set_short_position_limit(1000000);
}
//position limits
////////////////////////////////////
@@ -22,9 +22,11 @@ Limiter::Limiter() : me(new PImpl()) {}
Limiter::~Limiter() {}
void Limiter::update(api::admin::AdminData const& admin_data) {
LOG(OrderMan, Info, "Limiter::update");
_reset(admin_data);
}
void Limiter::add_securities(std::vector<api::Security const*> const& new_securities){
LOG(OrderMan, Info, "Limiter::add_securities {} securities", new_securities.size());
me->securities.insert(std::end(me->securities), std::begin(new_securities), std::end(new_securities));
_reset(me->limit_store->admin_data());
}
@@ -101,6 +101,12 @@ TEST_CASE ("Creation", "[limiter]"){
sec_vec.push_back(&sec_2);
bts::api::admin::AdminData admin_data;
bts::admin::AdminServiceUtils::bootstrap_data(admin_data);
// getting rid of existing limits
for(int i=0; i < admin_data.accounts_size(); i++){
auto acct_ptr = admin_data.mutable_accounts(i);
acct_ptr->clear_product_position_limits();
acct_ptr->clear_security_position_limits();
}
std::string account_name = "account_1";
bts::api::admin::BTSAccount* account_ptr = bts::admin::AdminServiceUtils::find_account(admin_data, account_name);
add_account_prod_pos_limit (admin_data, account_ptr->name(), bts::api::Venue::VENUE_GLBX,