Passing config to connection config to CCAPIDeribitOrderMux

This commit is contained in:
Taha Afzal committed 2023-06-06 18:30:38 +00:00
1 parent aba478f3dc
commit 64ff79a38d
6 files changed
+76 -18

No files matched your search

@@ -41,6 +41,7 @@
//#include <boost/container/small_vector.hpp>
#include <boost/pool/object_pool.hpp>
//#include <boost/proto/transform/impl.hpp>
#include "lib/orderman/ccapi/CCAPIConnectionConfig.h"
#include <cmath>
#include <cstdint>
#include <optional>
@@ -81,12 +82,19 @@ api::orderman::NativeOrderStatus native_order_status(const CCAPIOrderState &s) {
}
struct CCAPIExecutionGateway::PImpl {
PImpl(md::SecurityOracle o) : sec_oracle(o) {
PImpl(bts::api::Venue venue, md::SecurityOracle o)
: venue(venue), sec_oracle(o) {
LOG(OrderMan, Info, "CCAPIExecutionGateway::PImpl constructor");
}
admin::AdminServiceUtils::ExchangeSubAccountResolver subaccount_resolver =
{};
// TODO: get it from config
std::vector<CCAPIConnectionConfig> configs = {
CCAPIConnectionConfig{CCAPIConnectionConfig::DeribitConnectionConfig{
"ZmIKL6fb", "_FY2PcXYNc8VdlfkZO5c-pkFJQFhn8P9z4_p8YA2fS0", "MAIN"}},
CCAPIConnectionConfig{CCAPIConnectionConfig::DeribitConnectionConfig{
"v1iSzZrY", "fFOX8SBB2ZKj43xoab2f3YV70DDK5064STWK3WOCrK4",
"SMALL"}}};
// callback cashed data
const bts::api::Venue venue;
api::admin::AdminData admin_data = {};
md::SecurityOracle sec_oracle;
// interface (IExecutionGateway) callbacks
@@ -110,12 +118,15 @@ struct CCAPIExecutionGateway::PImpl {
bool inited() const { return order_mux != nullptr; }
};
CCAPIExecutionGateway::CCAPIExecutionGateway(md::SecurityOracle o)
: IExecutionGateway(), me(new PImpl(o)) {
CCAPIExecutionGateway::CCAPIExecutionGateway(
bts::api::Venue venue, md::SecurityOracle o)
: IExecutionGateway(), me(new PImpl(venue, o)) {
LOG(OrderMan, Info,
"CCAPIExecutionGateway::CCAPIExecutionGateway constructor t_id: {} "
"CCAPIExecutionGateway::CCAPIExecutionGateway constructor venue: {} "
"t_id: {} "
"t_name: {}",
os::get_thread_id(), os::get_application_name());
bts::api::Venue_Name(venue), os::get_thread_id(),
os::get_application_name());
}
CCAPIExecutionGateway::~CCAPIExecutionGateway() {}
@@ -224,7 +235,7 @@ void CCAPIExecutionGateway::_init() {
if (me->order_mux != nullptr)
return;
LOG(OrderMan, Info, "CCAPIExecutionGateway::_init");
me->order_mux = new CCAPIDeribitOrderMux(me->sec_oracle);
me->order_mux = new CCAPIDeribitOrderMux(me->configs.at(0), me->sec_oracle);
me->order_mux->order_update_cb() =
[this](const CCAPIOrderState &order_state) {
_on_order_cb(order_state);