SimExecution can be turned on from config now
This commit is contained in:
1 parent
d272612c6c
commit
9fd0df2a13
4 files changed
+33
-9
No files matched your search
@@ -139,3 +139,12 @@ message CMECannedSecureLogon {
|
||||
"tbb3it0rUQSSTa0TC9QcRwkrHEMDLWhaJH4VQ0FqGB4 2018-04-05 "
|
||||
" 2019-04-05 NEWRELEASE \n" ];
|
||||
}
|
||||
|
||||
|
||||
message SimExecution{
|
||||
message SimExecutionEntry {
|
||||
required bts.api.Venue venue = 100;
|
||||
required bool incorporate_crosses_into_book = 200;
|
||||
}
|
||||
repeated SimExecutionEntry entries = 100;
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "lib/orderman/gateways/GLBXExecutionGateway.h"
|
||||
#include "lib/orderman/gateways/GLBXiLink3ExecutionGateway.h"
|
||||
#include "lib/orderman/gateways/ICEExecutionGateway.h"
|
||||
#include "lib/orderman/gateways/sim/SimExecutionGatewayFactory.h"
|
||||
#include "lib/orderman/gateways/sim/SimExecutionGatewayUniqueWrapper.h"
|
||||
#include "lib/tracing/PerfLog.h"
|
||||
#include "lib/utils/PBUtils.h"
|
||||
@@ -20,7 +21,9 @@ std::unique_ptr<IExecutionGateway> ExecutionGatewayFactory::create_gateway(
|
||||
const config::JetFIX::Connection &conn,
|
||||
trace::PerfLog &pl,
|
||||
md::SecurityOracle o) {
|
||||
// check which exchanges are set to Sim
|
||||
if (SimExecutionGatewayFactory::is_sim_execution_on(conn.venue())) {
|
||||
return std::make_unique<SimExecutionGatewayUniqueWrapper>(conn.venue());
|
||||
}
|
||||
LOG(OrderMan, Info, "ExecutionGatewayFactory::create_gateway conn: {}",
|
||||
utils::pb::to_string(conn));
|
||||
if (conn.venue() == bts::api::VENUE_ICE ||
|
||||
@@ -32,12 +35,8 @@ std::unique_ptr<IExecutionGateway> ExecutionGatewayFactory::create_gateway(
|
||||
conn, pl, o);
|
||||
return std::make_unique<GLBXExecutionGateway>(conn, pl, o);
|
||||
} else if (conn.venue() == bts::api::VENUE_DERIBIT)
|
||||
return std::make_unique<SimExecutionGatewayUniqueWrapper>(conn.venue());
|
||||
//return std::make_unique<CCAPIExecutionGateway>(o);
|
||||
return std::make_unique<SimExecutionGatewayUniqueWrapper>(conn.venue());
|
||||
//return std::make_unique<EMExecutionGateway>(o);
|
||||
// return std::make_unique<FakeExecutionGateway>(o);
|
||||
// return std::make_unique<GLBXExecutionGateway>(conn, pl, o);
|
||||
return std::make_unique<EMExecutionGateway>(o);
|
||||
return std::make_unique<FakeExecutionGateway>(o);
|
||||
}
|
||||
|
||||
} // namespace bts::orderman
|
||||
@@ -23,8 +23,13 @@ std::shared_ptr<SimExecutionGateway> SimExecutionGatewayFactory::get_getayeway(
|
||||
api::Venue venue) {
|
||||
LOG(OrderMan, Info, "SimExecutionGatewayFactory::get_getayeway venue: {}",
|
||||
bts::api::Venue_Name(venue));
|
||||
// This needs to look at config, to check if an exchange is set to sim or
|
||||
// not. If it is not to set to sim, it should return a nullptr
|
||||
if (!is_sim_execution_on(venue)) {
|
||||
LOG(OrderMan, Info,
|
||||
"SimExecutionGatewayFactory::get_getayeway venue: {}, sim is turned "
|
||||
"off",
|
||||
bts::api::Venue_Name(venue));
|
||||
return nullptr;
|
||||
}
|
||||
std::shared_ptr<SimExecutionGateway> rv = nullptr;
|
||||
gateway_map.lock(
|
||||
[&, venue](std::map<bts::md::Venue, std::shared_ptr<SimExecutionGateway>>
|
||||
@@ -55,4 +60,14 @@ SimExecutionGatewayFactory *SimExecutionGatewayFactory::get() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
bool SimExecutionGatewayFactory::is_sim_execution_on(api::Venue venue) {
|
||||
const auto &sim_exec = config::get<bts::config::SimExecution>();
|
||||
for (const auto &e : sim_exec.entries()) {
|
||||
if (e.has_venue() && e.venue() == venue) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace bts::orderman
|
||||
@@ -32,6 +32,7 @@ class SimExecutionGatewayFactory {
|
||||
public:
|
||||
// this has to be called once before all usages
|
||||
static SimExecutionGatewayFactory *get();
|
||||
static bool is_sim_execution_on(api::Venue);
|
||||
};
|
||||
|
||||
} // namespace bts::orderman
|
||||
Reference in new issue
Block a user