set span to default off, hook up admin boolean to enforce span behind config key
This commit is contained in:
1 parent
4f997505f3
commit
33f533af9b
3 files changed
+15
-14
No files matched your search
@@ -1,7 +1,7 @@
|
||||
|
||||
SpanMargin {
|
||||
value {
|
||||
enabled: true
|
||||
enabled: false
|
||||
login: 'api_bts1'
|
||||
password: 'Summer123'
|
||||
url: 'https://cmecorenr.cmegroup.com/MarginServiceApi/1.4/'
|
||||
|
||||
@@ -275,20 +275,20 @@ private:
|
||||
const auto acct_it = _account_data_map.find(account_id.value());
|
||||
if(acct_it != _account_data_map.end()){
|
||||
const auto& account_data = acct_it->second;
|
||||
//const auto& account = account_data.account;
|
||||
const auto& account = account_data.account;
|
||||
if(config::get<bts::config::SpanMargin>().enabled()) {
|
||||
// if (account.has_margin_limit() &&
|
||||
// account.margin_limit().enforce_margin()){
|
||||
double ex_liq = account_data.excess_liquidity;
|
||||
if(os::is_nan(ex_liq)){
|
||||
out_res.result = Limiter::LimiterErrorCode::MARGIN_LIMIT_BREACHED;
|
||||
out_res.error_msg = "Could not find account Excess Liquidity";
|
||||
}
|
||||
else{
|
||||
if(ex_liq < 0){
|
||||
if (account.has_margin_limit() && account.margin_limit().enforce_margin()){
|
||||
double ex_liq = account_data.excess_liquidity;
|
||||
if(os::is_nan(ex_liq)){
|
||||
out_res.result = Limiter::LimiterErrorCode::MARGIN_LIMIT_BREACHED;
|
||||
out_res.error_msg = fmt::format("Margin Limit Excess Liquidity : {}",
|
||||
ex_liq);
|
||||
out_res.error_msg = "Could not find account Excess Liquidity";
|
||||
}
|
||||
else{
|
||||
if(ex_liq < 0){
|
||||
out_res.result = Limiter::LimiterErrorCode::MARGIN_LIMIT_BREACHED;
|
||||
out_res.error_msg = fmt::format("Margin Limit Excess Liquidity : {}",
|
||||
ex_liq);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +162,8 @@ void MarginServiceServer::publish_excess_liquidity_report(const api::position::M
|
||||
{
|
||||
report.set_leverage_factor( acct->margin_limit().leverage_factor_percentage() );
|
||||
report.set_cash_balance(acct->margin_limit().cash_balance());
|
||||
report.set_should_enforce_margin(acct->margin_limit().enforce_margin());
|
||||
report.set_should_enforce_margin(acct->margin_limit().enforce_margin() &&
|
||||
config::get<bts::config::SpanMargin>().enabled());
|
||||
}
|
||||
|
||||
double netliq = report.leverage_factor() * report.cash_balance();
|
||||
|
||||
Reference in new issue
Block a user