SimExecutionGateway almost working
This commit is contained in:
1 parent
bed6feae3f
commit
7e5c71f337
19 files changed
+422
-368
No files matched your search
@@ -6,6 +6,7 @@
|
||||
#include "lib/md/common.h"
|
||||
#include "lib/utils/LockBox.h"
|
||||
#include "lib/utils/bts_assert.h"
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
@@ -24,6 +25,8 @@ SimExecutionGatewayFactory::SimExecutionGatewayFactory(
|
||||
|
||||
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
|
||||
std::shared_ptr<SimExecutionGateway> rv = nullptr;
|
||||
@@ -34,7 +37,7 @@ std::shared_ptr<SimExecutionGateway> SimExecutionGatewayFactory::get_getayeway(
|
||||
if (it == data.end()) {
|
||||
data.insert(
|
||||
{venue, std::make_shared<SimExecutionGateway>(
|
||||
md_client.oracle(), md_client)});
|
||||
venue, md_client.oracle(), md_client)});
|
||||
it = data.find(venue);
|
||||
}
|
||||
rv = it->second;
|
||||
@@ -57,6 +60,10 @@ void SimExecutionGatewayFactory::init_once(bts::md::MDClient &md_client) {
|
||||
});
|
||||
}
|
||||
SimExecutionGatewayFactory *SimExecutionGatewayFactory::get() {
|
||||
auto sleep_period = std::chrono::milliseconds(100);
|
||||
while (instance == nullptr) {
|
||||
std::this_thread::sleep_for(sleep_period);
|
||||
}
|
||||
bts_assert(instance != nullptr);
|
||||
return instance;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user