This new structure provides several benefits:
* Allows us to install multiple CMake projects in the same destination
dir (without include path conflicts).
- This makes shipping the trading algo sdk a trivial excercise. Simply
copy the lib and include dirs from the install dest. That's it!
* Puts us in a position to break up the monolithic libspark into smaller
modules, which are easier to manage.
Windows specific notes:
* Get rid of unnecessary script vs_filters.cmake
* Define WebsocketConnectionGateway directly in cs (instead of proto)
- The proto would no longer be in the include path passed to protoc.
Moving it to c# because there wasn't a compelling reason for it to
be a proto in the first place.
* Set spark output prefix to "lib" on windows
- So we get "libspark.dll" instead of "spark.dll", which conflicts
with the csharp lib, "Spark.dll".
* Copy libspark.dll to net8.0 & net8.0-windows in a single cmake build
target
fix build: Copy libspark to both dirs net8.0, net8.0-windows
53 lines
1.7 KiB
C++
53 lines
1.7 KiB
C++
#include "DatabentoMarketDataProvider.h"
|
|
#include "spark/api/domain/Venue.pb.h"
|
|
#include "spark/api/md/MarketDataConfig.pb.h"
|
|
#include "spark/md/IMarketDataSource.h"
|
|
#include "spark/persistence/IDGenerator.h"
|
|
#include "sparkd/md/databento/DatabentoDataHandler.h"
|
|
#include "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
|