improvement: Refactor mdgw/ftx to use SecurityCriteria

So we can subscribe to depth for "FTX Options" or "FTX BTC Futures",
rather than having to list each security explicitly.

This commit also unhooks binance from MarketDataGateway. A new paradigm
is emerging with the FTX impl, and it'll be easier to redo Binance than
try to make the existing impl fit the new mold.

Unfortunately, ccapi doesn't provide all the security metadata we need, such as
the security type and expiration date/time, so we get the list of FTX
securities directly from the exchange.
This commit is contained in:
John Colvin committed 2023-01-04 13:35:38 -05:00
1 parent 556e2ab99e
commit abf0d45784
64 files changed
+4180 -536

No files matched your search

+12 -11
View File
@@ -103,8 +103,7 @@ string ConfigurationState::settings_path() {
void ConfigurationState::initialize_defaults(IConfigLog &log) {
initialize_defaults(
log,
{std::string("lib/config/protos/"), std::string("lib/api/domain/")});
log, {"lib/config/protos/", "lib/api/domain/", "lib/api/md/"});
}
void ConfigurationState::initialize_defaults(
@@ -545,10 +544,12 @@ void ConfigurationState::generate_all_config_proto(
// add a meta type and field for each generated message
proto::DescriptorPool::generated_pool();
auto find_proto_file = [&proto_dirs](const std::string &name) -> const proto::FileDescriptor * {
auto find_proto_file =
[&proto_dirs](const std::string &name) -> const proto::FileDescriptor * {
for (const auto &proto_dir : proto_dirs) {
const auto * res = proto::DescriptorPool::generated_pool()->FindFileByName(
proto_dir + name);
const auto *res =
proto::DescriptorPool::generated_pool()->FindFileByName(
proto_dir + name);
if (res != nullptr) {
return res;
}
@@ -615,8 +616,8 @@ bool is_valid_key_descriptor(const proto::Descriptor *property_desc) {
return false;
}
const proto::Message *
ConfigurationState::try_get_message(const std::string &property_name) {
const proto::Message *ConfigurationState::try_get_message(
const std::string &property_name) {
initialize_settings();
const proto::Message *message;
@@ -655,8 +656,8 @@ const proto::Message *ConfigurationState::try_get_message_or_default(
return nullptr;
}
const proto::Message &
ConfigurationState::get_message(const proto::Descriptor *property_desc) {
const proto::Message &ConfigurationState::get_message(
const proto::Descriptor *property_desc) {
if (!is_valid_key_descriptor(property_desc)) {
throw InvalidKeyException(property_desc->name().c_str());
}
@@ -711,8 +712,8 @@ const proto::Message *ConfigurationState::try_get_value(
return nullptr;
}
const google::protobuf::Descriptor *
ConfigurationState::get_descriptor_by_name(const std::string &name) {
const google::protobuf::Descriptor *ConfigurationState::get_descriptor_by_name(
const std::string &name) {
const proto::Message *pmsg = _defaults.get();
if (pmsg) {
// Get the metadata descriptor (Meta = rule+value fields)