SPARK-1438, Added location, smp and smp instructuction tags to order.

This commit is contained in:
Pedro Pinto committed 2018-07-06 21:40:05 +00:00
1 parent 0dd988fd1e
commit 3f03ceb2b5
6 files changed
+56 -5

No files matched your search

@@ -334,6 +334,11 @@ bts::api::orderman::RoutingRecord AdminServiceUtils::get_routing_record(const bt
out_result.set_error_text("Operator ID is not set");
return rv;
}
if (cme_user_data->location().length() == 0){
out_result.set_is_success(false);
out_result.set_error_text("Location is not set");
return rv;
}
if (cme_account_data->clearing_account().length() == 0){
out_result.set_is_success(false);
out_result.set_error_text("Clearing Account is not set");
@@ -346,6 +351,15 @@ bts::api::orderman::RoutingRecord AdminServiceUtils::get_routing_record(const bt
}
rv.set_session(conn_ptr->name());
rv.set_operator_id(cme_user_data->operator_id());
rv.set_location(cme_user_data->location());
rv.set_smp_id(cme_user_data->smp_id());
if (cme_user_data->smp_instruction()== "O")
rv.set_smp_instruction(api::orderman::SelfMatchPreventionInstruction::SELF_MATCH_PREVENTION_INSTRUCTION_CANCEL_RESTING);
else if (cme_user_data->smp_instruction()== "N")
rv.set_smp_instruction(api::orderman::SelfMatchPreventionInstruction::SELF_MATCH_PREVENTION_INSTRUCTION_CANCEL_AGRESSING);
else
rv.set_smp_instruction(api::orderman::SelfMatchPreventionInstruction::SELF_MATCH_PREVENTION_INSTRUCTION_UNDEFINED);
rv.set_account(cme_account_data->clearing_account());
rv.set_cti_code(cme_account_data->cti());
rv.set_customer_or_firm(cme_account_data->origin());
@@ -1009,11 +1023,20 @@ void AdminServiceUtils::bootstrap_data (bts::api::admin::AdminData& data){
// add cme user data
bts::api::admin::ExchangeUserData exchange_user_data;
exchange_user_data.mutable_cme_data()->set_operator_id("op_id_" + user_1->name());
exchange_user_data.mutable_cme_data()->set_smp_id("smp_" + user_1->name());
exchange_user_data.mutable_cme_data()->set_location("US,NC");
set_user_exchange_data(user_1, exchange_user_data);
exchange_user_data.mutable_cme_data()->set_operator_id("op_id_" + user_2->name());
exchange_user_data.mutable_cme_data()->set_smp_id("smp_" + user_2->name());
exchange_user_data.mutable_cme_data()->set_location("US,NC");
set_user_exchange_data(user_2, exchange_user_data);
exchange_user_data.mutable_cme_data()->set_operator_id("op_id_" + user_3->name());
exchange_user_data.mutable_cme_data()->set_smp_id("smp_" + user_3->name());
exchange_user_data.mutable_cme_data()->set_location("US,NC");
set_user_exchange_data(user_3, exchange_user_data);
// associate all connections to all accounts
for(int i=0; i<data.connections_size();i++){
std::string conn_name = data.connections(i).name();
@@ -1058,4 +1081,4 @@ bool AdminServiceUtils::has_id (uint32_t id){return id>0;}
bool AdminServiceUtils::is_symbol_set (const std::string& symbol){
return symbol !="*";
}
}}
}}
+10
View File
@@ -147,6 +147,9 @@ message RoutingRecord {
string operator_id = 3;
CTICode cti_code = 4;
CustomerOrFirm customer_or_firm = 5;
string smp_id = 6 ;
SelfMatchPreventionInstruction smp_instruction = 7;
string location = 8;
}
message NativeOrderState {
@@ -236,6 +239,13 @@ enum CTICode {
CTI_CODE_CTI_CODE4 = 52;
}
enum SelfMatchPreventionInstruction {
SELF_MATCH_PREVENTION_INSTRUCTION_UNDEFINED = 0;
SELF_MATCH_PREVENTION_INSTRUCTION_CANCEL_RESTING = 79;
SELF_MATCH_PREVENTION_INSTRUCTION_CANCEL_AGRESSING = 78;
}
enum NativeOrderStatus
{
NATIVE_ORDER_STATUS_UNACKNOWLEDGED = 0;
+1 -1
View File
@@ -46,7 +46,7 @@ message JetFIX {
optional string target_subid = 130 [default = ""];
optional string sender_locationid = 135 [default = "US,NC"];
optional string raw_data = 136 [default =""];
optional string self_match_prevention_id = 140 [default="bluestream"];
optional string self_match_prevention_id = 140 [default=""];
optional string cti_code = 145 [default="1"];
optional int32 customer_or_firm = 147 [default=1];
optional string mm_account = 150 [default = ""];
@@ -49,7 +49,6 @@ public:
header.add<fix::SenderCompID>(cfg.sender_compid ());
header.add<fix::TargetCompId>(cfg.target_compid ());
header.add<fix::TargetSubID>(cfg.target_subid ());
header.add<fix::SenderLocationID>(cfg.sender_locationid ());
_header_template_size = header.size ();
_header_template_checksum = header.checksum ();
}
@@ -22,6 +22,7 @@ typedef CharField<54> Side;
typedef CharField<59> TimeInForce;
typedef CharField<9702> CtiCode;
typedef CharField<9775> UnsolicitedCancelType;
typedef CharField<8000> SelfMatchPreventionInstruction;
typedef FloatField<132> BidPx;
typedef FloatField<133> OfferPx;
typedef FloatField<151> LeavesQty;
@@ -99,6 +99,8 @@ void NativeOrder::on_init_new(OrderDefinition const &def,
transition(ORDER_STATUS_INACTIVE);
auto &native_state = get_native_state(me->state);
*native_state.mutable_routing_record() = rq.routing_record;
init_fix();
} else {
auto msg = fmt::format("Could not route order: {}", rq.error_msg);
@@ -769,13 +771,14 @@ void NativeOrder::init_fix() {
auto const &def = me->definition;
auto const &sec = *me->sec;
auto const &rr = get_native_state(me->state).routing_record();
std::string clordid(clordid_sz(), ' ');
encode_clorid(key(), SecurityKey(sec.id()), &clordid);
// initialize create FIX
auto &create_encoding = me->create_encoding;
create_encoding.add<fix::SenderSubID>(rr.operator_id());
create_encoding.add<fix::SenderLocationID>(rr.location());
create_encoding.add<fix::Account>(rr.account());
create_encoding.add<fix::Side>(def.side());
create_encoding.add<fix::TimeInForce>(def.time_in_force());
@@ -784,14 +787,21 @@ void NativeOrder::init_fix() {
create_encoding.add<fix::CtiCode>(rr.cti_code());
create_encoding.add<fix::SecurityDesc>(sec.glbx().security_desc());
create_encoding.add<fix::ClOrdID>(clordid);
if (rr.smp_id().size()) {
create_encoding.add<fix::SelfMatchPreventionID>(rr.smp_id());
if (rr.smp_instruction() != SELF_MATCH_PREVENTION_INSTRUCTION_UNDEFINED)
create_encoding.add<fix::SelfMatchPreventionInstruction>(
rr.smp_instruction());
}
me->create_transact_time_bm = create_encoding.add<fix::TransactTimeStr>(
datetime::FIX_timestamp(datetime::now()));
me->create_quantity_bm =
create_encoding.add<fix::OrderQty>(0, quantity_sz());
// initialize update FIX
auto &update_encoding = me->update_encoding;
update_encoding.add<fix::SenderSubID>(rr.operator_id());
update_encoding.add<fix::SenderLocationID>(rr.location());
update_encoding.add<fix::Account>(rr.account());
update_encoding.add<fix::Side>(def.side());
update_encoding.add<fix::TimeInForce>(def.time_in_force());
@@ -803,6 +813,13 @@ void NativeOrder::init_fix() {
update_encoding.add<fix::OrigClOrdID>(clordid);
update_encoding.add<fix::CorrelationClOrdID>(clordid);
update_encoding.add<fix::InFlightMitigation>(true);
// Self Match Protection
if (rr.smp_id().size()) {
update_encoding.add<fix::SelfMatchPreventionID>(rr.smp_id());
if (rr.smp_instruction() != SELF_MATCH_PREVENTION_INSTRUCTION_UNDEFINED)
update_encoding.add<fix::SelfMatchPreventionInstruction>(
rr.smp_instruction());
}
me->update_transact_time_bm = update_encoding.add<fix::TransactTimeStr>(
datetime::FIX_timestamp(datetime::now()));
me->update_quantity_bm =
@@ -811,6 +828,7 @@ void NativeOrder::init_fix() {
// initialize cancel FIX
auto &cancel_encoding = me->cancel_encoding;
cancel_encoding.add<fix::SenderSubID>(rr.operator_id());
cancel_encoding.add<fix::SenderLocationID>(rr.location());
cancel_encoding.add<fix::Account>(rr.account());
cancel_encoding.add<fix::Side>(def.side());
cancel_encoding.add<fix::TimeInForce>(def.time_in_force());