Merge master
This commit is contained in:
commit
82d7c28cfc
52 files changed
+1102
-186
No files matched your search
@@ -276,7 +276,7 @@ void NativeOrder::on_init_from_exe_report(
|
||||
|
||||
NativeOrder::~NativeOrder() {}
|
||||
|
||||
void NativeOrder::_on_activate(Price p, Quantity q,
|
||||
bool NativeOrder::_on_activate(Price p, Quantity q,
|
||||
bts::orderman::OrderServices &services,
|
||||
trace::CorID const &trace) {
|
||||
auto scoped_log =
|
||||
@@ -300,7 +300,7 @@ void NativeOrder::_on_activate(Price p, Quantity q,
|
||||
"Dropping order {}",
|
||||
key().value());
|
||||
transition(ORDER_STATUS_REJECTED_BY_SPARK, "Exchange gateway is down");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// can we trade?
|
||||
@@ -316,7 +316,7 @@ void NativeOrder::_on_activate(Price p, Quantity q,
|
||||
|
||||
transition(ORDER_STATUS_REJECTED_BY_SPARK,
|
||||
fmt::format("Unauthorized order: {}", lqr.error_msg));
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// can we trade this security, with this size?
|
||||
@@ -333,7 +333,7 @@ void NativeOrder::_on_activate(Price p, Quantity q,
|
||||
|
||||
transition(ORDER_STATUS_REJECTED_BY_SPARK,
|
||||
fmt::format("Order would breach limit: {}", lqr.error_msg));
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// are we under the messaging threshold?
|
||||
@@ -344,7 +344,7 @@ void NativeOrder::_on_activate(Price p, Quantity q,
|
||||
key().value());
|
||||
transition(ORDER_STATUS_REJECTED_BY_SPARK,
|
||||
"Messaging threshold breached");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// if we are here we are good.
|
||||
@@ -383,21 +383,22 @@ void NativeOrder::_on_activate(Price p, Quantity q,
|
||||
auto const &ts = services.get_time_str();
|
||||
me->create_transact_time_bm = encoding.overwrite(
|
||||
me->create_transact_time_bm, &ts.value()[0], ts.value().size());
|
||||
return true;
|
||||
}
|
||||
|
||||
void NativeOrder::warm_up_activate(OrderServicesData&data, OrderServices& services) {
|
||||
void NativeOrder::warm_up_activate(OrderServicesData &data,
|
||||
OrderServices &services) {
|
||||
bts_assert(!me->services);
|
||||
me->services = &services;
|
||||
init_order_services(data,services);
|
||||
_on_activate(Price(0),Quantity(0),services, trace::CorID{});
|
||||
init_order_services(data, services);
|
||||
_on_activate(Price(0), Quantity(0), services, trace::CorID{});
|
||||
|
||||
me->services->unsubscribe_from_exe_report(
|
||||
*me->session_services,me->exe_report_sid);
|
||||
me->services->unsubscribe_from_cancel_reject(
|
||||
*me->session_services,me->cancel_reject_sid);
|
||||
me->services->unsubscribe_from_gateway_status(
|
||||
*me->session_services);
|
||||
me->services = nullptr;
|
||||
me->services->unsubscribe_from_exe_report(*me->session_services,
|
||||
me->exe_report_sid);
|
||||
me->services->unsubscribe_from_cancel_reject(*me->session_services,
|
||||
me->cancel_reject_sid);
|
||||
me->services->unsubscribe_from_gateway_status(*me->session_services);
|
||||
me->services = nullptr;
|
||||
}
|
||||
|
||||
void NativeOrder::on_activate(Price p, Quantity q,
|
||||
@@ -408,22 +409,22 @@ void NativeOrder::on_activate(Price p, Quantity q,
|
||||
|
||||
switch (me->state.status()) {
|
||||
|
||||
case ORDER_STATUS_INACTIVE: {
|
||||
case ORDER_STATUS_INACTIVE:
|
||||
// this is a brand new order
|
||||
if (_on_activate(p, q, services, trace)) {
|
||||
me->services->queue_fix(*me->session_services,
|
||||
jetfix::MessageTypes::NewOrderSingle,
|
||||
me->create_encoding, trace);
|
||||
|
||||
_on_activate(p,q,services,trace);
|
||||
me->services->queue_fix(*me->session_services,
|
||||
jetfix::MessageTypes::NewOrderSingle,
|
||||
me->create_encoding, trace);
|
||||
me->services->governor(*me->session_services).record_sent();
|
||||
me->state.set_status(ORDER_STATUS_PENDING_WORKING);
|
||||
|
||||
me->services->governor(*me->session_services).record_sent();
|
||||
me->state.set_status(ORDER_STATUS_PENDING_WORKING);
|
||||
|
||||
LOG(OrderMan, Info, "Sent new order with key {} to gateway",
|
||||
key().value());
|
||||
// early return so we skip the expensive report_state() call
|
||||
return;
|
||||
}
|
||||
LOG(OrderMan, Info, "Sent new order with key {} to gateway",
|
||||
key().value());
|
||||
// early return so we skip the expensive report_state() call
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
// all cases below are for orders recovered from disk
|
||||
case ORDER_STATUS_WORKING:
|
||||
|
||||
Reference in new issue
Block a user