Better logs for the case when Deribit's open orders's security can not be resolved

This commit is contained in:
Taha Afzal committed 2022-08-03 23:53:57 -04:00
1 parent 20b601f290
commit 84b0332778
2 files changed
+9 -5

No files matched your search

@@ -505,7 +505,7 @@ void EMExecutionGateway::_process_pos_cb_and_fire(
std::get<std::string>(pos.position.sec_id.value());
auto sec = _get_security(exch_sec_desc);
double pos_qty = std::get<double>(pos.position.qty.value());
auto bts_account_ptr = _get_account(sec, pos.sub_account);
auto bts_account_ptr = _get_account(sec, pos.sub_account, exch_sec_desc);
auto account_name = [bts_account_ptr]() {
return bts_account_ptr == nullptr ? "" : bts_account_ptr->name();
};
@@ -536,7 +536,7 @@ void EMExecutionGateway::_process_open_order_cb_and_fire(
const std::string &exch_sec_desc =
std::get<std::string>(o.sec_id.value());
auto sec = _get_security(exch_sec_desc);
auto bts_account_ptr = _get_account(sec, i.sub_account);
auto bts_account_ptr = _get_account(sec, i.sub_account, exch_sec_desc);
Quantity qty = std::get<double>(o.qty.value());
Quantity filled_qty = std::get<double>(o.filled_qty.value());
me->exchange_open_orders.all_open_orders.push_back(
@@ -572,12 +572,14 @@ void EMExecutionGateway::_send_position_request() {
}
api::admin::BTSAccount *EMExecutionGateway::_get_account(
api::Security const *sec, const std::string &exch_account) {
api::Security const *sec,
const std::string &exch_account,
const std::string &exchange_sec_desc) {
auto *entry = me->subaccount_resolver.find_entry(sec, exch_account, false);
if (entry == nullptr) {
LOG(OrderMan, Error,
"Could not resolve internal account for sec: {}, sub_account: {}",
sec != nullptr ? utils::pb::to_string(*sec) : "Unresolved Security",
sec != nullptr ? utils::pb::to_string(*sec) : exchange_sec_desc,
exch_account);
return nullptr;
}
@@ -86,7 +86,9 @@ class EMExecutionGateway : public IExecutionGateway {
// periodic polling of position and orders
void _send_position_request();
api::admin::BTSAccount *_get_account(
api::Security const *sec, const std::string &exch_account);
api::Security const *sec,
const std::string &exch_account,
const std::string &exchange_sec_desc);
const api::Security *_get_security(const std::string &exch_sec_desc);
};