Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ebd5a65e2 |
@@ -7,6 +7,8 @@
|
||||
#include "spark/md/GeneralMarketDataListener.h"
|
||||
#include "spark/md/GeneralSecurityIndex.h"
|
||||
#include "spark/md/MDProducer.h"
|
||||
#include "spark/md/SymbolLoader.h"
|
||||
#include "spark/md/UserSymbol.h"
|
||||
#include "spark/persistence/IDGenerator.h"
|
||||
#include "sparkd/md/binance/BinanceSubscription.h"
|
||||
#include "sparkd/md/binance_us/BinanceUsSubscription.h"
|
||||
@@ -82,9 +84,23 @@ CCApiMarketDataProvider::get_sources() {
|
||||
"CCApiMarketDataProvider::get_sources failed. Invalid config: {}",
|
||||
fmt::to_string(fmt::join(cfg_errs, "\n")));
|
||||
}
|
||||
|
||||
std::set<UserSymbol> syms;
|
||||
auto is_venue_enabled = [&syms](api::domain::Venue venue) {
|
||||
syms.clear();
|
||||
SymbolLoader::load(syms, domain::SecurityCriteria::create({venue}));
|
||||
if (syms.empty()) {
|
||||
LOG(md, Warn,
|
||||
R"([ccapi_md_pro_disabled.json]{{ "venue": "{}", "rsn": "No symbols config" }})",
|
||||
venue);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
// Binance
|
||||
for (const auto &binance : cfg.binance()) {
|
||||
if (!is_venue_enabled(api::domain::VENUE_BINANCE)) {
|
||||
continue;
|
||||
}
|
||||
me_->sources.emplace_back(
|
||||
api::domain::VENUE_BINANCE,
|
||||
std::make_shared<binance::BinanceSubscription>(
|
||||
@@ -92,6 +108,9 @@ CCApiMarketDataProvider::get_sources() {
|
||||
}
|
||||
// Binance US
|
||||
for (const auto &binance_us : cfg.binance_us()) {
|
||||
if (!is_venue_enabled(api::domain::VENUE_BINANCE_US)) {
|
||||
continue;
|
||||
}
|
||||
me_->sources.emplace_back(
|
||||
api::domain::VENUE_BINANCE_US,
|
||||
std::make_shared<binance_us::BinanceUsSubscription>(
|
||||
@@ -99,6 +118,9 @@ CCApiMarketDataProvider::get_sources() {
|
||||
}
|
||||
// Binance USDS Futures
|
||||
for (const auto &binance_ufs : cfg.binance_usds_futures()) {
|
||||
if (!is_venue_enabled(api::domain::VENUE_BINANCE_USDS_FUTURES)) {
|
||||
continue;
|
||||
}
|
||||
me_->sources.emplace_back(
|
||||
api::domain::VENUE_BINANCE_USDS_FUTURES,
|
||||
std::make_shared<
|
||||
@@ -107,6 +129,9 @@ CCApiMarketDataProvider::get_sources() {
|
||||
}
|
||||
// Coinbase
|
||||
for (const auto &coinbase : cfg.coinbase()) {
|
||||
if (!is_venue_enabled(api::domain::VENUE_COINBASE)) {
|
||||
continue;
|
||||
}
|
||||
me_->sources.emplace_back(
|
||||
api::domain::VENUE_COINBASE,
|
||||
std::make_shared<coinbase::CoinbaseSubscription>(
|
||||
@@ -114,6 +139,9 @@ CCApiMarketDataProvider::get_sources() {
|
||||
}
|
||||
// Deribit
|
||||
for (const auto &deribit : cfg.deribit()) {
|
||||
if (!is_venue_enabled(api::domain::VENUE_DERIBIT)) {
|
||||
continue;
|
||||
}
|
||||
me_->sources.emplace_back(
|
||||
api::domain::VENUE_DERIBIT,
|
||||
std::make_shared<deribit::DeribitSubscription>(
|
||||
@@ -121,6 +149,9 @@ CCApiMarketDataProvider::get_sources() {
|
||||
}
|
||||
// FTX
|
||||
for (const auto &ftx : cfg.ftx()) {
|
||||
if (!is_venue_enabled(api::domain::VENUE_FTX)) {
|
||||
continue;
|
||||
}
|
||||
me_->sources.emplace_back(
|
||||
api::domain::VENUE_FTX,
|
||||
std::make_shared<ftx::FTXSubscription>(
|
||||
@@ -128,6 +159,9 @@ CCApiMarketDataProvider::get_sources() {
|
||||
}
|
||||
// Okx
|
||||
for (const auto &okx : cfg.okx()) {
|
||||
if (!is_venue_enabled(api::domain::VENUE_OKX)) {
|
||||
continue;
|
||||
}
|
||||
me_->sources.emplace_back(
|
||||
api::domain::VENUE_OKX,
|
||||
std::make_shared<okx::OkxSubscription>(
|
||||
|
||||
Reference in new issue
Block a user