diff --git a/src/lib/api/services/MarketDataRelay.proto b/src/lib/api/services/MarketDataRelay.proto index 5690f3672..d93256c7c 100644 --- a/src/lib/api/services/MarketDataRelay.proto +++ b/src/lib/api/services/MarketDataRelay.proto @@ -16,7 +16,7 @@ message ExpirationNameList { } message ExpirationNameListReply { - repeated ExpirationNameList securities = 1; + repeated ExpirationNameList securities = 2; } service MarketDataRelay { diff --git a/src/lib/md/UserSymbol.h b/src/lib/md/UserSymbol.h index 102bfec1a..b7e7b701a 100644 --- a/src/lib/md/UserSymbol.h +++ b/src/lib/md/UserSymbol.h @@ -40,6 +40,14 @@ struct UserSymbol { return symbol() + "-" + SecurityType_Name(type()); } + bts::api::Product to_product() const { + bts::api::Product p; + p.set_exchange(_exchange); + p.set_type(_type); + p.set_symbol(_symbol); + return p; + } + // No move constructor - // because in this case the std::string will be a stock symbol which should be // small enough to be inlined in both msvsc and gcc/clang diff --git a/src/lib/md/relay/QueryServer.cpp b/src/lib/md/relay/QueryServer.cpp index 9478679bc..7181e2ee6 100644 --- a/src/lib/md/relay/QueryServer.cpp +++ b/src/lib/md/relay/QueryServer.cpp @@ -313,14 +313,16 @@ public: } } - void get_names(ExpirationNameList* reply) const { + void get_names(ExpirationNameListReply* reply) const { bts_assert(reply != nullptr); Security security; for (auto& groupiter : _groups) { const auto& group = groupiter.second; + ExpirationNameList* psec = reply->add_securities(); + psec->mutable_product()->CopyFrom(group->symbol.to_product()); for(const auto& h : *(group->handles)) { security.CopyFrom(h.handle.get_normalized_security()); - auto x = reply->mutable_names(); + auto x = psec->mutable_names(); if (security.ExchangeData_case() == Security::kGlbx) { google::protobuf::MapPair v(h.handle.key(), security.glbx().security_desc()); x->insert(v); @@ -369,10 +371,10 @@ struct MDRelayServer : bts::co2::MarketDataRelayBase { reply(list); } - virtual void request_names(const api::VoidMessage&, const std::function& reply) override { + virtual void request_names(const api::VoidMessage&, const std::function& reply) override { _threadpool.post([=]() { google::protobuf::Arena arena; - ExpirationNameList* preply = google::protobuf::Arena::CreateMessage(&arena); + ExpirationNameListReply* preply = google::protobuf::Arena::CreateMessage(&arena); _db.get_names(preply); reply(*preply); });