From 84b033277802da37655f37d44140bb44129fa31e Mon Sep 17 00:00:00 2001 From: Taha Afzal Date: Wed, 3 Aug 2022 23:53:57 -0400 Subject: [PATCH] Better logs for the case when Deribit's open orders's security can not be resolved --- src/lib/orderman/gateways/EMExecutionGateway.cpp | 10 ++++++---- src/lib/orderman/gateways/EMExecutionGateway.h | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/lib/orderman/gateways/EMExecutionGateway.cpp b/src/lib/orderman/gateways/EMExecutionGateway.cpp index 57f01fb3c..e492af2e1 100644 --- a/src/lib/orderman/gateways/EMExecutionGateway.cpp +++ b/src/lib/orderman/gateways/EMExecutionGateway.cpp @@ -505,7 +505,7 @@ void EMExecutionGateway::_process_pos_cb_and_fire( std::get(pos.position.sec_id.value()); auto sec = _get_security(exch_sec_desc); double pos_qty = std::get(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(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(o.qty.value()); Quantity filled_qty = std::get(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; } diff --git a/src/lib/orderman/gateways/EMExecutionGateway.h b/src/lib/orderman/gateways/EMExecutionGateway.h index 15bfa2584..53abc5e5c 100644 --- a/src/lib/orderman/gateways/EMExecutionGateway.h +++ b/src/lib/orderman/gateways/EMExecutionGateway.h @@ -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); };