Compare commits
1
Commits
development
...
v3.1.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ebd5a65e2 |
@@ -7,6 +7,8 @@
|
|||||||
#include "spark/md/GeneralMarketDataListener.h"
|
#include "spark/md/GeneralMarketDataListener.h"
|
||||||
#include "spark/md/GeneralSecurityIndex.h"
|
#include "spark/md/GeneralSecurityIndex.h"
|
||||||
#include "spark/md/MDProducer.h"
|
#include "spark/md/MDProducer.h"
|
||||||
|
#include "spark/md/SymbolLoader.h"
|
||||||
|
#include "spark/md/UserSymbol.h"
|
||||||
#include "spark/persistence/IDGenerator.h"
|
#include "spark/persistence/IDGenerator.h"
|
||||||
#include "sparkd/md/binance/BinanceSubscription.h"
|
#include "sparkd/md/binance/BinanceSubscription.h"
|
||||||
#include "sparkd/md/binance_us/BinanceUsSubscription.h"
|
#include "sparkd/md/binance_us/BinanceUsSubscription.h"
|
||||||
@@ -82,9 +84,23 @@ CCApiMarketDataProvider::get_sources() {
|
|||||||
"CCApiMarketDataProvider::get_sources failed. Invalid config: {}",
|
"CCApiMarketDataProvider::get_sources failed. Invalid config: {}",
|
||||||
fmt::to_string(fmt::join(cfg_errs, "\n")));
|
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
|
// Binance
|
||||||
for (const auto &binance : cfg.binance()) {
|
for (const auto &binance : cfg.binance()) {
|
||||||
|
if (!is_venue_enabled(api::domain::VENUE_BINANCE)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
me_->sources.emplace_back(
|
me_->sources.emplace_back(
|
||||||
api::domain::VENUE_BINANCE,
|
api::domain::VENUE_BINANCE,
|
||||||
std::make_shared<binance::BinanceSubscription>(
|
std::make_shared<binance::BinanceSubscription>(
|
||||||
@@ -92,6 +108,9 @@ CCApiMarketDataProvider::get_sources() {
|
|||||||
}
|
}
|
||||||
// Binance US
|
// Binance US
|
||||||
for (const auto &binance_us : cfg.binance_us()) {
|
for (const auto &binance_us : cfg.binance_us()) {
|
||||||
|
if (!is_venue_enabled(api::domain::VENUE_BINANCE_US)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
me_->sources.emplace_back(
|
me_->sources.emplace_back(
|
||||||
api::domain::VENUE_BINANCE_US,
|
api::domain::VENUE_BINANCE_US,
|
||||||
std::make_shared<binance_us::BinanceUsSubscription>(
|
std::make_shared<binance_us::BinanceUsSubscription>(
|
||||||
@@ -99,6 +118,9 @@ CCApiMarketDataProvider::get_sources() {
|
|||||||
}
|
}
|
||||||
// Binance USDS Futures
|
// Binance USDS Futures
|
||||||
for (const auto &binance_ufs : cfg.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(
|
me_->sources.emplace_back(
|
||||||
api::domain::VENUE_BINANCE_USDS_FUTURES,
|
api::domain::VENUE_BINANCE_USDS_FUTURES,
|
||||||
std::make_shared<
|
std::make_shared<
|
||||||
@@ -107,6 +129,9 @@ CCApiMarketDataProvider::get_sources() {
|
|||||||
}
|
}
|
||||||
// Coinbase
|
// Coinbase
|
||||||
for (const auto &coinbase : cfg.coinbase()) {
|
for (const auto &coinbase : cfg.coinbase()) {
|
||||||
|
if (!is_venue_enabled(api::domain::VENUE_COINBASE)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
me_->sources.emplace_back(
|
me_->sources.emplace_back(
|
||||||
api::domain::VENUE_COINBASE,
|
api::domain::VENUE_COINBASE,
|
||||||
std::make_shared<coinbase::CoinbaseSubscription>(
|
std::make_shared<coinbase::CoinbaseSubscription>(
|
||||||
@@ -114,6 +139,9 @@ CCApiMarketDataProvider::get_sources() {
|
|||||||
}
|
}
|
||||||
// Deribit
|
// Deribit
|
||||||
for (const auto &deribit : cfg.deribit()) {
|
for (const auto &deribit : cfg.deribit()) {
|
||||||
|
if (!is_venue_enabled(api::domain::VENUE_DERIBIT)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
me_->sources.emplace_back(
|
me_->sources.emplace_back(
|
||||||
api::domain::VENUE_DERIBIT,
|
api::domain::VENUE_DERIBIT,
|
||||||
std::make_shared<deribit::DeribitSubscription>(
|
std::make_shared<deribit::DeribitSubscription>(
|
||||||
@@ -121,6 +149,9 @@ CCApiMarketDataProvider::get_sources() {
|
|||||||
}
|
}
|
||||||
// FTX
|
// FTX
|
||||||
for (const auto &ftx : cfg.ftx()) {
|
for (const auto &ftx : cfg.ftx()) {
|
||||||
|
if (!is_venue_enabled(api::domain::VENUE_FTX)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
me_->sources.emplace_back(
|
me_->sources.emplace_back(
|
||||||
api::domain::VENUE_FTX,
|
api::domain::VENUE_FTX,
|
||||||
std::make_shared<ftx::FTXSubscription>(
|
std::make_shared<ftx::FTXSubscription>(
|
||||||
@@ -128,6 +159,9 @@ CCApiMarketDataProvider::get_sources() {
|
|||||||
}
|
}
|
||||||
// Okx
|
// Okx
|
||||||
for (const auto &okx : cfg.okx()) {
|
for (const auto &okx : cfg.okx()) {
|
||||||
|
if (!is_venue_enabled(api::domain::VENUE_OKX)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
me_->sources.emplace_back(
|
me_->sources.emplace_back(
|
||||||
api::domain::VENUE_OKX,
|
api::domain::VENUE_OKX,
|
||||||
std::make_shared<okx::OkxSubscription>(
|
std::make_shared<okx::OkxSubscription>(
|
||||||
|
|||||||
Reference in new issue
Block a user