Fix: Exchange sec id fixed

This commit is contained in:
Mohammad Arham committed 2025-03-03 17:50:25 +00:00
1 parent ee02c3ffa7
commit e7b426cd3d
2 files changed
+6 -3

No files matched your search

+5 -2
View File
@@ -36,6 +36,7 @@
#include "lib/utils/bts_assert.h"
#include <bits/stdint-uintn.h>
#include <cstddef>
#include <google/protobuf/timestamp.pb.h>
#include <google/protobuf/util/time_util.h>
#include <memory>
@@ -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);
@@ -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();