48 lines
1.3 KiB
C++
48 lines
1.3 KiB
C++
#include "OnixsMarketDataProvider.h"
|
|
#include "core_md/Venue.pb.h"
|
|
#include "spark/config/config.h"
|
|
#include "spark/persistence/IDGenerator.h"
|
|
#include "sparkd/md/glbx/OnixsGlbxSubscription.h"
|
|
|
|
#include <boost/filesystem.hpp>
|
|
#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;
|
|
|
|
using Path = boost::filesystem::path;
|
|
|
|
struct OnixsMarketDataProvider::PImpl {
|
|
MarketDataConfig config;
|
|
IDGenerator &sec_id_store = IDGenerator::instance();
|
|
shared_ptr<OnixsGlbxSubscription> source;
|
|
};
|
|
|
|
OnixsMarketDataProvider::OnixsMarketDataProvider()
|
|
: bts::md::OnixsMarketDataProvider(bts::config::get<MarketDataConfig>()) {}
|
|
|
|
OnixsMarketDataProvider::OnixsMarketDataProvider(MarketDataConfig config)
|
|
: me_(std::make_unique<PImpl>()) {
|
|
me_->config = std::move(config);
|
|
}
|
|
|
|
OnixsMarketDataProvider::~OnixsMarketDataProvider() = default;
|
|
|
|
vector<pair<core_md::Venue, shared_ptr<IMarketDataSource>>>
|
|
OnixsMarketDataProvider::get_sources() {
|
|
vector<pair<core_md::Venue, shared_ptr<IMarketDataSource>>> rv;
|
|
me_->source =
|
|
std::make_shared<OnixsGlbxSubscription>(&me_->sec_id_store, me_->config);
|
|
rv.push_back({core_md::VENUE_GLBX, me_->source});
|
|
return rv;
|
|
}
|
|
|
|
} // namespace bts::md
|