From 995be6cfd0630e2ace293c72ed03b41c4ee66753 Mon Sep 17 00:00:00 2001 From: Pedro Pinto Date: Tue, 29 Jan 2019 14:53:53 -0500 Subject: [PATCH 1/3] Added forgotten security count metric back. --- src/lib/orderman/actors/MDSource.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/orderman/actors/MDSource.h b/src/lib/orderman/actors/MDSource.h index ea2f3481f..60abc6990 100644 --- a/src/lib/orderman/actors/MDSource.h +++ b/src/lib/orderman/actors/MDSource.h @@ -80,6 +80,7 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor { switch (ev.md_type) { case MDRequestType::BOOK: on_book_sub(k, *synthetic_count_metric); + security_count_metric->set(_handles.size()); break; case MDRequestType::TICKER: on_ticker_sub(k, *ticker_channel_cout_metric); From fdf255a7a3922cffa2f35915455e4622eca0ee26 Mon Sep 17 00:00:00 2001 From: Pedro Pinto Date: Tue, 29 Jan 2019 14:58:13 -0500 Subject: [PATCH 2/3] Improved md performance logs. --- src/lib/orderman/actors/MDSource.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/lib/orderman/actors/MDSource.h b/src/lib/orderman/actors/MDSource.h index 60abc6990..a92b795fb 100644 --- a/src/lib/orderman/actors/MDSource.h +++ b/src/lib/orderman/actors/MDSource.h @@ -14,6 +14,7 @@ #include "lib/tracing/PerfLog.h" #include "lib/tracing/bts_trace.h" #include "lib/utils/TimeStamp.h" +#include "lib/domain_model/Security.h" #include @@ -107,6 +108,8 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor { book._security_key = SecurityKey(handle.key()); trace::CorID trace{h.external_event_channel, handle.sequence()}; _perf_log.log(trace, h.last, "md", handle.key()); + _perf_log.log(trace, "md_r", h.last, h.symbol->c_str(), + handle.key()); publish(_book_update, book, trace); } } @@ -123,7 +126,7 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor { if (trade.key() == per_sec_ev.key().value()) { trade_count++; per_sec_ev.trades.emplace_back(TickerUpdateEvent::Trade{ - datetime::utc_ll_to_timepoint(trade.time()), + datetime::utc_ll_to_timepoint(trade.time()), Price(md::IntPrice(trade.mantissa(), (int8_t)trade.exponent()) .price()), @@ -162,7 +165,9 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor { auto handle = _md_consumer.get_handle(k); _handles.push_back({utils::TimeStamp(), handle, - get_external_event_channel(handle.get_usersymbol())}); + get_external_event_channel(handle.get_usersymbol()), + std::make_unique(securities::descriptor( + handle.get_normalized_security()))}); if (handle.is_synthetic()) synthetic_count_metric.increment(); } @@ -203,10 +208,11 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor { "key: {}", user_symbol.to_string(), sk.value()); -// We do not want to get old trades so we drain the trades buffer at -// this point. This makes the first subscription to a channel -// consistent with subsquent ones in terms of late join semantics. - ChannelRecord c {0, _md_consumer.get_channel(user_symbol), {}, user_symbol} ; + // We do not want to get old trades so we drain the trades buffer at + // this point. This makes the first subscription to a channel + // consistent with subsquent ones in terms of late join semantics. + ChannelRecord c{ + 0, _md_consumer.get_channel(user_symbol), {}, user_symbol}; _trades_buffer.Clear(); c.cursor = c.channel.read_trades(_trades_buffer, c.cursor); c.securities.push_back(sk); @@ -216,6 +222,7 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor { utils::TimeStamp last; md::MDConsumerHandle handle; const char *external_event_channel; + std::unique_ptr symbol; }; boost::container::small_vector _handles; From 18d3c268def50c19ab7e252ec35e23018eeaf664 Mon Sep 17 00:00:00 2001 From: Taha Afzal Date: Tue, 29 Jan 2019 15:51:16 -0500 Subject: [PATCH 3/3] Added trace corID to first quote udpate call (after getting the first ack) --- .../spreader_orders/spreader/SpreaderChildOrderState.cpp | 2 ++ .../spreader_orders/spreader/SpreaderChildOrderState.h | 7 +++++++ .../quoter/quoter_states/QuoterWorkingStateWorker.cpp | 7 +++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/lib/orderman/orders/spreader_orders/spreader/SpreaderChildOrderState.cpp b/src/lib/orderman/orders/spreader_orders/spreader/SpreaderChildOrderState.cpp index 97aae369d..409997d54 100644 --- a/src/lib/orderman/orders/spreader_orders/spreader/SpreaderChildOrderState.cpp +++ b/src/lib/orderman/orders/spreader_orders/spreader/SpreaderChildOrderState.cpp @@ -22,6 +22,7 @@ _filled_quantity(src._filled_quantity), _last_filled_price(src._last_filled_price), _last_reported_order_price(src._last_reported_order_price), _last_filled_quantity(src._last_filled_quantity), +_last_update_trace(src._last_update_trace), _out_price(src._out_price), _out_quantity(src._out_quantity), _order_place_time(src._order_place_time) @@ -54,6 +55,7 @@ void SpreaderChildOrderState::re_init (ChildOrder& child_order){ _last_filled_price = Price(0); _last_reported_order_price=Price(0); _last_filled_quantity = Quantity(0); + _last_update_trace=trace::CorID(); _out_price = Price(0); _out_quantity = Quantity(0); _order_place_time=bts::TimeStamp(); diff --git a/src/lib/orderman/orders/spreader_orders/spreader/SpreaderChildOrderState.h b/src/lib/orderman/orders/spreader_orders/spreader/SpreaderChildOrderState.h index 9aaebea89..f818c2cc6 100644 --- a/src/lib/orderman/orders/spreader_orders/spreader/SpreaderChildOrderState.h +++ b/src/lib/orderman/orders/spreader_orders/spreader/SpreaderChildOrderState.h @@ -44,6 +44,9 @@ private: Price _last_filled_price; Price _last_reported_order_price; Quantity _last_filled_quantity; + // this is the trace of the order event + // from the last on_order_update call + trace::CorID _last_update_trace; // this is latest price, qty sent out Price _out_price; Quantity _out_quantity; @@ -113,6 +116,9 @@ public: bts::TimeStamp order_place_time() const{ return _order_place_time; } + const trace::CorID& last_update_trace() const{ + return _last_update_trace; + } // init /////////////////// /////////////////////////// // this assignes a new order, and subsumes the earlier order's @@ -134,6 +140,7 @@ public: - _filled_quantity.value()); _last_filled_price = Price(e.last_price); _last_reported_order_price=Price(e.price); + _last_update_trace=e.trace; SpreaderUtils::compute_average_price(_filled_price, _filled_quantity, _last_filled_price, diff --git a/src/lib/orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterWorkingStateWorker.cpp b/src/lib/orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterWorkingStateWorker.cpp index abe5d6208..ddc8246d6 100644 --- a/src/lib/orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterWorkingStateWorker.cpp +++ b/src/lib/orderman/orders/spreader_orders/spreader/quoter/quoter_states/QuoterWorkingStateWorker.cpp @@ -17,7 +17,9 @@ void QuoterWorkingStateWorker::on_transition (){ // waiting for the ack, things could have changed (namely // fills in other legs, books, order qty change), hence // we analyze and potentially modify/cxl immediatly - _longpath_analyze_and_act (); + trace::CorID ack_message_trace_id= + _quoter->_child_order_state.last_update_trace(); + _longpath_analyze_and_act (ack_message_trace_id); } void QuoterWorkingStateWorker::one_time_activate (Price, Quantity){ @@ -25,10 +27,11 @@ void QuoterWorkingStateWorker::one_time_activate (Price, } void QuoterWorkingStateWorker::on_order_update (const SpreaderChildOrderState& u){ bts_assert (u.acknowledged()); + trace::CorID ack_message_trace_id=u.last_update_trace(); if (u.terminal_status()) _quoter->_transform_to_END (); else - _longpath_analyze_and_act (); + _longpath_analyze_and_act (ack_message_trace_id); } void QuoterWorkingStateWorker::on_book (size_t, const bts::orderman::Book&,