refactor: Move domain types into new lib_domain
Also rename files in snake_case (standard naming convention for protos) https://protobuf.dev/programming-guides/style/
This commit is contained in:
1 parent
b48bfbae79
commit
edda8ae20c
197 files changed
+1617
-1426
No files matched your search
@@ -105,6 +105,7 @@ else()
|
||||
# subdirs
|
||||
if (BUILD_SPARKD)
|
||||
add_subdirectory(src/lib_system)
|
||||
add_subdirectory(src/lib_domain)
|
||||
add_subdirectory(src/lib_python_md)
|
||||
add_subdirectory(src/app_sparkd)
|
||||
add_subdirectory(src/data_files)
|
||||
|
||||
@@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.5)
|
||||
project(Spark.Admin.WebApp)
|
||||
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/safe_dep_glob.cmake)
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/Protobuf.cmake)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# dependencies
|
||||
set(PROTO_GLOBS
|
||||
../lib_domain/domain/*.proto
|
||||
../lib_spark/spark/api/*.proto
|
||||
../lib_spark/spark/api/services/*.proto
|
||||
../lib_spark/spark/domain_model/*.proto
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "Run.h"
|
||||
#include "Cleanup.h"
|
||||
#include "domain/security_criteria.h"
|
||||
#include "spark/api/md/MarketDataConfig.pb.h"
|
||||
#include "spark/config/protos/market_data.pb.h"
|
||||
#include "spark/domain/SecurityCriteria.h"
|
||||
#include "spark/logging/logging.h"
|
||||
#include "spark/md/SymbolLoader.h"
|
||||
#include "spark/md/UserSymbol.h"
|
||||
@@ -62,8 +62,8 @@ static void run_onixs(
|
||||
os::get_thread_name());
|
||||
std::vector<std::shared_ptr<bts::md::IMDPlatform>> platforms;
|
||||
// get all glbx symbols
|
||||
auto cme_symbols =
|
||||
SymbolLoader::load(SecurityCriteria::create({api::domain::VENUE_GLBX}));
|
||||
auto cme_symbols = SymbolLoader::load(
|
||||
SecurityCriteria::create({domain::protobufs::VENUE_GLBX}));
|
||||
if (!cme_symbols.empty()) {
|
||||
auto *main = new bts::md::MDP3Main();
|
||||
main->start(
|
||||
@@ -71,8 +71,8 @@ static void run_onixs(
|
||||
platforms.emplace_back(main);
|
||||
}
|
||||
// ice
|
||||
const auto ice_symbols =
|
||||
SymbolLoader::load(SecurityCriteria::create({api::domain::VENUE_ICE}));
|
||||
const auto ice_symbols = SymbolLoader::load(
|
||||
SecurityCriteria::create({domain::protobufs::VENUE_ICE}));
|
||||
if (!ice_symbols.empty()) {
|
||||
auto *imain = new bts::md::ice::ICEMain();
|
||||
imain->start({ice_symbols.begin(), ice_symbols.end()});
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
#include "Tail.h"
|
||||
#include "spark/api/domain/SecurityType.pb.h"
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "spark/config/protos/market_data.pb.h"
|
||||
#include "spark/domain/SecurityCriteria.h"
|
||||
#include "domain/protobufs/security_type.pb.h"
|
||||
#include "domain/security_criteria.h"
|
||||
#include "spark/md/Diag/MDPeriodicDumper.h"
|
||||
#include "spark/md/Diag/ShmDumper.h"
|
||||
#include "spark/md/SymbolLoader.h"
|
||||
#include "spark/md/UserSymbol.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace bts::cmds::md::cmds {
|
||||
@@ -44,7 +41,7 @@ Tail::Tail()
|
||||
|
||||
callback([&] {
|
||||
const auto products = SymbolLoader::load(SecurityCriteria::create(
|
||||
{}, {bts::api::domain::SECURITY_TYPE_FUTURE}));
|
||||
{}, {domain::protobufs::SECURITY_TYPE_FUTURE}));
|
||||
bts::md::run_periodic_dumper(
|
||||
products, _args->mod, _args->format, _args->all, _args->qualifier);
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "domain/protobufs/venue.pb.h"
|
||||
#include "sparkd/md/IMarketDataSource.h"
|
||||
|
||||
#include <vector>
|
||||
@@ -18,7 +18,7 @@ class IMarketDataProvider {
|
||||
virtual ~IMarketDataProvider();
|
||||
|
||||
virtual std::vector<
|
||||
std::pair<bts::api::domain::Venue, std::shared_ptr<IMarketDataSource>>>
|
||||
std::pair<domain::protobufs::Venue, std::shared_ptr<IMarketDataSource>>>
|
||||
get_sources() = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "MarketDataGateway.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "spark/api/md/MarketDataConfig.pb.h"
|
||||
#include "spark/api/md/MarketDataConfigUtils.h"
|
||||
#include "spark/core/FMT.h"
|
||||
#include "spark/domain/DomainSecurityUtils.h"
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "spark/logging/logging.h"
|
||||
#include "spark/md/GeneralMarketDataListener.h"
|
||||
#include "spark/md/GeneralSecurityIndex.h"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/md/IMarketDataListener.h"
|
||||
#include "spark/domain/Book.h"
|
||||
#include "spark/domain/Security.h"
|
||||
#include "domain/book.h"
|
||||
#include "domain/security.h"
|
||||
#include "domain/security_state.h"
|
||||
#include "spark/domain/SecurityMarketDataStatistics.h"
|
||||
#include "spark/domain/SecurityState.h"
|
||||
#include "spark/domain/TradeRecord.h"
|
||||
#include "spark/md/IMarketDataListener.h"
|
||||
#include "sparkd/md/MarketDataError.h"
|
||||
|
||||
namespace bts::md {
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
#include "OnixsMarketDataProvider.h"
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "domain/protobufs/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::domain::Venue;
|
||||
using bts::api::md::MarketDataConfig;
|
||||
using bts::domain::protobufs::Venue;
|
||||
using bts::md::OnixsMarketDataProvider;
|
||||
using bts::persistence::IDGenerator;
|
||||
using std::pair;
|
||||
|
||||
@@ -14,8 +14,7 @@ class OnixsMarketDataProvider : public IMarketDataProvider {
|
||||
explicit OnixsMarketDataProvider(api::md::MarketDataConfig config);
|
||||
~OnixsMarketDataProvider();
|
||||
|
||||
std::vector<
|
||||
std::pair<bts::api::domain::Venue, std::shared_ptr<IMarketDataSource>>>
|
||||
std::vector<std::pair<domain::protobufs::Venue, std::shared_ptr<IMarketDataSource>>>
|
||||
get_sources() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -35,31 +35,25 @@ PyMarketDataProvider::PyMarketDataProvider(
|
||||
|
||||
PyMarketDataProvider::~PyMarketDataProvider() = default;
|
||||
|
||||
vector<pair<api::domain::Venue, shared_ptr<IMarketDataSource>>>
|
||||
vector<pair<domain::protobufs::Venue, shared_ptr<IMarketDataSource>>>
|
||||
PyMarketDataProvider::get_sources() {
|
||||
vector<pair<api::domain::Venue, shared_ptr<IMarketDataSource>>> rv;
|
||||
vector<pair<domain::protobufs::Venue, shared_ptr<IMarketDataSource>>> rv;
|
||||
const Path wd{sparkd_wd()};
|
||||
vector<string> module_paths{
|
||||
wd.string(),
|
||||
(wd / "python_md_providers").string(),
|
||||
};
|
||||
for (const auto &py_plugin : me_->config.python_md_providers()) {
|
||||
try {
|
||||
vector<string> module_path;
|
||||
for (const auto &p : py_plugin.module_path()) {
|
||||
module_path.emplace_back(p);
|
||||
}
|
||||
auto source = std::make_shared<PyMarketDataSubscription>(
|
||||
py_plugin.provider_type(), module_path, me_->sec_id_store.get());
|
||||
me_->py_md_subs.push_back(source);
|
||||
rv.push_back(
|
||||
std::make_pair<api::domain::Venue, shared_ptr<IMarketDataSource>>(
|
||||
py_plugin.venue(), source));
|
||||
} catch (const std::exception &ex) {
|
||||
bts_assert_msgf(
|
||||
false, "PyMarketDataSubscription threw: {}",
|
||||
std::string{ex.what()});
|
||||
vector<string> module_path;
|
||||
for (const auto &p : py_plugin.module_path()) {
|
||||
module_path.emplace_back(p);
|
||||
}
|
||||
auto source = std::make_shared<PyMarketDataSubscription>(
|
||||
py_plugin.provider_type(), module_path, me_->sec_id_store);
|
||||
me_->py_md_subs.push_back(source);
|
||||
rv.push_back(std::make_pair<
|
||||
domain::protobufs::Venue, shared_ptr<IMarketDataSource>>(
|
||||
py_plugin.venue(), source));
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ class PyMarketDataProvider : public IMarketDataProvider {
|
||||
~PyMarketDataProvider();
|
||||
|
||||
std::vector<
|
||||
std::pair<api::domain::Venue, std::shared_ptr<IMarketDataSource>>>
|
||||
std::pair<domain::protobufs::Venue, std::shared_ptr<IMarketDataSource>>>
|
||||
get_sources() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
#include "PyMarketDataSubscription.h"
|
||||
#include "domain/aggressor_side.h"
|
||||
#include "domain/future_security.h"
|
||||
#include "domain/protobufs/call_put.pb.h"
|
||||
#include "domain/protobufs/venue.h"
|
||||
#include "domain/security.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "domain/spot_security.h"
|
||||
#include "python_md/md_sink.h"
|
||||
#include "python_md/py_book.h"
|
||||
#include "python_md/py_md_executor.h"
|
||||
#include "python_md/py_security.h"
|
||||
#include "python_md/py_security_list.h"
|
||||
#include "python_md/py_trade.h"
|
||||
#include "spark/api/domain/CallPut.pb.h"
|
||||
#include "spark/api/domain/Venue.h"
|
||||
#include "spark/core/TimeStamp.h"
|
||||
#include "spark/domain/AggressorSide.h"
|
||||
#include "spark/domain/FutureSecurity.h"
|
||||
#include "spark/domain/Security.h"
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "spark/domain/SpotSecurity.h"
|
||||
#include "spark/domain/TradeRecord.h"
|
||||
#include "spark/logging/logging.h"
|
||||
#include "spark/md/IMarketDataListener.h"
|
||||
@@ -46,16 +46,18 @@ using Path = boost::filesystem::path;
|
||||
struct TradeTuple {
|
||||
py_interop::PyTrade py_trade;
|
||||
domain::TradeRecord trade;
|
||||
api::domain::Venue venue;
|
||||
domain::protobufs::Venue venue;
|
||||
};
|
||||
|
||||
struct PyMarketDataSubscription::PImpl : private py_interop::MdSink {
|
||||
PImpl(
|
||||
string py_plugin, vector<string> module_paths, IDGenerator *sec_id_store)
|
||||
string py_plugin,
|
||||
vector<string> module_paths,
|
||||
std::shared_ptr<IDGenerator> sec_id_store)
|
||||
: py_plugin_(std::move(py_plugin)),
|
||||
module_paths_(std::move(module_paths)),
|
||||
py_md_exec_(py_plugin_, module_paths_, this),
|
||||
sec_id_store_(sec_id_store) {}
|
||||
sec_id_store_(std::move(sec_id_store)) {}
|
||||
|
||||
void start(shared_ptr<IMarketDataListener> listener) {
|
||||
bts_assert(listener != nullptr);
|
||||
@@ -73,7 +75,7 @@ struct PyMarketDataSubscription::PImpl : private py_interop::MdSink {
|
||||
PyMdExecutor py_md_exec_;
|
||||
shared_ptr<IMarketDataListener> listener_;
|
||||
|
||||
IDGenerator *sec_id_store_;
|
||||
std::shared_ptr<IDGenerator> sec_id_store_;
|
||||
// The main store for securities.
|
||||
vector<domain::Security> securities_;
|
||||
vector<const domain::Security *> security_ptrs_;
|
||||
@@ -142,11 +144,11 @@ struct PyMarketDataSubscription::PImpl : private py_interop::MdSink {
|
||||
}
|
||||
|
||||
SecurityID get_sec_id_(const string &venue_name, const string &sec_name) {
|
||||
api::domain::Venue venue;
|
||||
domain::protobufs::Venue venue;
|
||||
// Although an overload of 'get_id' accepts a string, we parse `venue_name` to the enum to
|
||||
// normalize different spellings of the same venue. For example, "deribt", "DERIBIT", and
|
||||
// "VENUE_deribit" all represent the VENUE_DERIBIT enum (see `venue_parse_smart` for details).
|
||||
bts_assert(api::domain::venue_parse_smart(venue_name, &venue));
|
||||
bts_assert(domain::protobufs::venue_parse_smart(venue_name, &venue));
|
||||
auto sec_id = sec_id_store_->get_id(venue, sec_name, true);
|
||||
bts_assert_msgf(
|
||||
sec_id, "Failed to get security id for py_book. venue: {}; name: {}",
|
||||
@@ -161,7 +163,8 @@ struct PyMarketDataSubscription::PImpl : private py_interop::MdSink {
|
||||
bts_assert(py_sec.id() == 0);
|
||||
domain::Security sec;
|
||||
auto &sec_comm = sec.security_common;
|
||||
if (!api::domain::venue_parse_smart(py_sec.venue(), &sec_comm.venue)) {
|
||||
if (!domain::protobufs::venue_parse_smart(
|
||||
py_sec.venue(), &sec_comm.venue)) {
|
||||
LOG(md, Error, "Failed to parse venue from '{}'", py_sec.venue());
|
||||
return std::nullopt;
|
||||
}
|
||||
@@ -186,8 +189,8 @@ struct PyMarketDataSubscription::PImpl : private py_interop::MdSink {
|
||||
domain::OptionSecurity opt;
|
||||
const auto &py_opt = py_sec.option();
|
||||
opt.expiration = core::TimeStamp::from_iso_string(py_opt.expiration());
|
||||
opt.call_put = py_opt.is_call() ? api::domain::CallPut::CALL
|
||||
: api::domain::CallPut::PUT;
|
||||
opt.call_put = py_opt.is_call() ? domain::protobufs::CallPut::CALL
|
||||
: domain::protobufs::CallPut::PUT;
|
||||
opt.strike = domain::Price::from_double(py_opt.strike());
|
||||
sec.security = std::move(opt);
|
||||
} else {
|
||||
@@ -232,9 +235,13 @@ struct PyMarketDataSubscription::PImpl : private py_interop::MdSink {
|
||||
};
|
||||
|
||||
PyMarketDataSubscription::PyMarketDataSubscription(
|
||||
string py_plugin, vector<string> module_paths, IDGenerator *sec_id_store)
|
||||
string py_plugin,
|
||||
vector<string> module_paths,
|
||||
shared_ptr<IDGenerator> sec_id_store)
|
||||
: me_(std::make_unique<PyMarketDataSubscription::PImpl>(
|
||||
std::move(py_plugin), std::move(module_paths), sec_id_store)) {}
|
||||
std::move(py_plugin),
|
||||
std::move(module_paths),
|
||||
std::move(sec_id_store))) {}
|
||||
|
||||
PyMarketDataSubscription::~PyMarketDataSubscription() { me_->stop(); }
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class PyMarketDataSubscription : public IMarketDataSource {
|
||||
explicit PyMarketDataSubscription(
|
||||
std::string py_plugin,
|
||||
std::vector<std::string> module_paths,
|
||||
persistence::IDGenerator *sec_id_store);
|
||||
std::shared_ptr<persistence::IDGenerator> sec_id_store);
|
||||
~PyMarketDataSubscription();
|
||||
|
||||
void start(std::shared_ptr<IMarketDataListener> listener) override;
|
||||
|
||||
@@ -21,7 +21,8 @@ using std::vector;
|
||||
struct ReplayMarketDataProvider::PImpl {
|
||||
MarketDataConfig config;
|
||||
shared_ptr<IDGenerator> sec_id_store;
|
||||
vector<pair<api::domain::Venue, shared_ptr<IMarketDataSource>>> sources;
|
||||
vector<pair<domain::protobufs::Venue, shared_ptr<IMarketDataSource>>>
|
||||
sources;
|
||||
|
||||
PImpl(MarketDataConfig config, shared_ptr<IDGenerator> sec_id_store)
|
||||
: config(std::move(config)), sec_id_store(std::move(sec_id_store)) {}
|
||||
@@ -38,7 +39,7 @@ ReplayMarketDataProvider::ReplayMarketDataProvider(
|
||||
|
||||
ReplayMarketDataProvider::~ReplayMarketDataProvider() = default;
|
||||
|
||||
vector<pair<api::domain::Venue, shared_ptr<IMarketDataSource>>>
|
||||
vector<pair<domain::protobufs::Venue, shared_ptr<IMarketDataSource>>>
|
||||
ReplayMarketDataProvider::get_sources() {
|
||||
const auto replay_cfgs =
|
||||
MarketDataConfigUtils::get_effective_replay_config(me_->config);
|
||||
|
||||
@@ -17,7 +17,7 @@ class ReplayMarketDataProvider : public IMarketDataProvider {
|
||||
~ReplayMarketDataProvider();
|
||||
|
||||
std::vector<
|
||||
std::pair<bts::api::domain::Venue, std::shared_ptr<IMarketDataSource>>>
|
||||
std::pair<domain::protobufs::Venue, std::shared_ptr<IMarketDataSource>>>
|
||||
get_sources() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/io/JsonReader.h"
|
||||
#include "spark/logging/logging.h"
|
||||
#include "sparkd/md/binance/BinanceFilterType.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "sparkd/md/ccapi/ICCApiMessageHandler.h"
|
||||
|
||||
namespace bts::md {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#ifdef SPARK_ENABLE_CCAPI
|
||||
#include "spark/api/domain/SecurityType.pb.h"
|
||||
#include "domain/protobufs/security_type.pb.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <ostream>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#ifdef SPARK_ENABLE_CCAPI
|
||||
#include "BinanceMiniTickerUpdate.h"
|
||||
#include "domain/price.h"
|
||||
#include "domain/quantity.h"
|
||||
#include "spark/core/TimeStamp.h"
|
||||
#include "spark/domain/Price.h"
|
||||
#include "spark/domain/Quantity.h"
|
||||
#include "spark/domain/SecurityMarketDataStatistics.h"
|
||||
#include "spark/io/JsonDumper.h"
|
||||
#include "spark/io/JsonReader.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "BinancePriceStatistics.h"
|
||||
#include "domain/price.h"
|
||||
#include "domain/quantity.h"
|
||||
#include "spark/core/TimeStamp.h"
|
||||
#include "spark/domain/Price.h"
|
||||
#include "spark/domain/Quantity.h"
|
||||
#include "spark/domain/SecurityMarketDataStatistics.h"
|
||||
#include "spark/io/JsonDumper.h"
|
||||
#include "spark/io/JsonReader.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "BinancePriceStatisticsAdaptor.h"
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "spark/domain/SecurityMarketDataStatistics.h"
|
||||
#include "spark/md/IMarketDataListener.h"
|
||||
#include "spark/utils/bts_fatal.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "sparkd/md/ccapi/ICCApiMessageHandler.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/api/domain/Currency.pb.h"
|
||||
#include "domain/protobufs/currency.pb.h"
|
||||
#include "spark/core/EnumMacros.h"
|
||||
#include "spark/core/FMT_IMPL.h"
|
||||
|
||||
@@ -60,7 +60,7 @@ class BinanceQuoteAsset {
|
||||
|
||||
ENUM_BASIC_MEMBERS(BinanceQuoteAsset)
|
||||
|
||||
constexpr api::domain::Currency to_currency() const;
|
||||
constexpr domain::protobufs::Currency to_currency() const;
|
||||
};
|
||||
|
||||
ENUM_OUTPUT_OPS(BinanceQuoteAsset)
|
||||
@@ -75,18 +75,18 @@ ENUM_EQUALITY_OPS(BinanceQuoteAsset)
|
||||
// Definition
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
constexpr api::domain::Currency BinanceQuoteAsset::to_currency() const {
|
||||
constexpr domain::protobufs::Currency BinanceQuoteAsset::to_currency() const {
|
||||
switch (value) {
|
||||
case BTC:
|
||||
return api::domain::Currency::BTC;
|
||||
return domain::protobufs::Currency::BTC;
|
||||
case ETH:
|
||||
return api::domain::Currency::ETH;
|
||||
return domain::protobufs::Currency::ETH;
|
||||
case USDC:
|
||||
case USDP:
|
||||
case USDS:
|
||||
case USDT:
|
||||
default:
|
||||
return api::domain::Currency::USD;
|
||||
return domain::protobufs::Currency::USD;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "BinanceSecurityRequestor.h"
|
||||
#include "spark/api/domain/SecurityType.pb.h"
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "spark/domain/Security.h"
|
||||
#include "spark/domain/SecurityCriteria.h"
|
||||
#include "domain/protobufs/security_type.pb.h"
|
||||
#include "domain/protobufs/venue.pb.h"
|
||||
#include "domain/security.h"
|
||||
#include "domain/security_criteria.h"
|
||||
#include "spark/logging/logging.h"
|
||||
#include "spark/persistence/IDGenerator.h"
|
||||
#include "spark/utils/bts_fatal.h"
|
||||
@@ -26,12 +26,12 @@
|
||||
|
||||
namespace bts::md::binance {
|
||||
|
||||
using api::domain::SecurityType;
|
||||
using api::domain::Venue;
|
||||
using api::domain::Venue_Name;
|
||||
using bts::domain::Security;
|
||||
using bts::domain::SecurityCriteria;
|
||||
using bts::domain::SecurityID;
|
||||
using bts::domain::protobufs::SecurityType;
|
||||
using bts::domain::protobufs::Venue;
|
||||
using bts::domain::protobufs::Venue_Name;
|
||||
using bts::persistence::IDGenerator;
|
||||
using std::string;
|
||||
using std::unordered_set;
|
||||
@@ -53,7 +53,7 @@ using std::vector;
|
||||
#define CCAPI_VENUE_NAME CCAPI_EXCHANGE_NAME_BINANCE
|
||||
#define BINANCE_MSG_TYPE_NAME(x) \
|
||||
std::string { BinanceMessageType{x}.name() }
|
||||
#define SEC_TYPE(x) bts::api::domain::SECURITY_TYPE_##x
|
||||
#define SEC_TYPE(x) bts::domain::protobufs::SECURITY_TYPE_##x
|
||||
|
||||
static ccapi::Request exchange_info_req() {
|
||||
auto corr_id = CCApiCorrelationID::from_parts(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "BinanceSpot.h"
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "spark/domain/Quantity.h"
|
||||
#include "spark/domain/Security.h"
|
||||
#include "domain/protobufs/venue.pb.h"
|
||||
#include "domain/quantity.h"
|
||||
#include "domain/security.h"
|
||||
#include "spark/io/JsonReader.h"
|
||||
#include "spark/logging/logging.h"
|
||||
|
||||
@@ -12,15 +12,15 @@
|
||||
|
||||
namespace bts::md::binance {
|
||||
|
||||
using bts::api::domain::Venue;
|
||||
using bts::domain::Quantity;
|
||||
using bts::domain::Security;
|
||||
using bts::domain::SpotSecurity;
|
||||
using bts::domain::protobufs::Venue;
|
||||
using bts::io::JsonReader;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
#define SEC_TYPE(x) bts::api::domain::SECURITY_TYPE_##x
|
||||
#define SEC_TYPE(x) bts::domain::protobufs::SECURITY_TYPE_##x
|
||||
|
||||
static std::string deduce_sym_from_name(const std::string &name) {
|
||||
std::regex word_regex("(\\w+)");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/api/domain/Venue.h"
|
||||
#include "domain/protobufs/venue.h"
|
||||
#include "spark/core/FMT_IMPL.h"
|
||||
#include "spark/io/JsonMacros.h"
|
||||
#include "sparkd/md/binance/BinanceFilterTuple.h"
|
||||
@@ -50,7 +50,7 @@ class BinanceSpot {
|
||||
static void parse(
|
||||
const ccapi::Message &msg,
|
||||
std::vector<domain::Security> &securities,
|
||||
api::domain::Venue venue = api::domain::Venue::VENUE_BINANCE);
|
||||
domain::protobufs::Venue venue = domain::protobufs::VENUE_BINANCE);
|
||||
};
|
||||
|
||||
void from_json(const nlohmann::json &j, BinanceSpot &spot);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "BinanceSubscription.h"
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "domain/protobufs/venue.pb.h"
|
||||
#include "domain/security.h"
|
||||
#include "domain/security_criteria.h"
|
||||
#include "spark/api/md/BinanceMarketDataConfig.pb.h"
|
||||
#include "spark/core/FMT.h"
|
||||
#include "spark/domain/Security.h"
|
||||
#include "spark/domain/SecurityCriteria.h"
|
||||
#include "spark/io/ProtoPrinter.h"
|
||||
#include "spark/io/QueryParams.h"
|
||||
#include "spark/logging/logging.h"
|
||||
@@ -34,12 +34,12 @@
|
||||
|
||||
namespace bts::md::binance {
|
||||
|
||||
using bts::api::domain::Venue;
|
||||
using bts::api::domain::Venue_Name;
|
||||
using bts::api::md::BinanceMarketDataConfig;
|
||||
using bts::domain::Security;
|
||||
using bts::domain::SecurityCriteria;
|
||||
using bts::domain::SecurityID;
|
||||
using bts::domain::protobufs::Venue;
|
||||
using bts::domain::protobufs::Venue_Name;
|
||||
using bts::io::ProtoPrinter;
|
||||
using bts::io::QueryParams;
|
||||
using bts::persistence::IDGenerator;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "BinanceUsPriceStatistics.h"
|
||||
#include "domain/price.h"
|
||||
#include "domain/quantity.h"
|
||||
#include "spark/core/TimeStamp.h"
|
||||
#include "spark/domain/Price.h"
|
||||
#include "spark/domain/Quantity.h"
|
||||
#include "spark/domain/SecurityMarketDataStatistics.h"
|
||||
#include "spark/io/JsonDumper.h"
|
||||
#include "spark/io/JsonReader.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "BinanceUsPriceStatisticsAdaptor.h"
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "spark/domain/SecurityMarketDataStatistics.h"
|
||||
#include "spark/md/IMarketDataListener.h"
|
||||
#include "spark/utils/bts_fatal.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "sparkd/md/ccapi/ICCApiMessageHandler.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "BinanceUsSecurityRequestor.h"
|
||||
#include "spark/api/domain/SecurityType.pb.h"
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "spark/domain/Security.h"
|
||||
#include "spark/domain/SecurityCriteria.h"
|
||||
#include "domain/protobufs/security_type.pb.h"
|
||||
#include "domain/protobufs/venue.pb.h"
|
||||
#include "domain/security.h"
|
||||
#include "domain/security_criteria.h"
|
||||
#include "spark/logging/logging.h"
|
||||
#include "spark/persistence/IDGenerator.h"
|
||||
#include "sparkd/md/binance_us/BinanceUsMessageType.h"
|
||||
@@ -25,12 +25,12 @@
|
||||
|
||||
namespace bts::md::binance_us {
|
||||
|
||||
using api::domain::SecurityType;
|
||||
using api::domain::Venue;
|
||||
using api::domain::Venue_Name;
|
||||
using bts::domain::Security;
|
||||
using bts::domain::SecurityCriteria;
|
||||
using bts::domain::SecurityID;
|
||||
using bts::domain::protobufs::SecurityType;
|
||||
using bts::domain::protobufs::Venue;
|
||||
using bts::domain::protobufs::Venue_Name;
|
||||
using bts::persistence::IDGenerator;
|
||||
using std::string;
|
||||
using std::unordered_set;
|
||||
@@ -41,7 +41,7 @@ using std::vector;
|
||||
#define CCAPI_VENUE_NAME CCAPI_EXCHANGE_NAME_BINANCE_US
|
||||
#define BINANCE_US_MSG_TYPE_NAME(x) \
|
||||
std::string { BinanceUsMessageType{x}.name() }
|
||||
#define SEC_TYPE(x) bts::api::domain::SECURITY_TYPE_##x
|
||||
#define SEC_TYPE(x) bts::domain::protobufs::SECURITY_TYPE_##x
|
||||
|
||||
static ccapi::Request exchange_info_req() {
|
||||
auto corr_id = CCApiCorrelationID::from_parts(
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "BinanceUsSubscription.h"
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "domain/protobufs/venue.pb.h"
|
||||
#include "domain/security.h"
|
||||
#include "domain/security_criteria.h"
|
||||
#include "spark/api/md/BinanceUsMarketDataConfig.pb.h"
|
||||
#include "spark/core/FMT.h"
|
||||
#include "spark/io/ProtoPrinter.h"
|
||||
@@ -34,12 +36,12 @@
|
||||
|
||||
namespace bts::md::binance_us {
|
||||
|
||||
using bts::api::domain::Venue;
|
||||
using bts::api::domain::Venue_Name;
|
||||
using bts::api::md::BinanceUsMarketDataConfig;
|
||||
using bts::domain::Security;
|
||||
using bts::domain::SecurityCriteria;
|
||||
using bts::domain::SecurityID;
|
||||
using bts::domain::protobufs::Venue;
|
||||
using bts::domain::protobufs::Venue_Name;
|
||||
using bts::io::ProtoPrinter;
|
||||
using bts::io::QueryParams;
|
||||
using bts::persistence::IDGenerator;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "BinanceUsdsFuture.h"
|
||||
#include "spark/domain/Price.h"
|
||||
#include "spark/domain/Quantity.h"
|
||||
#include "spark/domain/Security.h"
|
||||
#include "domain/price.h"
|
||||
#include "domain/quantity.h"
|
||||
#include "domain/security.h"
|
||||
#include "spark/io/JsonDumper.h"
|
||||
#include "spark/io/JsonReader.h"
|
||||
#include "spark/logging/logging.h"
|
||||
@@ -12,18 +12,18 @@
|
||||
|
||||
namespace bts::md::binance_usds_futures {
|
||||
|
||||
using bts::api::domain::SecurityType;
|
||||
using bts::domain::FutureSecurity;
|
||||
using bts::domain::Price;
|
||||
using bts::domain::Quantity;
|
||||
using bts::domain::Security;
|
||||
using bts::domain::protobufs::SecurityType;
|
||||
using bts::io::JsonDumper;
|
||||
using bts::io::JsonReader;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
#define SEC_TYPE(x) bts::api::domain::SECURITY_TYPE_##x
|
||||
#define VENUE api::domain::Venue::VENUE_BINANCE_USDS_FUTURES;
|
||||
#define SEC_TYPE(x) bts::domain::protobufs::SECURITY_TYPE_##x
|
||||
#define VENUE bts::domain::protobufs::VENUE_BINANCE_USDS_FUTURES;
|
||||
|
||||
static string deduce_sym_from_name(const string &name) {
|
||||
const std::regex word_regex("(\\w+)");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "BinanceUsdsFuturesPriceStatistics.h"
|
||||
#include "spark/domain/Price.h"
|
||||
#include "spark/domain/Quantity.h"
|
||||
#include "domain/price.h"
|
||||
#include "domain/quantity.h"
|
||||
#include "spark/domain/SecurityMarketDataStatistics.h"
|
||||
#include "spark/io/JsonReader.h"
|
||||
#include "sparkd/md/ccapi/CCApiReader.h"
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
#include "BinanceUsdsFuturesPriceStatisticsAdaptor.h"
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "spark/domain/SecurityMarketDataStatistics.h"
|
||||
#include "spark/md/IMarketDataListener.h"
|
||||
#include "spark/utils/bts_fatal.h"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "sparkd/md/ccapi/ICCApiMessageHandler.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
+5
-4
@@ -1,8 +1,9 @@
|
||||
#include "BinanceUsdsFuturesSecurityRequestor.h"
|
||||
#include "domain/security.h"
|
||||
#include "domain/security_criteria.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "spark/api/md/BinanceUsdsFuturesMarketDataConfig.pb.h"
|
||||
#include "spark/core/FMT.h"
|
||||
#include "spark/domain/Security.h"
|
||||
#include "spark/domain/SecurityCriteria.h"
|
||||
#include "spark/logging/logging.h"
|
||||
#include "spark/persistence/IDGenerator.h"
|
||||
#include "spark/utils/bts_fatal.h"
|
||||
@@ -24,13 +25,13 @@
|
||||
|
||||
namespace bts::md::binance_usds_futures {
|
||||
|
||||
using api::domain::Venue;
|
||||
using api::domain::Venue_Name;
|
||||
using api::md::BinanceUsdsFuturesMarketDataConfig;
|
||||
using bts::collections::UnorderedSetFactory;
|
||||
using bts::domain::Security;
|
||||
using bts::domain::SecurityCriteria;
|
||||
using bts::domain::SecurityID;
|
||||
using bts::domain::protobufs::Venue;
|
||||
using bts::domain::protobufs::Venue_Name;
|
||||
using bts::persistence::IDGenerator;
|
||||
using std::string;
|
||||
using std::unordered_set;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "BinanceUsdsFuturesSubscription.h"
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "domain/protobufs/venue.pb.h"
|
||||
#include "domain/security.h"
|
||||
#include "domain/security_criteria.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "spark/api/md/BinanceUsdsFuturesMarketDataConfig.pb.h"
|
||||
#include "spark/core/FMT.h"
|
||||
#include "spark/domain/Security.h"
|
||||
#include "spark/domain/SecurityCriteria.h"
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "spark/io/ProtoPrinter.h"
|
||||
#include "spark/io/QueryParams.h"
|
||||
#include "spark/logging/logging.h"
|
||||
@@ -30,12 +30,12 @@
|
||||
|
||||
namespace bts::md::binance_usds_futures {
|
||||
|
||||
using bts::api::domain::Venue;
|
||||
using bts::api::domain::Venue_Name;
|
||||
using bts::api::md::BinanceUsdsFuturesMarketDataConfig;
|
||||
using bts::domain::Security;
|
||||
using bts::domain::SecurityCriteria;
|
||||
using bts::domain::SecurityID;
|
||||
using bts::domain::protobufs::Venue;
|
||||
using bts::domain::protobufs::Venue_Name;
|
||||
using bts::io::ProtoPrinter;
|
||||
using bts::io::QueryParams;
|
||||
using bts::persistence::IDGenerator;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "CboeMarketDataHandler.h"
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "spark/config/config.h"
|
||||
#include "spark/config/protos/system_config.pb.h"
|
||||
#include "sparkd/md/databento/DatabentoDataHandler.h"
|
||||
@@ -10,17 +9,18 @@
|
||||
|
||||
namespace bts::md::cboe {
|
||||
|
||||
using bts::domain::protobufs::Venue;
|
||||
|
||||
void CboeMarketDatahandler::run(
|
||||
bool use_file,
|
||||
std::shared_ptr<IMarketDataListener> listner,
|
||||
std::shared_ptr<persistence::IDGenerator> sec_id_store) {
|
||||
static const api::domain::Venue venue = api::domain::VENUE_CBOE;
|
||||
std::string contratcs_file_name = "/opra-pillar-20240815.definition.dbn.zst";
|
||||
std::string bbo_file_name = "/opra-pillar-20240815.mbp-1.dbn.zst";
|
||||
std::string base_path = config::get<bts::config::SystemConfig>().data_path();
|
||||
DatabentoHandler::DatabentoDatahandler::run(
|
||||
use_file, listner, sec_id_store, venue, base_path + contratcs_file_name,
|
||||
base_path + bbo_file_name);
|
||||
use_file, listner, sec_id_store, Venue::VENUE_CBOE,
|
||||
base_path + contratcs_file_name, base_path + bbo_file_name);
|
||||
}
|
||||
|
||||
} // namespace bts::md::cboe
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/domain/BookSide.h"
|
||||
#include "domain/book_side.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "CCApiMarketDataProvider.h"
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "domain/protobufs/venue.pb.h"
|
||||
#include "spark/api/md/MarketDataConfig.pb.h"
|
||||
#include "spark/config/config.h"
|
||||
#include "spark/io/ProtoPrinter.h"
|
||||
@@ -21,7 +21,10 @@
|
||||
|
||||
namespace bts::md {
|
||||
|
||||
#define VENUE(x) bts::domain::protobufs::VENUE_##x
|
||||
|
||||
using bts::api::md::MarketDataConfig;
|
||||
using bts::md::binance_usds_futures::BinanceUsdsFuturesSubscription;
|
||||
using bts::persistence::IDGenerator;
|
||||
using std::pair;
|
||||
using std::shared_ptr;
|
||||
@@ -50,7 +53,8 @@ struct CCApiMarketDataProvider::PImpl {
|
||||
ccapi::EventDispatcher dispatcher;
|
||||
shared_ptr<IDGenerator> sec_id_store;
|
||||
unordered_map<api::Venue, unique_ptr<VenueSink>> venue_sinks;
|
||||
vector<std::pair<api::domain::Venue, std::shared_ptr<IMarketDataSource>>>
|
||||
vector<
|
||||
std::pair<domain::protobufs::Venue, std::shared_ptr<IMarketDataSource>>>
|
||||
sources;
|
||||
|
||||
PImpl(MarketDataConfig config, shared_ptr<IDGenerator> sec_id_store)
|
||||
@@ -74,7 +78,7 @@ CCApiMarketDataProvider::CCApiMarketDataProvider(
|
||||
|
||||
CCApiMarketDataProvider::~CCApiMarketDataProvider() = default;
|
||||
|
||||
vector<pair<api::domain::Venue, shared_ptr<IMarketDataSource>>>
|
||||
vector<pair<domain::protobufs::Venue, shared_ptr<IMarketDataSource>>>
|
||||
CCApiMarketDataProvider::get_sources() {
|
||||
auto &cfg = me_->config;
|
||||
vector<string> cfg_errs;
|
||||
@@ -87,52 +91,47 @@ CCApiMarketDataProvider::get_sources() {
|
||||
// Binance
|
||||
for (const auto &binance : cfg.binance()) {
|
||||
me_->sources.emplace_back(
|
||||
api::domain::VENUE_BINANCE,
|
||||
VENUE(BINANCE),
|
||||
std::make_shared<binance::BinanceSubscription>(
|
||||
&me_->dispatcher, binance, me_->sec_id_store.get()));
|
||||
}
|
||||
// Binance US
|
||||
for (const auto &binance_us : cfg.binance_us()) {
|
||||
me_->sources.emplace_back(
|
||||
api::domain::VENUE_BINANCE_US,
|
||||
VENUE(BINANCE_US),
|
||||
std::make_shared<binance_us::BinanceUsSubscription>(
|
||||
&me_->dispatcher, binance_us, me_->sec_id_store.get()));
|
||||
}
|
||||
// Binance USDS Futures
|
||||
for (const auto &binance_ufs : cfg.binance_usds_futures()) {
|
||||
me_->sources.emplace_back(
|
||||
api::domain::VENUE_BINANCE_USDS_FUTURES,
|
||||
std::make_shared<
|
||||
binance_usds_futures::BinanceUsdsFuturesSubscription>(
|
||||
&me_->dispatcher, binance_ufs, me_->sec_id_store.get()));
|
||||
auto sub = std::make_shared<
|
||||
binance_usds_futures::BinanceUsdsFuturesSubscription>(
|
||||
&me_->dispatcher, binance_ufs, me_->sec_id_store.get());
|
||||
me_->sources.emplace_back(VENUE(BINANCE_USDS_FUTURES), std::move(sub));
|
||||
}
|
||||
// Coinbase
|
||||
for (const auto &coinbase : cfg.coinbase()) {
|
||||
me_->sources.emplace_back(
|
||||
api::domain::VENUE_COINBASE,
|
||||
std::make_shared<coinbase::CoinbaseSubscription>(
|
||||
&me_->dispatcher, coinbase, me_->sec_id_store.get()));
|
||||
auto sub = std::make_shared<coinbase::CoinbaseSubscription>(
|
||||
&me_->dispatcher, coinbase, me_->sec_id_store.get());
|
||||
me_->sources.emplace_back(VENUE(COINBASE), std::move(sub));
|
||||
}
|
||||
// Deribit
|
||||
for (const auto &deribit : cfg.deribit()) {
|
||||
me_->sources.emplace_back(
|
||||
api::domain::VENUE_DERIBIT,
|
||||
std::make_shared<deribit::DeribitSubscription>(
|
||||
&me_->dispatcher, deribit, me_->sec_id_store.get()));
|
||||
auto sub = std::make_shared<deribit::DeribitSubscription>(
|
||||
&me_->dispatcher, deribit, me_->sec_id_store.get());
|
||||
me_->sources.emplace_back(VENUE(DERIBIT), std::move(sub));
|
||||
}
|
||||
// FTX
|
||||
for (const auto &ftx : cfg.ftx()) {
|
||||
me_->sources.emplace_back(
|
||||
api::domain::VENUE_FTX,
|
||||
std::make_shared<ftx::FTXSubscription>(
|
||||
&me_->dispatcher, ftx, me_->sec_id_store.get()));
|
||||
auto sub = std::make_shared<ftx::FTXSubscription>(
|
||||
&me_->dispatcher, ftx, me_->sec_id_store.get());
|
||||
me_->sources.emplace_back(VENUE(FTX), std::move(sub));
|
||||
}
|
||||
// Okx
|
||||
for (const auto &okx : cfg.okx()) {
|
||||
me_->sources.emplace_back(
|
||||
api::domain::VENUE_OKX,
|
||||
std::make_shared<okx::OkxSubscription>(
|
||||
&me_->dispatcher, okx, me_->sec_id_store.get()));
|
||||
VENUE(OKX), std::make_shared<okx::OkxSubscription>(
|
||||
&me_->dispatcher, okx, me_->sec_id_store.get()));
|
||||
}
|
||||
return me_->sources;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ class CCApiMarketDataProvider : public IMarketDataProvider {
|
||||
~CCApiMarketDataProvider();
|
||||
|
||||
std::vector<
|
||||
std::pair<api::domain::Venue, std::shared_ptr<IMarketDataSource>>>
|
||||
std::pair<domain::protobufs::Venue, std::shared_ptr<IMarketDataSource>>>
|
||||
get_sources() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "CCApiMarketDepthAdaptor.h"
|
||||
#include "spark/domain/BUY_SELL.h"
|
||||
#include "spark/domain/Book.h"
|
||||
#include "domain/BUY_SELL.h"
|
||||
#include "domain/book.h"
|
||||
#include "sparkd/md/ccapi/CCApiCorrelationID.h"
|
||||
#include "sparkd/md/ccapi/CCApiDepthWalker.h"
|
||||
#include "sparkd/md/ccapi/ICCApiMessageHandler.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/domain/Book.h"
|
||||
#include "domain/book.h"
|
||||
#include "spark/md/IMarketDataListener.h"
|
||||
#include "sparkd/md/ccapi/ICCApiMessageHandler.h"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "CCApiTradeAdaptor.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "spark/core/TimeStamp.h"
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "spark/domain/TradeRecord.h"
|
||||
#include "spark/utils/bts_fatal.h"
|
||||
#include "sparkd/md/ccapi/CCApiCorrelationID.h"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "spark/md/IMarketDataListener.h"
|
||||
#include "sparkd/md/ccapi/CCApiTradeRecord.h"
|
||||
#include "sparkd/md/ccapi/ICCApiMessageHandler.h"
|
||||
#include "spark/md/IMarketDataListener.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "CCApiTradeRecord.h"
|
||||
#include "spark/domain/AggressorSide.h"
|
||||
#include "spark/domain/Price.h"
|
||||
#include "spark/domain/Quantity.h"
|
||||
#include "domain/aggressor_side.h"
|
||||
#include "domain/price.h"
|
||||
#include "domain/quantity.h"
|
||||
#include "spark/domain/TradeRecord.h"
|
||||
#include "spark/io/JsonDumper.h"
|
||||
#include "spark/io/JsonReader.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "CoinbasePriceStatistics.h"
|
||||
#include "domain/price.h"
|
||||
#include "domain/quantity.h"
|
||||
#include "spark/core/TimeStamp.h"
|
||||
#include "spark/domain/Price.h"
|
||||
#include "spark/domain/Quantity.h"
|
||||
#include "spark/domain/SecurityMarketDataStatistics.h"
|
||||
#include "spark/io/JsonDumper.h"
|
||||
#include "spark/io/JsonReader.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "CoinbasePriceStatisticsAdaptor.h"
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "spark/domain/SecurityMarketDataStatistics.h"
|
||||
#include "spark/md/IMarketDataListener.h"
|
||||
#include "sparkd/md/coinbase/CoinbasePriceStatistics.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "sparkd/md/ccapi/ICCApiMessageHandler.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "CoinbaseSecurityRequestor.h"
|
||||
#include "spark/api/domain/SecurityType.pb.h"
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "spark/domain/Security.h"
|
||||
#include "spark/domain/SecurityCriteria.h"
|
||||
#include "domain/protobufs/security_type.pb.h"
|
||||
#include "domain/protobufs/venue.pb.h"
|
||||
#include "domain/security.h"
|
||||
#include "domain/security_criteria.h"
|
||||
#include "spark/logging/logging.h"
|
||||
#include "spark/persistence/IDGenerator.h"
|
||||
#include "sparkd/md/ccapi/CCApiCorrelationID.h"
|
||||
@@ -24,12 +24,12 @@
|
||||
|
||||
namespace bts::md::coinbase {
|
||||
|
||||
using api::domain::SecurityType;
|
||||
using api::domain::Venue;
|
||||
using api::domain::Venue_Name;
|
||||
using bts::domain::Security;
|
||||
using bts::domain::SecurityCriteria;
|
||||
using bts::domain::SecurityID;
|
||||
using bts::domain::protobufs::SecurityType;
|
||||
using bts::domain::protobufs::Venue;
|
||||
using bts::domain::protobufs::Venue_Name;
|
||||
using bts::persistence::IDGenerator;
|
||||
using std::string;
|
||||
using std::unordered_set;
|
||||
@@ -40,7 +40,7 @@ using std::vector;
|
||||
#define CCAPI_VENUE_NAME CCAPI_EXCHANGE_NAME_COINBASE
|
||||
#define COINBASE_MSG_TYPE_NAME(x) \
|
||||
std::string { CoinbaseMessageType{x}.name() }
|
||||
#define SEC_TYPE(x) bts::api::domain::SECURITY_TYPE_##x
|
||||
#define SEC_TYPE(x) bts::domain::protobufs::SECURITY_TYPE_##x
|
||||
|
||||
static ccapi::Request exchange_info_req() {
|
||||
auto corr_id = CCApiCorrelationID::from_parts(VENUE_NAME);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "CoinbaseSpot.h"
|
||||
#include "spark/api/domain/Currency.pb.h"
|
||||
#include "spark/domain/Quantity.h"
|
||||
#include "spark/domain/Security.h"
|
||||
#include "domain/protobufs/currency.pb.h"
|
||||
#include "domain/quantity.h"
|
||||
#include "domain/security.h"
|
||||
#include "spark/io/JsonReader.h"
|
||||
#include "spark/logging/logging.h"
|
||||
|
||||
@@ -12,16 +12,17 @@
|
||||
|
||||
namespace bts::md::coinbase {
|
||||
|
||||
using bts::api::domain::Venue;
|
||||
using bts::domain::Quantity;
|
||||
using bts::domain::Security;
|
||||
using bts::domain::SpotSecurity;
|
||||
using bts::domain::protobufs::Venue;
|
||||
using bts::io::JsonReader;
|
||||
using std::string;
|
||||
using std::stringstream;
|
||||
using std::vector;
|
||||
|
||||
#define SEC_TYPE(x) bts::api::domain::SECURITY_TYPE_##x
|
||||
#define SEC_TYPE(x) bts::domain::protobufs::SECURITY_TYPE_##x
|
||||
#define CURRENCY(x) bts::domain::protobufs::Currency::##x
|
||||
|
||||
void CoinbaseSpot::parse(
|
||||
const ccapi::Message &msg, vector<Security> &securities, Venue venue) {
|
||||
@@ -43,8 +44,8 @@ void CoinbaseSpot::parse(
|
||||
jr.read("QUANTITY_INCREMENT", scomm.min_quantity_increment);
|
||||
jr.read("QUANTITY_INCREMENT", scomm.min_quantity);
|
||||
scomm.currency = sec_props.at("QUOTE_ASSET") == "BTC"
|
||||
? api::domain::Currency::BTC
|
||||
: api::domain::Currency::USD;
|
||||
? bts::domain::protobufs::Currency::BTC
|
||||
: bts::domain::protobufs::Currency::USD;
|
||||
sec.security.emplace<SpotSecurity>();
|
||||
LOG(md, Info, "sec el {}", sec.to_string(true));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "domain/protobufs/venue.pb.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <ostream>
|
||||
@@ -38,7 +38,7 @@ class CoinbaseSpot {
|
||||
static void parse(
|
||||
const ccapi::Message &msg,
|
||||
std::vector<domain::Security> &securities,
|
||||
api::domain::Venue venue = api::domain::Venue::VENUE_COINBASE);
|
||||
domain::protobufs::Venue venue = domain::protobufs::VENUE_COINBASE);
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const CoinbaseSpot &spot) noexcept;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "CoinbaseSubscription.h"
|
||||
#include "domain/security.h"
|
||||
#include "domain/security_criteria.h"
|
||||
#include "spark/api/md/CoinbaseMarketDataConfig.pb.h"
|
||||
#include "spark/domain/Security.h"
|
||||
#include "spark/domain/SecurityCriteria.h"
|
||||
#include "spark/io/ProtoPrinter.h"
|
||||
#include "spark/io/QueryParams.h"
|
||||
#include "spark/md/IMarketDataListener.h"
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
#include "DatabentoDataHandler.h"
|
||||
#include "databento/datetime.hpp"
|
||||
#include "databento/timeseries.hpp"
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "domain/book.h"
|
||||
#include "domain/quantity.h"
|
||||
#include "domain/security.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "spark/config/config.h"
|
||||
#include "spark/config/protos/system_config.pb.h"
|
||||
#include "spark/domain/Book.h"
|
||||
#include "spark/domain/Quantity.h"
|
||||
#include "spark/domain/Security.h"
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "spark/md/IMarketDataListener.h"
|
||||
#include "spark/persistence/IDGenerator.h"
|
||||
#include "spark/utils/TimeStamp.h"
|
||||
@@ -22,6 +21,8 @@
|
||||
|
||||
namespace bts::md::DatabentoHandler {
|
||||
|
||||
using bts::domain::protobufs::Venue;
|
||||
|
||||
std::string remove_spaces(const std::string_view &str) {
|
||||
std::string result;
|
||||
result.reserve(str.size()); // Reserve space for better performance
|
||||
@@ -37,7 +38,7 @@ void DatabentoDatahandler::run(
|
||||
bool use_file,
|
||||
std::shared_ptr<IMarketDataListener> listener,
|
||||
std::shared_ptr<persistence::IDGenerator> sec_id_store,
|
||||
bts::api::domain::Venue venue,
|
||||
Venue venue,
|
||||
const std::string &securities_path,
|
||||
const std::string &books_path,
|
||||
const std::chrono::duration<long double> sleep_duration) {
|
||||
@@ -52,10 +53,10 @@ void DatabentoDatahandler::run(
|
||||
std::string symbol;
|
||||
|
||||
switch (venue) {
|
||||
case api::domain::Venue::VENUE_CBOE:
|
||||
case Venue::VENUE_CBOE:
|
||||
symbol = id.substr(0, 3);
|
||||
break;
|
||||
case api::domain::Venue::VENUE_GLBX:
|
||||
case Venue::VENUE_GLBX:
|
||||
if (id.length() > 5)
|
||||
return databento::KeepGoing::Continue;
|
||||
symbol = id.substr(0, 2);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "domain/protobufs/venue.pb.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
@@ -22,7 +22,7 @@ class DatabentoDatahandler {
|
||||
bool use_file,
|
||||
std::shared_ptr<IMarketDataListener> listener,
|
||||
std::shared_ptr<persistence::IDGenerator> sec_id_store,
|
||||
api::domain::Venue venue,
|
||||
domain::protobufs::Venue venue,
|
||||
const std::string &securities_path,
|
||||
const std::string &books_path,
|
||||
const std::chrono::duration<long double> sleep_duration =
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "DatabentoMarketDataProvider.h"
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "spark/api/md/MarketDataConfig.pb.h"
|
||||
#include "spark/persistence/IDGenerator.h"
|
||||
#include "sparkd/md/IMarketDataSource.h"
|
||||
@@ -11,8 +10,8 @@
|
||||
|
||||
namespace bts::md {
|
||||
|
||||
using bts::api::domain::Venue;
|
||||
using bts::api::md::MarketDataConfig;
|
||||
using bts::domain::protobufs::Venue;
|
||||
using bts::persistence::IDGenerator;
|
||||
using std::pair;
|
||||
using std::shared_ptr;
|
||||
|
||||
@@ -22,7 +22,7 @@ class DatabentoMarketDataProvider : public IMarketDataProvider {
|
||||
~DatabentoMarketDataProvider();
|
||||
|
||||
std::vector<
|
||||
std::pair<api::domain::Venue, std::shared_ptr<IMarketDataSource>>>
|
||||
std::pair<domain::protobufs::Venue, std::shared_ptr<IMarketDataSource>>>
|
||||
get_sources() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#include "DeribitDepthAdaptor.h"
|
||||
#include "spark/domain/Book.h"
|
||||
#include "spark/domain/BookLevelComp.h"
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "domain/book.h"
|
||||
#include "domain/book_level_comp.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "spark/logging/logging.h"
|
||||
#include "spark/md/IMarketDataListener.h"
|
||||
#include "spark/utils/bts_assert.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <vector>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "domain/security_id.h"
|
||||
|
||||
#include <memory>
|
||||
#include <nlohmann/json_fwd.hpp>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "domain/protobufs/security_type.pb.h"
|
||||
#include "spark/algorithm/StringCaseConverter.h"
|
||||
#include "spark/api/domain/SecurityType.pb.h"
|
||||
#include "spark/core/EnumMacros.h"
|
||||
#include "spark/core/FMT_IMPL.h"
|
||||
#include "spark/domain_model/Security.pb.h"
|
||||
@@ -43,7 +43,7 @@ class DeribitInstrumentKind {
|
||||
bts::api::SecurityType type);
|
||||
|
||||
static constexpr DeribitInstrumentKind from_security_type(
|
||||
bts::api::domain::SecurityType type);
|
||||
domain::protobufs::SecurityType type);
|
||||
|
||||
static constexpr DeribitInstrumentKind ALL();
|
||||
|
||||
@@ -82,15 +82,15 @@ constexpr DeribitInstrumentKind DeribitInstrumentKind::from_security_type(
|
||||
}
|
||||
|
||||
constexpr DeribitInstrumentKind DeribitInstrumentKind::from_security_type(
|
||||
bts::api::domain::SecurityType type) {
|
||||
domain::protobufs::SecurityType type) {
|
||||
switch (type) {
|
||||
case api::domain::SECURITY_TYPE_SPOT:
|
||||
case domain::protobufs::SECURITY_TYPE_SPOT:
|
||||
return DeribitInstrumentKind::SPOT;
|
||||
case api::domain::SECURITY_TYPE_OPTION:
|
||||
case domain::protobufs::SECURITY_TYPE_OPTION:
|
||||
return DeribitInstrumentKind::OPTION;
|
||||
case api::domain::SECURITY_TYPE_FUTURE:
|
||||
case domain::protobufs::SECURITY_TYPE_FUTURE:
|
||||
return DeribitInstrumentKind::FUTURE;
|
||||
case api::domain::SECURITY_TYPE_SPREAD: {
|
||||
case domain::protobufs::SECURITY_TYPE_SPREAD: {
|
||||
return FUTURE_COMBO | OPTION_COMBO;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "domain/security_criteria.h"
|
||||
#include "domain/security_criteria_clause.h"
|
||||
#include "spark/core/FMT.h"
|
||||
#include "spark/core/FMT_IMPL.h"
|
||||
#include "spark/domain/SecurityCriteria.h"
|
||||
#include "spark/domain/SecurityCriteriaClause.h"
|
||||
#include "sparkd/md/deribit/DeribitInstrumentKind.h"
|
||||
#include "system/collections/contains.h"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "DeribitInstrumentStore.h"
|
||||
#include "spark/api/domain/SecurityType.h"
|
||||
#include "spark/domain/Security.h"
|
||||
#include "domain/protobufs/security_type.h"
|
||||
#include "domain/security.h"
|
||||
#include "spark/io/JsonReader.h"
|
||||
#include "spark/logging/logging.h"
|
||||
#include "spark/persistence/IDGenerator.h"
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
namespace bts::md::deribit {
|
||||
|
||||
using bts::api::domain::CallPut;
|
||||
using bts::domain::FutureSecurity;
|
||||
using bts::domain::OptionSecurity;
|
||||
using bts::domain::Price;
|
||||
@@ -28,6 +27,7 @@ using bts::domain::SecurityID;
|
||||
using bts::domain::Side;
|
||||
using bts::domain::SpotSecurity;
|
||||
using bts::domain::SpreadSecurity;
|
||||
using bts::domain::protobufs::CallPut;
|
||||
using bts::persistence::IDGenerator;
|
||||
using nlohmann::json;
|
||||
using std::function;
|
||||
@@ -42,9 +42,9 @@ using std::vector;
|
||||
#define _WARN(...) _LOG(Warn, __VA_ARGS__)
|
||||
#define _ERROR(...) _LOG(Error, __VA_ARGS__)
|
||||
|
||||
#define SEC_TYPE(x) bts::api::domain::SECURITY_TYPE_##x
|
||||
#define SEC_TYPE_NAME(x) bts::api::domain::SecurityType_Name(x)
|
||||
#define VENUE bts::api::domain::VENUE_DERIBIT
|
||||
#define SEC_TYPE(x) bts::domain::protobufs::SECURITY_TYPE_##x
|
||||
#define SEC_TYPE_NAME(x) bts::domain::protobufs::SecurityType_Name(x)
|
||||
#define VENUE bts::domain::protobufs::VENUE_DERIBIT
|
||||
|
||||
static void instrument_to_sec(const DeribitInstrument &di, Security &sec) {
|
||||
auto &scomm = sec.security_common;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/domain/Security.h"
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "domain/security.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "spark/persistence/IDGenerator.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
@@ -56,10 +56,10 @@
|
||||
*/
|
||||
|
||||
#include "DeribitSecurityRequestor.h"
|
||||
#include "spark/api/domain/SecurityType.pb.h"
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "spark/domain/Security.h"
|
||||
#include "spark/domain/SecurityCriteria.h"
|
||||
#include "domain/protobufs/security_type.pb.h"
|
||||
#include "domain/protobufs/venue.pb.h"
|
||||
#include "domain/security.h"
|
||||
#include "domain/security_criteria.h"
|
||||
#include "spark/io/websocket/JsonRpcError.h"
|
||||
#include "spark/io/websocket/JsonRpcHandler.h"
|
||||
#include "spark/io/websocket/JsonRpcRequest.h"
|
||||
@@ -105,12 +105,12 @@ using std::string;
|
||||
using std::unordered_set;
|
||||
using std::vector;
|
||||
|
||||
#define VENUE bts::api::domain::VENUE_DERIBIT
|
||||
#define VENUE_NAME (bts::api::domain::Venue_Name(VENUE))
|
||||
#define VENUE bts::domain::protobufs::VENUE_DERIBIT
|
||||
#define VENUE_NAME (bts::domain::protobufs::Venue_Name(VENUE))
|
||||
#define CCAPI_VENUE_NAME CCAPI_EXCHANGE_NAME_DERIBIT
|
||||
#define DERIBIT_MSG_TYPE_NAME(x) \
|
||||
std::string { DeribitMessageType{DeribitMessageType::x}.name() }
|
||||
#define SEC_TYPE(x) bts::api::domain::SECURITY_TYPE_##x
|
||||
#define SEC_TYPE(x) bts::domain::protobufs::SECURITY_TYPE_##x
|
||||
|
||||
#define CORR_ID(msg_type, ...) \
|
||||
CCApiCorrelationID::from_parts( \
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "DeribitSubscription.h"
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "domain/protobufs/venue.pb.h"
|
||||
#include "domain/security.h"
|
||||
#include "domain/security_criteria.h"
|
||||
#include "spark/api/md/DeribitMarketDataConfig.pb.h"
|
||||
#include "spark/core/FMT.h"
|
||||
#include "spark/core/TimeStamp.h"
|
||||
#include "spark/domain/Security.h"
|
||||
#include "spark/domain/SecurityCriteria.h"
|
||||
#include "spark/domain_model/Security.pb.h"
|
||||
#include "spark/io/ProtoPrinter.h"
|
||||
#include "spark/io/websocket/JsonRpcError.h"
|
||||
@@ -60,9 +60,9 @@ using std::unordered_set;
|
||||
using std::vector;
|
||||
|
||||
#define VENUE_NAME \
|
||||
(bts::api::domain::Venue_Name(bts::api::domain::VENUE_DERIBIT))
|
||||
(bts::domain::protobufs::Venue_Name(bts::domain::protobufs::VENUE_DERIBIT))
|
||||
#define CCAPI_VENUE_NAME CCAPI_EXCHANGE_NAME_DERIBIT
|
||||
#define SEC_TYPE(t) bts::api::domain::SECURITY_TYPE_##t
|
||||
#define SEC_TYPE(t) bts::domain::protobufs::SECURITY_TYPE_##t
|
||||
|
||||
#define _ASSERT_MSGF(condition, ...) \
|
||||
bts_assert_msgf(condition, "DeribitSubscription::" __VA_ARGS__)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "DeribitTickerAdaptor.h"
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "spark/domain/SecurityMarketDataStatistics.h"
|
||||
#include "spark/io/JsonReader.h"
|
||||
#include "spark/md/IMarketDataListener.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "domain/security_id.h"
|
||||
|
||||
#include <memory>
|
||||
#include <nlohmann/json_fwd.hpp>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "DeribitTradeAdaptor.h"
|
||||
#include "domain/aggressor_side.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "spark/core/TimeStamp.h"
|
||||
#include "spark/domain/AggressorSide.h"
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "spark/domain/TradeRecord.h"
|
||||
#include "spark/md/IMarketDataListener.h"
|
||||
#include "spark/utils/bts_fatal.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "domain/security_id.h"
|
||||
|
||||
#include <memory>
|
||||
#include <nlohmann/json_fwd.hpp>
|
||||
|
||||
@@ -17,7 +17,8 @@ using std::vector;
|
||||
|
||||
struct EmumbaMarketDataProvider::PImpl {
|
||||
MarketDataConfig config;
|
||||
vector<pair<api::domain::Venue, shared_ptr<IMarketDataSource>>> deribit_subs;
|
||||
vector<pair<domain::protobufs::Venue, shared_ptr<IMarketDataSource>>>
|
||||
deribit_subs;
|
||||
|
||||
PImpl(MarketDataConfig config) : config(std::move(config)) {}
|
||||
};
|
||||
@@ -27,11 +28,11 @@ EmumbaMarketDataProvider::EmumbaMarketDataProvider(MarketDataConfig config)
|
||||
|
||||
EmumbaMarketDataProvider::~EmumbaMarketDataProvider() = default;
|
||||
|
||||
vector<pair<api::domain::Venue, shared_ptr<IMarketDataSource>>>
|
||||
vector<pair<domain::protobufs::Venue, shared_ptr<IMarketDataSource>>>
|
||||
EmumbaMarketDataProvider::get_sources() {
|
||||
for (const auto &cfg : me_->config.emumba_deribit()) {
|
||||
me_->deribit_subs.push_back(
|
||||
{api::domain::VENUE_DERIBIT,
|
||||
{domain::protobufs::VENUE_DERIBIT,
|
||||
std::make_shared<EmumbaDeribitSubscription>(cfg)});
|
||||
}
|
||||
return me_->deribit_subs;
|
||||
|
||||
@@ -14,7 +14,7 @@ class EmumbaMarketDataProvider : public IMarketDataProvider {
|
||||
~EmumbaMarketDataProvider();
|
||||
|
||||
std::vector<
|
||||
std::pair<bts::api::domain::Venue, std::shared_ptr<IMarketDataSource>>>
|
||||
std::pair<domain::protobufs::Venue, std::shared_ptr<IMarketDataSource>>>
|
||||
get_sources() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "FTXFuture.h"
|
||||
#include "spark/api/domain/Currency.pb.h"
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "domain/future_security.h"
|
||||
#include "domain/protobufs/currency.pb.h"
|
||||
#include "domain/protobufs/venue.pb.h"
|
||||
#include "domain/security.h"
|
||||
#include "spark/core/TableFormatter.h"
|
||||
#include "spark/domain/FutureSecurity.h"
|
||||
#include "spark/domain/Security.h"
|
||||
#include "spark/io/JsonReader.h"
|
||||
#include "spark/logging/logging.h"
|
||||
|
||||
@@ -15,16 +15,16 @@
|
||||
|
||||
namespace bts::md::ftx {
|
||||
|
||||
using bts::api::domain::Currency;
|
||||
using bts::core::TableFormatter;
|
||||
using bts::domain::FutureSecurity;
|
||||
using bts::domain::Security;
|
||||
using bts::domain::protobufs::Currency;
|
||||
using bts::io::JsonReader;
|
||||
using std::string;
|
||||
using std::stringstream;
|
||||
using std::vector;
|
||||
|
||||
#define VENUE bts::api::domain::VENUE_FTX
|
||||
#define VENUE bts::domain::protobufs::VENUE_FTX
|
||||
|
||||
static std::string deduce_sym_from_name(const std::string &name) {
|
||||
std::regex word_regex("(\\w+)");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "sparkd/md/ccapi/ICCApiMessageHandler.h"
|
||||
|
||||
namespace bts::md {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "domain/security_id.h"
|
||||
#include "spark/core/TimeStamp.h"
|
||||
#include "spark/domain/SecurityID.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "FTXMarket.h"
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "domain/protobufs/venue.pb.h"
|
||||
#include "domain/security.h"
|
||||
#include "spark/core/NaN.h"
|
||||
#include "spark/core/TableFormatter.h"
|
||||
#include "spark/domain/Security.h"
|
||||
#include "spark/io/JsonReader.h"
|
||||
#include "spark/logging/logging.h"
|
||||
#include "spark/utils/bts_fatal.h"
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
namespace bts::md::ftx {
|
||||
|
||||
#define SEC_TYPE(x) bts::api::domain::SECURITY_TYPE_##x
|
||||
#define SEC_TYPE(x) bts::domain::protobufs::SECURITY_TYPE_##x
|
||||
|
||||
using bts::api::domain::Venue;
|
||||
using bts::core::NaN;
|
||||
using bts::core::TableFormatter;
|
||||
using bts::domain::Security;
|
||||
using bts::domain::protobufs::Venue;
|
||||
using bts::io::JsonReader;
|
||||
using std::ostream;
|
||||
using std::string;
|
||||
@@ -103,8 +103,8 @@ void FTXMarket::parse(const ccapi::Message &msg, vector<Security> &securities) {
|
||||
case SEC_TYPE(SYNTHETIC):
|
||||
BTS_FATAL_MSG("Synthetics not supported");
|
||||
break;
|
||||
case api::domain::SecurityType_INT_MIN_SENTINEL_DO_NOT_USE_:
|
||||
case api::domain::SecurityType_INT_MAX_SENTINEL_DO_NOT_USE_:
|
||||
case domain::protobufs::SecurityType_INT_MIN_SENTINEL_DO_NOT_USE_:
|
||||
case domain::protobufs::SecurityType_INT_MAX_SENTINEL_DO_NOT_USE_:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "FTXSecurityRequestor.h"
|
||||
#include "spark/api/domain/SecurityType.pb.h"
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "spark/domain/Security.h"
|
||||
#include "spark/domain/SecurityCriteria.h"
|
||||
#include "domain/protobufs/security_type.pb.h"
|
||||
#include "domain/protobufs/venue.pb.h"
|
||||
#include "domain/security.h"
|
||||
#include "domain/security_criteria.h"
|
||||
#include "spark/logging/logging.h"
|
||||
#include "spark/persistence/IDGenerator.h"
|
||||
#include "sparkd/md/ccapi/CCApiCorrelationID.h"
|
||||
@@ -26,17 +26,17 @@
|
||||
|
||||
namespace bts::md::ftx {
|
||||
|
||||
using api::domain::SecurityType;
|
||||
using api::domain::Venue;
|
||||
using api::domain::Venue_Name;
|
||||
using bts::domain::Security;
|
||||
using bts::domain::SecurityID;
|
||||
using bts::domain::protobufs::SecurityType;
|
||||
using bts::domain::protobufs::Venue;
|
||||
using bts::domain::protobufs::Venue_Name;
|
||||
using std::string;
|
||||
using std::unordered_set;
|
||||
using std::vector;
|
||||
|
||||
#define VENUE_NAME (Venue_Name(Venue::VENUE_FTX))
|
||||
#define SEC_TYPE(x) bts::api::domain::SECURITY_TYPE_##x
|
||||
#define SEC_TYPE(x) bts::domain::protobufs::SECURITY_TYPE_##x
|
||||
|
||||
#define FTX_MSG_TYPE_NAME(x) \
|
||||
std::string { FTXMessageType{x}.name() }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/api/domain/SecurityType.pb.h"
|
||||
#include "domain/protobufs/security_type.pb.h"
|
||||
#include "spark/core/EnumMacros.h"
|
||||
#include "spark/core/FMT_IMPL.h"
|
||||
|
||||
@@ -33,7 +33,7 @@ class FTXSecurityType {
|
||||
|
||||
ENUM_BASIC_MEMBERS(FTXSecurityType)
|
||||
|
||||
constexpr api::domain::SecurityType to_security_type() const;
|
||||
constexpr domain::protobufs::SecurityType to_security_type() const;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
@@ -46,18 +46,19 @@ ENUM_PARSE_DEF(FTXSecurityType, FOR_ALL_VALUES)
|
||||
ENUM_FROM_JSON(FTXSecurityType)
|
||||
ENUM_EQUALITY_OPS(FTXSecurityType)
|
||||
|
||||
constexpr api::domain::SecurityType FTXSecurityType::to_security_type() const {
|
||||
constexpr domain::protobufs::SecurityType
|
||||
FTXSecurityType::to_security_type() const {
|
||||
switch (value) {
|
||||
case SPOT:
|
||||
return api::domain::SECURITY_TYPE_SPOT;
|
||||
return domain::protobufs::SECURITY_TYPE_SPOT;
|
||||
case FUTURE:
|
||||
case PERPETUAL:
|
||||
case PREDICTION:
|
||||
case MOVE:
|
||||
return api::domain::SECURITY_TYPE_FUTURE;
|
||||
return domain::protobufs::SECURITY_TYPE_FUTURE;
|
||||
case NONE:
|
||||
default:
|
||||
return api::domain::SECURITY_TYPE_UNSPECIFIED;
|
||||
return domain::protobufs::SECURITY_TYPE_UNSPECIFIED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "FTXSubscription.h"
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "domain/protobufs/venue.pb.h"
|
||||
#include "domain/security.h"
|
||||
#include "domain/security_criteria.h"
|
||||
#include "spark/api/md/FTXMarketDataConfig.pb.h"
|
||||
#include "spark/domain/Security.h"
|
||||
#include "spark/domain/SecurityCriteria.h"
|
||||
#include "spark/io/ProtoPrinter.h"
|
||||
#include "spark/logging/logging.h"
|
||||
#include "spark/md/IMarketDataListener.h"
|
||||
@@ -28,12 +28,12 @@
|
||||
|
||||
namespace bts::md::ftx {
|
||||
|
||||
using bts::api::domain::Venue;
|
||||
using bts::api::domain::Venue_Name;
|
||||
using bts::api::md::FTXMarketDataConfig;
|
||||
using bts::domain::Security;
|
||||
using bts::domain::SecurityCriteria;
|
||||
using bts::domain::SecurityID;
|
||||
using bts::domain::protobufs::Venue;
|
||||
using bts::domain::protobufs::Venue_Name;
|
||||
using bts::io::ProtoPrinter;
|
||||
using bts::persistence::IDGenerator;
|
||||
using std::shared_ptr;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "GlbxMarketDataHandler.h"
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "domain/protobufs/venue.pb.h"
|
||||
#include "spark/config/config.h"
|
||||
#include "spark/config/protos/system_config.pb.h"
|
||||
#include "sparkd/md/databento/DatabentoDataHandler.h"
|
||||
@@ -13,17 +13,18 @@
|
||||
|
||||
namespace bts::md::glbx {
|
||||
|
||||
using bts::domain::protobufs::Venue;
|
||||
|
||||
void GlbxMarketDatahandler::run(
|
||||
bool use_file,
|
||||
std::shared_ptr<IMarketDataListener> listner,
|
||||
std::shared_ptr<persistence::IDGenerator> sec_id_store) {
|
||||
std::string contratcs_file_name = "/glbx-mdp3-20240815.definition.dbn.zst";
|
||||
std::string bbo_file_name = "/glbx-mdp3-20240815.mbp-1.dbn.zst";
|
||||
static const api::domain::Venue venue = api::domain::VENUE_GLBX;
|
||||
std::string base_path = config::get<config::SystemConfig>().data_path();
|
||||
DatabentoHandler::DatabentoDatahandler::run(
|
||||
use_file, listner, sec_id_store, venue, base_path + contratcs_file_name,
|
||||
base_path + bbo_file_name);
|
||||
use_file, listner, sec_id_store, Venue::VENUE_GLBX,
|
||||
base_path + contratcs_file_name, base_path + bbo_file_name);
|
||||
}
|
||||
|
||||
} // namespace bts::md::glbx
|
||||
@@ -53,7 +53,7 @@ struct OnixsGlbxSubscription::PImpl {
|
||||
return;
|
||||
}
|
||||
const auto symbols = SymbolLoader::load(
|
||||
SecurityCriteria::create({api::domain::VENUE_GLBX}));
|
||||
SecurityCriteria::create({domain::protobufs::VENUE_GLBX}));
|
||||
if (symbols.empty()) {
|
||||
LOG(md, Info, "OnixsGlbxSubscription aborting. No symbols loaded");
|
||||
return;
|
||||
@@ -66,7 +66,7 @@ struct OnixsGlbxSubscription::PImpl {
|
||||
vector<shared_ptr<IMDPlatform>> platforms;
|
||||
auto main = shared_ptr<MDP3Main>();
|
||||
main->start({symbols.begin(), symbols.end()}, nullptr, nullptr);
|
||||
platforms.emplace_back(std::move(main));
|
||||
platforms.push_back(std::move(main));
|
||||
dispatcher = &utils::Dispatcher::current();
|
||||
heartbeat_timer.emplace(*dispatcher, 250, [&]() {
|
||||
for (auto &p : platforms) {
|
||||
@@ -108,9 +108,30 @@ OnixsGlbxSubscription::~OnixsGlbxSubscription() = default;
|
||||
|
||||
void OnixsGlbxSubscription::start(
|
||||
shared_ptr<IMarketDataListener> /*listener*/) {
|
||||
std::atomic_thread_fence(std::memory_order_release);
|
||||
bts_assert(!me_->dispatcher_thread.joinable());
|
||||
me_->dispatcher_thread = std::thread{[&]() { me_->run(); }};
|
||||
LOG(md, Info,
|
||||
"OnixsGlbxSubscription::start t_id: {}; t_name: {}; config: {}",
|
||||
os::get_thread_id(), os::get_thread_name(), me_->config.DebugString());
|
||||
bts::md::MBOWriter *mbo = nullptr;
|
||||
bts::md::TradeSummarySignalDispatcher *tssd = nullptr;
|
||||
std::vector<std::shared_ptr<bts::md::IMDPlatform>> platforms;
|
||||
// get all glbx symbols
|
||||
auto cme_symbols = SymbolLoader::load(
|
||||
bts::domain::SecurityCriteria::create({domain::protobufs::VENUE_GLBX}));
|
||||
if (!cme_symbols.empty()) {
|
||||
auto *main = new bts::md::MDP3Main();
|
||||
main->start({cme_symbols.begin(), cme_symbols.end()}, mbo, tssd);
|
||||
platforms.emplace_back(main);
|
||||
}
|
||||
// Timers
|
||||
auto &disp = utils::Dispatcher::current();
|
||||
utils::DispatcherTimer heartbeat_timer(disp, 250, [&]() {
|
||||
for (auto &p : platforms) {
|
||||
p->send_heartbeats();
|
||||
}
|
||||
});
|
||||
heartbeat_timer.start();
|
||||
|
||||
disp.run();
|
||||
}
|
||||
|
||||
void OnixsGlbxSubscription::stop() { me_->stop(); }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "OkxChannelDemuxer.h"
|
||||
#include "spark/api/domain/Venue.h"
|
||||
#include "domain/protobufs/venue.h"
|
||||
#include "spark/io/JsonReader.h"
|
||||
#include "sparkd/md/ccapi/CCApiCorrelationID.h"
|
||||
#include "sparkd/md/ccapi/CCApiReader.h"
|
||||
@@ -13,7 +13,7 @@
|
||||
namespace bts::md::okx {
|
||||
|
||||
#define CCAPI_VENUE_NAME CCAPI_EXCHANGE_NAME_OKX
|
||||
#define VENUE_NAME bts::api::domain::Venue_Name(bts::api::domain::VENUE_OKX)
|
||||
#define VENUE_NAME bts::domain::Venue_Name(bts::domain::VENUE_OKX)
|
||||
|
||||
#define _ASSERT_MSGF(condition, ...) \
|
||||
bts_assert_msgf(condition, "OkxChannelDemuxer::" __VA_ARGS__)
|
||||
@@ -143,8 +143,9 @@ OkxChannelDemuxer::Callback &OkxChannelDemuxer::add_handler(
|
||||
return it->second.callback;
|
||||
}
|
||||
|
||||
OkxChannelDemuxer::Callback &OkxChannelDemuxer::operator[](const OkxChannel &channel) {
|
||||
return me_->handlers[channel].callback;
|
||||
OkxChannelDemuxer::Callback &OkxChannelDemuxer::operator[](
|
||||
const OkxChannel &channel) {
|
||||
return me_->handlers[channel].callback;
|
||||
}
|
||||
|
||||
void OkxChannelDemuxer::remove_handler(const OkxChannel &channel) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "OkxDepthAdaptor.h"
|
||||
#include "spark/domain/Book.h"
|
||||
#include "spark/domain/BookLevelComp.h"
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "domain/book.h"
|
||||
#include "domain/book_level_comp.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "spark/io/JsonReader.h"
|
||||
#include "spark/logging/logging.h"
|
||||
#include "spark/md/IMarketDataListener.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "domain/security_id.h"
|
||||
|
||||
#include <memory>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "OkxInstrumentStore.h"
|
||||
#include "spark/domain/Security.h"
|
||||
#include "spark/api/domain/SecurityType.h"
|
||||
#include "domain/protobufs/security_type.h"
|
||||
#include "domain/security.h"
|
||||
#include "spark/logging/logging.h"
|
||||
#include "spark/persistence/IDGenerator.h"
|
||||
#include "spark/utils/bts_fatal.h"
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
namespace bts::md::okx {
|
||||
|
||||
using bts::api::domain::CallPut;
|
||||
using bts::domain::FutureSecurity;
|
||||
using bts::domain::OptionSecurity;
|
||||
using bts::domain::Price;
|
||||
@@ -21,6 +20,7 @@ using bts::domain::Quantity;
|
||||
using bts::domain::Security;
|
||||
using bts::domain::SecurityID;
|
||||
using bts::domain::SpotSecurity;
|
||||
using bts::domain::protobufs::CallPut;
|
||||
using bts::persistence::IDGenerator;
|
||||
using nlohmann::json;
|
||||
using std::function;
|
||||
@@ -28,8 +28,8 @@ using std::string;
|
||||
using std::unordered_map;
|
||||
using std::vector;
|
||||
|
||||
#define SEC_TYPE(x) bts::api::domain::SECURITY_TYPE_##x
|
||||
#define VENUE bts::api::domain::VENUE_OKX
|
||||
#define SEC_TYPE(x) bts::domain::protobufs::SECURITY_TYPE_##x
|
||||
#define VENUE bts::domain::protobufs::VENUE_OKX
|
||||
|
||||
static void instrument_to_sec(const OkxInstrument &oi, Security &sec) {
|
||||
auto &scomm = sec.security_common;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/domain/Security.h"
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "domain/security.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "spark/persistence/IDGenerator.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "OkxSecuritySubscription.h"
|
||||
#include "spark/domain/SecurityCriteria.h"
|
||||
#include "domain/security_criteria.h"
|
||||
#include "spark/io/JsonReader.h"
|
||||
#include "sparkd/md/ccapi/CCApiCorrelationID.h"
|
||||
#include "sparkd/md/ccapi/CCApiHttpParams.h"
|
||||
@@ -28,9 +28,12 @@
|
||||
|
||||
namespace bts::md::okx {
|
||||
|
||||
#define VENUE bts::api::domain::VENUE_OKX
|
||||
#define SEC_TYPE(x) bts::domain::protobufs::SECURITY_TYPE_##x
|
||||
#define VENUE bts::domain::protobufs::VENUE_OKX
|
||||
#define VENUE_NAME \
|
||||
std::string { bts::api::domain::Venue_Name(bts::api::domain::VENUE_OKX) }
|
||||
std::string { \
|
||||
bts::domain::protobufs::Venue_Name(bts::domain::protobufs::VENUE_OKX) \
|
||||
}
|
||||
#define CCAPI_VENUE_NAME CCAPI_EXCHANGE_NAME_OKX
|
||||
#define OKX_MSG_TYPE(x) \
|
||||
OkxMessageType { OkxMessageType::x }
|
||||
@@ -52,13 +55,13 @@ using std::unordered_set;
|
||||
using std::vector;
|
||||
|
||||
static std::optional<OkxInstrumentType> to_okx_type(
|
||||
api::domain::SecurityType type) {
|
||||
domain::protobufs::SecurityType type) {
|
||||
switch (type) {
|
||||
case api::domain::SecurityType::SECURITY_TYPE_FUTURE:
|
||||
case SEC_TYPE(FUTURE):
|
||||
return OkxInstrumentType::FUTURES;
|
||||
case api::domain::SECURITY_TYPE_SPOT:
|
||||
case SEC_TYPE(SPOT):
|
||||
return OkxInstrumentType::SPOT;
|
||||
case api::domain::SECURITY_TYPE_OPTION:
|
||||
case SEC_TYPE(OPTION):
|
||||
return OkxInstrumentType::OPTION;
|
||||
default:
|
||||
return {};
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "domain/aggressor_side.h"
|
||||
#include "domain/side.h"
|
||||
#include "spark/core/EnumMacros.h"
|
||||
#include "spark/core/FMT_IMPL.h"
|
||||
#include "spark/domain/AggressorSide.h"
|
||||
#include "spark/domain/Side.h"
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "OkxSubscription.h"
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "domain/protobufs/venue.pb.h"
|
||||
#include "domain/security.h"
|
||||
#include "domain/security_criteria.h"
|
||||
#include "spark/api/md/OkxMarketDataConfig.pb.h"
|
||||
#include "spark/core/FMT.h"
|
||||
#include "spark/domain/Security.h"
|
||||
#include "spark/domain/SecurityCriteria.h"
|
||||
#include "spark/io/ProtoPrinter.h"
|
||||
#include "spark/logging/logging.h"
|
||||
#include "spark/md/IMarketDataListener.h"
|
||||
@@ -61,9 +61,10 @@ using std::vector;
|
||||
#define _WARN(...) _LOG(Warn, __VA_ARGS__)
|
||||
#define _ERROR(...) _LOG(Error, __VA_ARGS__)
|
||||
|
||||
#define VENUE_NAME (bts::api::domain::Venue_Name(bts::api::domain::VENUE_OKX))
|
||||
#define VENUE_NAME \
|
||||
(bts::domain::protobufs::Venue_Name(bts::domain::protobufs::VENUE_OKX))
|
||||
#define CCAPI_VENUE_NAME CCAPI_EXCHANGE_NAME_OKX
|
||||
#define SEC_TYPE(t) bts::api::domain::SECURITY_TYPE_##t
|
||||
#define SEC_TYPE(t) bts::domain::protobufs::SECURITY_TYPE_##t
|
||||
|
||||
/**
|
||||
* @brief Applies overrides from our config to a ccapi::SessionConfigs object
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "domain/price.h"
|
||||
#include "domain/quantity.h"
|
||||
#include "spark/core/TimeStamp.h"
|
||||
#include "spark/domain/Price.h"
|
||||
#include "spark/domain/Quantity.h"
|
||||
#include "sparkd/md/okx/OkxInstrumentType.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "OkxTickerAdaptor.h"
|
||||
#include "spark/domain/Price.h"
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "domain/price.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "spark/domain/SecurityMarketDataStatistics.h"
|
||||
#include "spark/io/JsonReader.h"
|
||||
#include "spark/md/IMarketDataListener.h"
|
||||
@@ -27,7 +27,7 @@ using std::vector;
|
||||
#define _WARN(...) _LOG(Warn, __VA_ARGS__)
|
||||
#define _ERROR(...) _LOG(Error, __VA_ARGS__)
|
||||
|
||||
#define VENUE bts::api::domain::VENUE_OKX
|
||||
#define VENUE bts::domain::VENUE_OKX
|
||||
|
||||
struct OkxTickerAdaptor::PImpl {
|
||||
SecurityID sec_id;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "domain/security_id.h"
|
||||
|
||||
#include <memory>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "domain/price.h"
|
||||
#include "domain/quantity.h"
|
||||
#include "spark/core/TimeStamp.h"
|
||||
#include "spark/domain/Price.h"
|
||||
#include "spark/domain/Quantity.h"
|
||||
#include "sparkd/md/okx/OkxSide.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "OkxTradeAdaptor.h"
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "spark/domain/TradeRecord.h"
|
||||
#include "spark/io/JsonReader.h"
|
||||
#include "spark/md/IMarketDataListener.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "domain/security_id.h"
|
||||
|
||||
#include <memory>
|
||||
#include <nlohmann/json_fwd.hpp>
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
#include "MDReplayer.h"
|
||||
#include "domain/book.h"
|
||||
#include "domain/price.h"
|
||||
#include "domain/quantity.h"
|
||||
#include "domain/security.h"
|
||||
#include "domain/security_common.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "domain/side.h"
|
||||
#include "spark/core/TimeStamp.h"
|
||||
#include "spark/domain/Book.h"
|
||||
#include "spark/domain/Price.h"
|
||||
#include "spark/domain/Quantity.h"
|
||||
#include "spark/domain/Security.h"
|
||||
#include "spark/domain/SecurityCommon.h"
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "spark/domain/DomainSecurityUtils.h"
|
||||
#include "spark/domain/SecurityMarketDataStatistics.h"
|
||||
#include "spark/domain/Side.h"
|
||||
#include "spark/domain/TradeRecord.h"
|
||||
#include "spark/domain_model/Security.pb.h"
|
||||
#include "spark/logging/logging.h"
|
||||
@@ -129,7 +130,8 @@ void MDReplayer::_replay_message(const bts::co2::RecordedMDMessage &m) {
|
||||
case (co2::RecordedMDMessage::MDRecordCase::kSecurity): {
|
||||
LOG(md, Diag, "MDReplayer::_replay_message m: {}",
|
||||
utils::pb::to_string(m));
|
||||
bts::domain::Security new_sec = m.security();
|
||||
bts::domain::Security new_sec =
|
||||
domain::DomainSecurityUtils::convert(m.security());
|
||||
me->sec_keys.insert(m.security().id());
|
||||
std::vector<domain::Security const *> sec_vec = {};
|
||||
sec_vec.push_back(&new_sec);
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
#include "TaifexDataHandler.h"
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "domain/price.h"
|
||||
#include "domain/security.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "spark/config/config.h"
|
||||
#include "spark/config/protos/system_config.pb.h"
|
||||
#include "spark/domain/Price.h"
|
||||
#include "spark/domain/Security.h"
|
||||
#include "spark/domain/SecurityID.h"
|
||||
#include "spark/logging/logging.h"
|
||||
#include "spark/md/IMarketDataListener.h"
|
||||
#include "spark/persistence/IDGenerator.h"
|
||||
@@ -29,6 +28,8 @@
|
||||
|
||||
namespace bts::md::taifex {
|
||||
|
||||
using bts::domain::protobufs::Venue;
|
||||
|
||||
class SecurityDetailsMapper {
|
||||
struct security_details {
|
||||
double min_increment;
|
||||
@@ -1204,7 +1205,7 @@ bool readBinaryFile(
|
||||
const auto id = remove_spaces(i010_message.prod_id);
|
||||
const auto symbol = id.substr(0, 2);
|
||||
bts::domain::SecurityID sec_id{
|
||||
sec_id_store->get_or_add(api::domain::VENUE_TAIFEX, id)};
|
||||
sec_id_store->get_or_add(Venue::VENUE_TAIFEX, id)};
|
||||
security_details->add_i010_mapping(
|
||||
id, sec_id, i010_message.decimal_locator);
|
||||
// std::ostringstream oss;
|
||||
@@ -1214,7 +1215,7 @@ bool readBinaryFile(
|
||||
// LOG(md,Error," map has {}", security_details->to_string());
|
||||
std::vector<bts::domain::Security> complete_security_list;
|
||||
bts::domain::Security &sec = complete_security_list.emplace_back();
|
||||
sec.security_common.venue = bts::api::domain::VENUE_TAIFEX;
|
||||
sec.security_common.venue = Venue::VENUE_TAIFEX;
|
||||
sec.security_common.id = sec_id;
|
||||
sec.security_common.exchange_sec_id = id; // Need to fix this
|
||||
sec.security_common.desc = id;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "TaifexMarketDataProvider.h"
|
||||
#include "spark/api/domain/Venue.pb.h"
|
||||
#include "spark/api/md/MarketDataConfig.pb.h"
|
||||
#include "spark/persistence/IDGenerator.h"
|
||||
#include "sparkd/md/taifex/TaifexSubscription.h"
|
||||
@@ -9,8 +8,8 @@
|
||||
|
||||
namespace bts::md {
|
||||
|
||||
using bts::api::domain::Venue;
|
||||
using bts::api::md::MarketDataConfig;
|
||||
using bts::domain::protobufs::Venue;
|
||||
using bts::persistence::IDGenerator;
|
||||
using std::pair;
|
||||
using std::shared_ptr;
|
||||
|
||||
@@ -22,7 +22,7 @@ class TaifexMarketDataProvider : public IMarketDataProvider {
|
||||
~TaifexMarketDataProvider();
|
||||
|
||||
std::vector<
|
||||
std::pair<api::domain::Venue, std::shared_ptr<IMarketDataSource>>>
|
||||
std::pair<domain::protobufs::Venue, std::shared_ptr<IMarketDataSource>>>
|
||||
get_sources() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -50,45 +50,45 @@
|
||||
<OutDir>$(ProtoOutputPath)/lib/api</OutDir>
|
||||
</Proto>
|
||||
|
||||
<!-- Protos in lib/api/domain -->
|
||||
<Proto Include="../../lib/api/domain/Currency.proto">
|
||||
<OutDir>$(ProtoOutputPath)/lib/api/domain</OutDir>
|
||||
<!-- Protos in lib_domain/domain -->
|
||||
<Proto Include="../../lib_domain/domain/Currency.proto">
|
||||
<OutDir>$(ProtoOutputPath)/domain</OutDir>
|
||||
</Proto>
|
||||
<Proto Include="../../lib/api/domain/SecurityCriteria.proto">
|
||||
<OutDir>$(ProtoOutputPath)/lib/api/domain</OutDir>
|
||||
<Proto Include="../../lib_domain/domain/SecurityCriteria.proto">
|
||||
<OutDir>$(ProtoOutputPath)/domain</OutDir>
|
||||
</Proto>
|
||||
<Proto Include="../../lib/api/domain/SecurityCriteriaClause.proto">
|
||||
<OutDir>$(ProtoOutputPath)/lib/api/domain</OutDir>
|
||||
<Proto Include="../../lib_domain/domain/SecurityCriteriaClause.proto">
|
||||
<OutDir>$(ProtoOutputPath)/domain</OutDir>
|
||||
</Proto>
|
||||
<Proto Include="../../lib/api/domain/SecurityCriteriaClause.proto">
|
||||
<OutDir>$(ProtoOutputPath)/lib/api/domain</OutDir>
|
||||
<Proto Include="../../lib_domain/domain/SecurityCriteriaClause.proto">
|
||||
<OutDir>$(ProtoOutputPath)/domain</OutDir>
|
||||
</Proto>
|
||||
<Proto Include="../../lib/api/domain/SecurityExpiration.proto">
|
||||
<OutDir>$(ProtoOutputPath)/lib/api/domain</OutDir>
|
||||
<Proto Include="../../lib_domain/domain/SecurityExpiration.proto">
|
||||
<OutDir>$(ProtoOutputPath)/domain</OutDir>
|
||||
</Proto>
|
||||
<Proto Include="../../lib/api/domain/SecurityMetadata.proto">
|
||||
<OutDir>$(ProtoOutputPath)/lib/api/domain</OutDir>
|
||||
<Proto Include="../../lib_domain/domain/SecurityMetadata.proto">
|
||||
<OutDir>$(ProtoOutputPath)/domain</OutDir>
|
||||
</Proto>
|
||||
<Proto Include="../../lib/api/domain/SecurityMetadataCollection.proto">
|
||||
<OutDir>$(ProtoOutputPath)/lib/api/domain</OutDir>
|
||||
<Proto Include="../../lib_domain/domain/SecurityMetadataCollection.proto">
|
||||
<OutDir>$(ProtoOutputPath)/domain</OutDir>
|
||||
</Proto>
|
||||
<Proto Include="../../lib/api/domain/SecurityMetadataItem.proto">
|
||||
<OutDir>$(ProtoOutputPath)/lib/api/domain</OutDir>
|
||||
<Proto Include="../../lib_domain/domain/SecurityMetadataItem.proto">
|
||||
<OutDir>$(ProtoOutputPath)/domain</OutDir>
|
||||
</Proto>
|
||||
<Proto Include="../../lib/api/domain/SecurityType.proto">
|
||||
<OutDir>$(ProtoOutputPath)/lib/api/domain</OutDir>
|
||||
<Proto Include="../../lib_domain/domain/SecurityType.proto">
|
||||
<OutDir>$(ProtoOutputPath)/domain</OutDir>
|
||||
</Proto>
|
||||
<Proto Include="../../lib/api/domain/TickDisplayRule.proto">
|
||||
<OutDir>$(ProtoOutputPath)/lib/api/domain</OutDir>
|
||||
<Proto Include="../../lib_domain/domain/TickDisplayRule.proto">
|
||||
<OutDir>$(ProtoOutputPath)/domain</OutDir>
|
||||
</Proto>
|
||||
<Proto Include="../../lib/api/domain/TickDisplaySettings.proto">
|
||||
<OutDir>$(ProtoOutputPath)/lib/api/domain</OutDir>
|
||||
<Proto Include="../../lib_domain/domain/TickDisplaySettings.proto">
|
||||
<OutDir>$(ProtoOutputPath)/domain</OutDir>
|
||||
</Proto>
|
||||
<Proto Include="../../lib/api/domain/TickFactors.proto">
|
||||
<OutDir>$(ProtoOutputPath)/lib/api/domain</OutDir>
|
||||
<Proto Include="../../lib_domain/domain/TickFactors.proto">
|
||||
<OutDir>$(ProtoOutputPath)/domain</OutDir>
|
||||
</Proto>
|
||||
<Proto Include="../../lib/api/domain/Venue.proto">
|
||||
<OutDir>$(ProtoOutputPath)/lib/api/domain</OutDir>
|
||||
<Proto Include="../../lib_domain/domain/Venue.proto">
|
||||
<OutDir>$(ProtoOutputPath)/domain</OutDir>
|
||||
</Proto>
|
||||
|
||||
<!-- Protos in lib/api/services -->
|
||||
|
||||
Loaded 100 of 197 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user