Added a couple more digits to exchange price encoding.

This commit is contained in:
Pedro Pinto committed 2018-06-15 09:51:07 -04:00
1 parent 2dd8e64272
commit 0a8bee2c31
2 files changed
+17 -12

No files matched your search

@@ -282,7 +282,7 @@ void NativeOrder::on_activate(Price p, Quantity q,
me->state.set_filled_quantity(0);
me->state.set_last_price(0);
me->state.set_avg_price(0);
me->session_services = &me->services->get_session_services(
get_native_state(me->state).routing_record().session());
me->price_encoding_precision =
@@ -357,8 +357,8 @@ void NativeOrder::on_activate(Price p, Quantity q,
case CustomOrderDefinition::kStopLimit:
me->create_price_bm = encoding.overwrite(
me->create_price_bm,
securities::encode_exchange_price(*me->sec, p).value(), 7,
price_sz());
securities::encode_exchange_price(*me->sec, p).value(),
me->price_encoding_precision, price_sz());
break;
case CustomOrderDefinition::kStop:
case CustomOrderDefinition::kMarket:
@@ -484,11 +484,12 @@ void NativeOrder::on_update(Price p, Quantity q, TickToTradeCorID cid) {
// are we under the messaging threshold?
if (!me->session_services->governor().can_send()) {
LOG(OrderMan, Warn, "Cannot update order {} because of messaging limits. ",
LOG(OrderMan, Warn,
"Cannot update order {} because of messaging limits. ",
key().value());
auto msg = "Messaging threshold breached";
if (parent_key() == null_order_key())
transition(me->state.status(),msg);
transition(me->state.status(), msg);
else {
me->state.set_last_msg(msg);
on_cancel(cid);
@@ -500,8 +501,8 @@ void NativeOrder::on_update(Price p, Quantity q, TickToTradeCorID cid) {
auto &encoding = me->update_encoding;
me->update_price_bm = encoding.overwrite(
me->update_price_bm,
securities::encode_exchange_price(*me->sec, p).value(), 7,
price_sz());
securities::encode_exchange_price(*me->sec, p).value(),
me->price_encoding_precision, price_sz());
me->update_quantity_bm =
encoding.overwrite(me->update_quantity_bm, q.value(), quantity_sz());
@@ -829,8 +830,10 @@ void NativeOrder::init_fix() {
cancel_encoding.add<fix::OrdType>(NATIVE_ORDER_TYPE_LIMIT);
// price
me->create_price_bm = create_encoding.add<fix::Price>(0, 7, price_sz());
me->update_price_bm = update_encoding.add<fix::Price>(0, 7, price_sz());
me->create_price_bm = create_encoding.add<fix::Price>(
0, me->price_encoding_precision, price_sz());
me->update_price_bm = update_encoding.add<fix::Price>(
0, me->price_encoding_precision, price_sz());
break;
case CustomOrderDefinition::kStop: {
@@ -862,8 +865,10 @@ void NativeOrder::init_fix() {
update_encoding.add<fix::StopPx>(encoded_stop_px, -1, -1);
// price
me->create_price_bm = create_encoding.add<fix::Price>(0, 7, price_sz());
me->update_price_bm = update_encoding.add<fix::Price>(0, 7, price_sz());
me->create_price_bm = create_encoding.add<fix::Price>(
0, me->price_encoding_precision, price_sz());
me->update_price_bm = update_encoding.add<fix::Price>(
0, me->price_encoding_precision, price_sz());
break;
}
default: