for the first time at start up, net pos is enforced
This commit is contained in:
1 parent
4a292c8030
commit
6e4ed3f328
3 files changed
+15
-4
No files matched your search
@@ -91,7 +91,7 @@ public:
|
||||
if(short_pos + quantity.value() > short_pos_limit){
|
||||
out_res.error_msg = fmt::format("Short Position (Abs) "
|
||||
"(Max {} Current {})",
|
||||
long_pos_limit,long_pos);
|
||||
short_pos_limit,short_pos);
|
||||
out_res.ok = false;
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
if(short_pos + diff > short_pos_limit){
|
||||
out_res.error_msg = fmt::format("Short Position (Abs) "
|
||||
"(Max {} Current {})",
|
||||
long_pos_limit,long_pos);
|
||||
short_pos_limit,short_pos);
|
||||
out_res.ok = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ AdminServiceServer::AdminServiceServer(bts::api::ServiceContext& context)
|
||||
if (_state.ParseFromString(ser_data))
|
||||
{
|
||||
data_found = true;
|
||||
AdminServiceUtils::fill_connections_from_config(_state);
|
||||
_check_data_on_start();
|
||||
_update_and_publish(false);
|
||||
}
|
||||
}
|
||||
@@ -250,4 +250,10 @@ void AdminServiceServer::_publish_md_permissions(){
|
||||
_md_perm_publisher.add_or_update(p);
|
||||
_md_perm_publisher.flush();
|
||||
}
|
||||
void AdminServiceServer::_check_data_on_start (){
|
||||
AdminServiceUtils::fill_connections_from_config(_state);
|
||||
for(int i=0; i<_state.accounts().size(); i++)
|
||||
if(!_state.mutable_accounts(i)->has_risk_limit_enforcement())
|
||||
_state.mutable_accounts(i)->mutable_risk_limit_enforcement()->set_product_limit_in_net_terms(true);
|
||||
}
|
||||
}}
|
||||
@@ -68,12 +68,17 @@ public:
|
||||
const api::Response<bts::api::VoidMessage>& reply) override;
|
||||
|
||||
private:
|
||||
// this is mainly does 2 things :
|
||||
// 1. some data is in partially in config, this copies
|
||||
// that to here
|
||||
// 2. for new data fields, it initializes them here
|
||||
void _check_data_on_start();
|
||||
void _update_and_publish (bool is_insert);
|
||||
void _publish_md_entitlements();
|
||||
void _publish_md_permissions();
|
||||
void _add_live_order(map<string,map<string,OrdersSummaryUnit>>& agg,
|
||||
const OrderRecord& order);
|
||||
void _cancel_orders(const std::vector<string>& accounts,
|
||||
const std::vector<string>& users);
|
||||
const std::vector<string>& users);
|
||||
};
|
||||
}}
|
||||
Reference in new issue
Block a user