MarketDataGateway still exists, but is greatly simplified. It creates several `IMarketDataProvider`s, each of which generates a list of `IMarketDataSource`s. The market data sources provide market data to an `IMarketDataListener`. * EmumbaMarketDataProvider * CCApiMarketDataProvider * PyMarketDataProvider * OnixsMarketDataProvider * ReplayMarketDataProvider As a side effect, individual py market data sources are now explicitly limited to a single venue (it probably should have been this way all along, since the shared memory writers do not expect updates to involve multiple venues).
53 lines
1.7 KiB
C++
53 lines
1.7 KiB
C++
#include "DatabentoMarketDataProvider.h"
|
|
#include "lib/api/domain/Venue.pb.h"
|
|
#include "lib/api/md/MarketDataConfig.pb.h"
|
|
#include "lib/persistence/IDGenerator.h"
|
|
#include "server/sparkd/md/IMarketDataSource.h"
|
|
#include "server/sparkd/md/databento/DatabentoDataHandler.h"
|
|
#include "server/sparkd/md/glbx/DatabentoGlbxSubscription.h"
|
|
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
namespace bts::md {
|
|
|
|
using bts::api::md::MarketDataConfig;
|
|
using bts::persistence::IDGenerator;
|
|
using std::pair;
|
|
using std::shared_ptr;
|
|
using std::string;
|
|
using std::vector;
|
|
|
|
struct DatabentoMarketDataProvider::PImpl {
|
|
MarketDataConfig config;
|
|
shared_ptr<IDGenerator> sec_id_store;
|
|
vector<shared_ptr<IMarketDataSource>> glbx_sources;
|
|
|
|
PImpl(MarketDataConfig config, shared_ptr<IDGenerator> sec_id_store)
|
|
: config(std::move(config)), sec_id_store(std::move(sec_id_store)) {}
|
|
};
|
|
|
|
DatabentoMarketDataProvider::DatabentoMarketDataProvider(
|
|
MarketDataConfig config, shared_ptr<IDGenerator> sec_id_store)
|
|
: me_(std::make_unique<PImpl>(std::move(config), std::move(sec_id_store))) {
|
|
me_->config = std::move(config);
|
|
}
|
|
|
|
DatabentoMarketDataProvider::~DatabentoMarketDataProvider() = default;
|
|
|
|
vector<pair<api::domain::Venue, shared_ptr<IMarketDataSource>>>
|
|
DatabentoMarketDataProvider::get_sources() {
|
|
vector<pair<api::domain::Venue, shared_ptr<IMarketDataSource>>> rv;
|
|
for (const auto &glbx : me_->config.glbx()) {
|
|
if (glbx.use_databento()) {
|
|
me_->glbx_sources.push_back(
|
|
std::make_shared<DatabentoGlbxSubscription>(
|
|
glbx, me_->sec_id_store));
|
|
rv.push_back({api::domain::VENUE_GLBX, me_->glbx_sources.back()});
|
|
}
|
|
}
|
|
return rv;
|
|
}
|
|
|
|
} // namespace bts::md
|