Fixed fills.
This commit is contained in:
1 parent
e5d9d324bf
commit
be5d01a797
2 files changed
+14
-5
No files matched your search
@@ -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<T &>(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<T &>(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<iLinkBinary::ExecutionReportTradeOutright525 &>(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;
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@ using ExchangeFillID =
|
||||
const uint16_t NullTickToTradeCorID = 0;
|
||||
const auto fix_buffer_pool_size = 10000;
|
||||
|
||||
template <size_t N>
|
||||
void to_array(std::string const &str, std::array<char, N> *out) {
|
||||
template <size_t N, class S>
|
||||
void to_array(S const &str, std::array<char, N> *out) {
|
||||
auto &result = *out;
|
||||
bts_assert(str.size() <= N);
|
||||
memset(&result[0], ' ', N);
|
||||
@@ -46,13 +46,13 @@ void to_str(std::array<char, N> const &in, std::string *out) {
|
||||
result = std::string(&in[0], N);
|
||||
}
|
||||
|
||||
template <class T> T to(std::string const &str) {
|
||||
template <class T, class S> T to(S const &str) {
|
||||
T result;
|
||||
to_array(str, &result.value());
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class T> void str_to(std::string const &str, T *out) {
|
||||
template <class T,class S> void str_to(S const &str, T *out) {
|
||||
to_array(str, &out->value());
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user