diff --git a/src/lib/md/GeneralMarketDataListener.cpp b/src/lib/md/GeneralMarketDataListener.cpp index 710113186..7041d1ffc 100644 --- a/src/lib/md/GeneralMarketDataListener.cpp +++ b/src/lib/md/GeneralMarketDataListener.cpp @@ -36,6 +36,7 @@ #include "lib/utils/bts_assert.h" #include +#include #include #include #include @@ -732,11 +733,13 @@ static bool get_qty_info( } return true; } - +bool is_number(const std::string &s) { + return !s.empty() && std::all_of(s.begin(), s.end(), ::isdigit); + } void GeneralMarketDataListener::_copy_security_common( const bts::domain::Security &from, uint64_t key, FixedSecurity &to) const { to.key = key; - to.numeric_id = key; + to.numeric_id =is_number(from.security_common.exchange_sec_id)?std::stoul(from.security_common.exchange_sec_id):key; auto symbol = from.security_common.symbol; to.symbol(symbol); to.security_desc(from.security_common.desc); diff --git a/src/server/sparkd/md/databento/DatabentoDataHandler.cpp b/src/server/sparkd/md/databento/DatabentoDataHandler.cpp index 4060fcdcb..b9ace9ccf 100644 --- a/src/server/sparkd/md/databento/DatabentoDataHandler.cpp +++ b/src/server/sparkd/md/databento/DatabentoDataHandler.cpp @@ -215,7 +215,7 @@ void DatabentoDatahandler::run( bts::domain::Security sec; sec.security_common = domain::SecurityCommon(); sec.security_common.venue = venue; - sec.security_common.exchange_sec_id = msg.hd.instrument_id; + sec.security_common.exchange_sec_id = std::to_string(msg.hd.instrument_id); sec.security_common.desc = msg.RawSymbol(); sec.security_common.symbol = msg.Underlying(); sec.security_common.asset = msg.Asset();