First check in, needs to be retofitted to QHO now

This commit is contained in:
Taha Afzal committed 2019-06-10 15:58:10 -04:00
1 parent 7fd8eeb1ff
commit b0886f6b3d
6 files changed
+23 -7

No files matched your search

+1
View File
@@ -184,6 +184,7 @@ message QueueHolderDefinition{
// orders behind the top one (so value
// of 1 means 2 orders in all)
uint32 n_queue_orders = 1;
spark.NullableQuantity show_quantity = 2;
CustomOrderDefinition child=10;
}
message OCOOrderDefinition {
@@ -43,8 +43,12 @@ public:
bts::spark::LegSpreaderParams::MarketDataType md_type() const {
return _leg_params.market_data_type();
}
bool has_show_qty () const{
//return _leg_params.quote_params().has_show_quantity();
return true;
}
uint32_t show_qty () const{
return _leg_params.quote_params().show_quantity()+1;
return _leg_params.quote_params().show_quantity().quantity()+2;
}
uint32_t n_queue_holder_orders() const{
return _leg_params.quote_params().n_queue_holder_orders();
@@ -20,6 +20,8 @@ _two_legged (n_spreader_legs == 2),
_active_quoting(this_leg_property.is_active_quoting()),
_hidden_order(this_leg_property.leg_params().has_quote_params() &&
this_leg_property.leg_params().quote_params().has_quote_hidden()),
_force_show_qty(this_leg_property.n_queue_holder_orders()==0 &&
this_leg_property.has_show_qty()),
_is_permenantly_cancelled (false),
_irrecoverable_error(false),
_n_spreader_legs (n_spreader_legs),
@@ -50,6 +52,7 @@ SingleLegQuoter::SingleLegQuoter(SingleLegQuoter&& other)
_two_legged (other._two_legged),
_active_quoting(other._active_quoting),
_hidden_order(other._hidden_order),
_force_show_qty(other._force_show_qty),
_is_permenantly_cancelled (other._is_permenantly_cancelled),
_irrecoverable_error(other._irrecoverable_error),
_n_spreader_legs (other._n_spreader_legs),
@@ -164,10 +167,9 @@ void SingleLegQuoter::_incorporate_other_leg_fill (size_t, Quantity hedge_reduct
void SingleLegQuoter::_compute_price_quantity(Price& price,
Quantity& quantity){
Quantity remaining_quantity = _price_quantity_state.remaining_to_fill();
remaining_quantity = _this_leg_data.show_qty()==0 ?
remaining_quantity :
Quantity(std::min(remaining_quantity.value(),
_this_leg_data.show_qty()));
if(_force_show_qty)
remaining_quantity = Quantity(std::min(remaining_quantity.value(),
_this_leg_data.show_qty()));
if (_two_legged){
size_t other_leg_index = _this_leg_data.leg_index() == 0 ? 1 : 0;
SpreaderUtils::compute_price_quantity_2_legs (_price_quantity_state.target_spread_price(),
@@ -40,6 +40,7 @@ private:
const bool _two_legged;
const bool _active_quoting;
const bool _hidden_order;
const bool _force_show_qty;
bool _is_permenantly_cancelled;
bool _irrecoverable_error;
// this is a config constant. if the quoter
@@ -46,12 +46,17 @@ bool SpreaderUtils::resolve_synthetic_spread (const SpreaderPreActivationOrderSe
quoter_order_def.set_side(leg_order_side);
quoter_order_def.set_sub_type(bts::api::orderman::OrderSubType::ORDER_SUB_TYPE_QUOTING_LEG);
uint32_t n_queue_holder_orders=leg_params.quote_params().n_queue_holder_orders();
const auto& quote_params=leg_params.quote_params();
uint32_t n_queue_holder_orders=quote_params.n_queue_holder_orders();
if(n_queue_holder_orders>0){
api::orderman::QueueHolderDefinition qho_order_def;
qho_order_def.set_n_queue_orders(n_queue_holder_orders);
qho_order_def.mutable_child()->mutable_limit()->MergeFrom (api::orderman::LimitOrderDefinition());
quoter_order_def.mutable_custom_def()->mutable_queue_holder()->MergeFrom (qho_order_def);
if(quote_params.has_show_quantity() &&
quote_params.show_quantity().quantity()>0){
qho_order_def.mutable_show_quantity()->CopyFrom(quote_params.show_quantity());
}
}
else{
quoter_order_def.mutable_custom_def()->mutable_limit()->MergeFrom (api::orderman::LimitOrderDefinition());
+4 -1
View File
@@ -16,6 +16,9 @@ message QuantityMeasure
}
}
message NullableQuantity{
uint32 quantity = 10;
}
// /*************************************************************************************************/
// /*************************************************************************************************/
// /*************************************Spreader Parameters*****************************************/
@@ -71,7 +74,7 @@ message QuoteParams
// and the user can embed a QHO here)
uint32 n_queue_holder_orders=2000;
// this is the show quantity on the quoter order
uint32 show_quantity = 2010;
NullableQuantity show_quantity = 2010;
}
/*************************************Quote MuteZone***********************************