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
42 lines
1.4 KiB
C++
42 lines
1.4 KiB
C++
#include "DatabentoGlbxSubscription.h"
|
|
#include "spark/api/md/GlbxMarketDataConfig.pb.h"
|
|
#include "spark/utils/thread_manager.h"
|
|
#include "sparkd/md/databento/DatabentoDataHandler.h"
|
|
#include "sparkd/md/glbx/GlbxMarketDataHandler.h"
|
|
|
|
namespace bts::md {
|
|
|
|
using bts::api::md::GlbxMarketDataConfig;
|
|
using bts::persistence::IDGenerator;
|
|
using std::shared_ptr;
|
|
|
|
struct DatabentoGlbxSubscription::PImpl {
|
|
GlbxMarketDataConfig config;
|
|
shared_ptr<IDGenerator> sec_id_store;
|
|
|
|
PImpl(GlbxMarketDataConfig config, shared_ptr<IDGenerator> sec_id_store)
|
|
: config(std::move(config)), sec_id_store(std::move(sec_id_store)) {}
|
|
};
|
|
|
|
DatabentoGlbxSubscription::DatabentoGlbxSubscription(
|
|
GlbxMarketDataConfig config, shared_ptr<IDGenerator> sec_id_store)
|
|
: me_(std::make_unique<PImpl>(std::move(config), std::move(sec_id_store))) {
|
|
}
|
|
|
|
DatabentoGlbxSubscription::~DatabentoGlbxSubscription() = default;
|
|
|
|
void DatabentoGlbxSubscription::start(
|
|
std::shared_ptr<IMarketDataListener> listener) {
|
|
bts::threading::make_thread(
|
|
"glbx",
|
|
[config = me_->config, sec_id_store = me_->sec_id_store,
|
|
listener = std::move(listener)]() {
|
|
api::md::glbx::GlbxMarketDatahandler::run(
|
|
std::move(listener), std::move(sec_id_store), config);
|
|
})
|
|
.detach();
|
|
// TODO: implement 'stop' (signal the thread above to terminate, then join it).
|
|
}
|
|
|
|
} // namespace bts::md
|