diff --git a/src/lib/orderman/actors/ilink3/IL3ExecutionReportParser.cpp b/src/lib/orderman/actors/ilink3/IL3ExecutionReportParser.cpp index f04a279d1..576f6337e 100644 --- a/src/lib/orderman/actors/ilink3/IL3ExecutionReportParser.cpp +++ b/src/lib/orderman/actors/ilink3/IL3ExecutionReportParser.cpp @@ -5,6 +5,7 @@ #include "lib/domain_model/Security.h" #include "lib/md/IntPrice.h" #include "lib/orderman/orderman_utils/fix_order_codec.h" +#include "lib/orderman/orderman_utils/orderman_common.h" namespace bts { namespace orderman { @@ -38,7 +39,6 @@ void IL3ExecutionReportParser::common(const T &msg, ExecutionReport *data) { static_assert(sizeof(OperatorID) == T::senderIDLength()); memcpy(&data->operator_id.value(), msg.senderID(), msg.senderIDLength()); - auto &price = const_cast(msg).price(); data->exchange = api::VENUE_GLBX; data->exchange_order_id = ExchangeOrderID64{msg.orderID()}; data->leg_security = nullptr; @@ -53,6 +53,7 @@ void IL3ExecutionReportParser::common(const T &msg, ExecutionReport *data) { // data->security = get_security(ExchangeSecurityKey { (uint64_t) // msg.securityID() }); data->order_type = map_order_type(msg.ordType()); + auto &price = const_cast(msg).price(); data->price = securities::decode_exchange_price( *sec, Price{price.mantissa() * md::pow10(price.exponent())}); data->quantity = Quantity{msg.orderQty()}; @@ -104,20 +105,28 @@ bool IL3ExecutionReportParser::parse( const iLinkBinary::ExecutionReportTradeOutright525 &msg, ExecutionReport *data) { common(msg, data); + orderman::to_array(msg.getExecIDAsStringView(),&data->exchange_fill_id.value()); switch (msg.ordStatus()) { case iLinkBinary::OrdStatusTrd::Filled: data->order_status = api::orderman::NativeOrderStatus::NATIVE_ORDER_STATUS_FILLED; + data->exec_type = + api::orderman::EXEC_TYPE_FILL; break; case iLinkBinary::OrdStatusTrd::PartiallyFilled: data->order_status = api::orderman::NativeOrderStatus:: NATIVE_ORDER_STATUS_PARTIALLY_FILLED; + data->exec_type = + api::orderman::EXEC_TYPE_PARTIAL_FILL; break; default: data->order_status = api::orderman::NativeOrderStatus::NATIVE_ORDER_STATUS_UNDEFINED; } data->last_shares = Quantity{msg.lastQty()}; + auto &price = const_cast(msg).lastPx(); + data->last_price = securities::decode_exchange_price( + *data->security, Price{price.mantissa() * md::pow10(price.exponent())}); data->filled_quantity = Quantity{msg.cumQty()}; return true; } diff --git a/src/lib/orderman/orderman_utils/orderman_common.h b/src/lib/orderman/orderman_utils/orderman_common.h index 1c85c6df7..325feb145 100644 --- a/src/lib/orderman/orderman_utils/orderman_common.h +++ b/src/lib/orderman/orderman_utils/orderman_common.h @@ -32,8 +32,8 @@ using ExchangeFillID = const uint16_t NullTickToTradeCorID = 0; const auto fix_buffer_pool_size = 10000; -template -void to_array(std::string const &str, std::array *out) { +template +void to_array(S const &str, std::array *out) { auto &result = *out; bts_assert(str.size() <= N); memset(&result[0], ' ', N); @@ -46,13 +46,13 @@ void to_str(std::array const &in, std::string *out) { result = std::string(&in[0], N); } -template T to(std::string const &str) { +template T to(S const &str) { T result; to_array(str, &result.value()); return result; } -template void str_to(std::string const &str, T *out) { +template void str_to(S const &str, T *out) { to_array(str, &out->value()); }