cleanup: Remove over-engineered subcommands
We don't need explicit subcommands to 'run onixs' md (just use config).
This commit is contained in:
1 parent
e74fb56431
commit
0d6359904c
2 files changed
+2
-68
No files matched your search
@@ -1,18 +1,11 @@
|
||||
#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/md/SymbolLoader.h"
|
||||
#include "spark/md/UserSymbol.h"
|
||||
#include "spark/md/relay/RelayRecorder.h"
|
||||
#include "spark/persistence/IDGenerator.h"
|
||||
#include "spark/utils/bts_assert.h"
|
||||
#include "spark/utils/datetime.h"
|
||||
#include "spark/utils/thread_manager.h"
|
||||
#include "sparkd/md/MarketDataGateway.h"
|
||||
#include "sparkd/md/platforms/IMDPlatform.h"
|
||||
#include "sparkd/md/platforms/ice_onixs/ICEMain.h"
|
||||
#include "sparkd/md/platforms/mdp3_onixs/MDP3Main.h"
|
||||
#include "system/logging/logging.h"
|
||||
#include "system/os.h"
|
||||
|
||||
@@ -21,9 +14,6 @@
|
||||
|
||||
namespace bts::cmds::md::cmds {
|
||||
|
||||
using bts::domain::SecurityCriteria;
|
||||
using bts::md::SymbolLoader;
|
||||
|
||||
static void boot_sleep() {
|
||||
auto conf = config::get<bts::md::MDBootDelayWindow>();
|
||||
const auto *start = &conf.standard_start();
|
||||
@@ -47,51 +37,6 @@ static void boot_sleep() {
|
||||
}
|
||||
}
|
||||
|
||||
static void run_replay() {
|
||||
LOG(md, Info, "Run::run_replay t_id:{} t_name", os::get_thread_id(),
|
||||
os::get_thread_name());
|
||||
const auto &replay_opts = config::get<bts::md::ReplayOptions>();
|
||||
bts::md::replay_recording(
|
||||
replay_opts.url(), config::get<bts::md::RelayOptions>().naggle_ms(),
|
||||
replay_opts.fallback());
|
||||
}
|
||||
|
||||
static void run_onixs(
|
||||
bts::md::MBOWriter *mbo_writer,
|
||||
bts::md::TradeSummarySignalDispatcher *tss_dispatcher) {
|
||||
LOG(md, Info, "Run::run_onixs t_id:{} t_name", os::get_thread_id(),
|
||||
os::get_thread_name());
|
||||
std::vector<std::shared_ptr<bts::md::IMDPlatform>> platforms;
|
||||
// get all glbx symbols
|
||||
auto cme_symbols = SymbolLoader::load(
|
||||
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_writer, tss_dispatcher);
|
||||
platforms.emplace_back(main);
|
||||
}
|
||||
// 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()});
|
||||
platforms.emplace_back(imain);
|
||||
}
|
||||
// deribit
|
||||
// auto *d_platform = new bts::md::EmMDListener()
|
||||
// Timers
|
||||
auto &disp = utils::Dispatcher::current();
|
||||
utils::DispatcherTimer heartbeat_timer(disp, 250, [&]() {
|
||||
for (auto &p : platforms)
|
||||
p->send_heartbeats();
|
||||
});
|
||||
heartbeat_timer.start();
|
||||
|
||||
disp.run();
|
||||
}
|
||||
|
||||
static void run_md_gwy() {
|
||||
LOG(md, Info, "Run::run_md_gwy t_id:{} t_name:{}", os::get_thread_id(),
|
||||
os::get_thread_name());
|
||||
@@ -117,13 +62,8 @@ void Run::run() {
|
||||
Run::Run()
|
||||
: CLI::App(
|
||||
"Start market data feed, and store up-to-date snapshots of mbo, and "
|
||||
"mbp in shared memory. If no subcommand specified, uses the "
|
||||
"configured default feed (replay, or onixs)",
|
||||
"mbp in shared memory.",
|
||||
"run") {
|
||||
add_subcommand("replay", "Run replay market data")->callback(run_replay);
|
||||
add_subcommand("onixs", "Run onixs market data")->callback([] {
|
||||
run_onixs(nullptr, nullptr);
|
||||
});
|
||||
callback([] { run(); });
|
||||
}
|
||||
|
||||
|
||||
@@ -9,12 +9,6 @@ namespace bts::cmds::md::cmds {
|
||||
* shared memory.
|
||||
*/
|
||||
struct Run : public CLI::App {
|
||||
enum class MDType {
|
||||
Configured,
|
||||
Replay,
|
||||
Onixs
|
||||
};
|
||||
|
||||
Run();
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user