diff --git a/src/server/sparkd/spreader/quoter/quoter_states/QuoterWorkingStateWorker.cpp b/src/server/sparkd/spreader/quoter/quoter_states/QuoterWorkingStateWorker.cpp index 3087462b9..2fb6948d4 100644 --- a/src/server/sparkd/spreader/quoter/quoter_states/QuoterWorkingStateWorker.cpp +++ b/src/server/sparkd/spreader/quoter/quoter_states/QuoterWorkingStateWorker.cpp @@ -53,7 +53,8 @@ void QuoterWorkingStateWorker::update_spreader_order_price (Price price) } void QuoterWorkingStateWorker::update_spreader_order_quantity (Quantity quantity) { - _quoter->_price_quantity_state.update_target_leg_quantity (quantity); /// TODO need, mult + Quantity this_leg_quantity = Quantity (_quoter->_get_equivelant_quantity_from_spreader_quantity (quantity)); + _quoter->_price_quantity_state.update_target_leg_quantity (this_leg_quantity); _longpath_analyze_and_act (bts::orderman::NullTickToTradeCorID); } @@ -65,6 +66,7 @@ void QuoterWorkingStateWorker::_longpath_analyze_and_act (bts::orderman::TickToT // i. fills in this leg (though that should be caught by the status) // ii. fills in other legs causing reduction here // iii. quantity reduction in the spreader order by the user + _quoter->_child_order.cancel (); _quoter->_transform_to_WAITING_FOR_CANCEL_ACK_FINAL (); } else @@ -72,10 +74,11 @@ void QuoterWorkingStateWorker::_longpath_analyze_and_act (bts::orderman::TickToT Price new_price; Quantity new_quantity; _quoter->_compute_price_quantity (new_price, new_quantity); //new_quantity = Quantity(new_quantity.value() + _quoter->_price_quantity_state.aggregated_filled_quantity().value()); - // TODO, some adjustment for filles needed + // TODO, some adjustment for fills needed if (new_quantity.value() == 0) { // no size could be computed, go to wait state + _quoter->_child_order.cancel (); _quoter->_transform_to_WAITING_FOR_CANCEL_ACK_CONTINUE (); } else diff --git a/src/server/sparkd/spreader/quoter/quoter_states/QuoterWorkingStateWorker.h b/src/server/sparkd/spreader/quoter/quoter_states/QuoterWorkingStateWorker.h index e6ee203ea..447516148 100644 --- a/src/server/sparkd/spreader/quoter/quoter_states/QuoterWorkingStateWorker.h +++ b/src/server/sparkd/spreader/quoter/quoter_states/QuoterWorkingStateWorker.h @@ -10,6 +10,8 @@ namespace orderman { class SpreaderOrderUpdateMessage; class Book; class SingleLegQuoter; +// this is steady state where most of the action happens. +// waiting_for_ack on an ack, transforms into this state. class QuoterWorkingStateWorker : public IQuoterStateWorker { private: @@ -30,6 +32,10 @@ public: void update_spreader_order_price (Price new_price) override; void update_spreader_order_quantity (Quantity new_quantity) override; private: + // this does the following in this order + // i. if target reached => cxl order and go to waiting_for_cancel_ack_final + // ii. if computed_qty = 0 => cxl order and go to waiting_for_cancel_ack_continue + // iii. if reprice (ie qty changed or price changed beyond the threshold) => requote void _longpath_analyze_and_act (bts::orderman::TickToTradeCorID); }; }} \ No newline at end of file