diff --git a/src/lib_spark/spark/md/MDConsumer.cpp b/src/lib_spark/spark/md/MDConsumer.cpp index 8b08730f0..77ea66cfa 100644 --- a/src/lib_spark/spark/md/MDConsumer.cpp +++ b/src/lib_spark/spark/md/MDConsumer.cpp @@ -599,30 +599,36 @@ class MDConsumerImpl { } LOG(md, Info, "Created MDConsumerImpl for securities: {}", msg.str()); + // Add non-spreads first for (auto &s : symbols) { - if (s.type() == SECURITYTYPE_FUTURE || - s.type() == SECURITYTYPE_OPTION || - s.type() == api::SECURITYTYPE_SPOT) { + switch (s.type()) { + case api::SECURITYTYPE_SPOT: + case api::SECURITYTYPE_FUTURE: + case api::SECURITYTYPE_OPTION: _instances.push_back(make_shared( s.symbol(), s.type(), s.exchange(), shared)); + break; + default: + break; } // TODO, add options here } bool has_synthetic_instance = false; for (auto &s : symbols) { - if (s.type() != SECURITYTYPE_FUTURE) { - if (s.type() == SECURITYTYPE_SYNTHETIC) { - // Should I look for the shared memory if we have a - // ISyntheticSecurityService? - if (has_synthetic_instance == false) { - _instances.push_back(make_shared( - SYNTHETIC_SYMBOL, s.type(), api::VENUE_BTS, shared)); - } - has_synthetic_instance = true; - } else { + switch (s.type()) { + case api::SECURITYTYPE_SYNTHETIC: + if (!has_synthetic_instance) { _instances.push_back(make_shared( - s.symbol(), s.type(), s.exchange(), shared)); + SYNTHETIC_SYMBOL, s.type(), api::VENUE_BTS, shared)); + has_synthetic_instance = true; } + break; + case api::SECURITYTYPE_SPREAD: + _instances.push_back(make_shared( + s.symbol(), s.type(), s.exchange(), shared)); + break; + default: + break; } }