integrated with SingleLegquoter._compute_price_quantity
This commit is contained in:
1 parent
9d96fcaa45
commit
d3ed6e21e4
4 files changed
+89
No files matched your search
@@ -171,6 +171,17 @@ void SingleLegQuoter::_compute_price_quantity(Price& price,
|
||||
_drivers_temp_usage,
|
||||
price,
|
||||
quantity);
|
||||
if(!_apply_quote_entry_params(price, quantity))
|
||||
quantity=Quantity(0);
|
||||
}
|
||||
bool SingleLegQuoter::_apply_quote_entry_params(
|
||||
Price new_price,
|
||||
Quantity new_quantity){
|
||||
return SpreaderUtils::conditional_quoting(
|
||||
new_price,
|
||||
new_quantity,
|
||||
_this_leg_data.leg_index(),
|
||||
_spreader);
|
||||
}
|
||||
void SingleLegQuoter::_adjust_for_hidden_order(Price& price,
|
||||
Quantity& quantity){
|
||||
|
||||
@@ -181,6 +181,17 @@ private:
|
||||
// this is the function that computes the quoting price and the
|
||||
// quantity for this leg.
|
||||
void _compute_price_quantity(Price& price, Quantity& quantity);
|
||||
// applies the applicable throttling params that are
|
||||
// parts of the quoting params
|
||||
void _apply_quote_throttling_params (
|
||||
Price new_price, Quantity new_quantity,
|
||||
Price& out_price, Quantity& out_quantity);
|
||||
// applies the applicable quoting params that control
|
||||
// whether there should be a quote out there or not.
|
||||
// returns false is the quote shoudl not be out
|
||||
// there
|
||||
bool _apply_quote_entry_params (
|
||||
Price new_price, Quantity new_quantity);
|
||||
// this takes in a price and qty that already has
|
||||
// computed values and applies the hidden order logic
|
||||
// to them (ie if the price results in a cross, and adjusts
|
||||
|
||||
@@ -238,6 +238,12 @@ public:
|
||||
price_qty = Quantity(0); cumm_qty = Quantity(0);
|
||||
return false;
|
||||
}
|
||||
// find the top of the synthetic book
|
||||
static Price top_of_book_price (const ISpreaderManager&,
|
||||
api::Side){
|
||||
Price rv(os::nan());
|
||||
return rv;
|
||||
}
|
||||
////////////////////////////////////////////////////
|
||||
// quoting params //////////////////////////////////
|
||||
////////////////////////////////////////////////////
|
||||
@@ -270,6 +276,66 @@ public:
|
||||
else
|
||||
return false;
|
||||
}
|
||||
static bool conditional_quoting(Price quoting_price,
|
||||
Quantity quoting_qty,
|
||||
size_t leg_idx,
|
||||
const ISpreaderManager& spreader){
|
||||
const auto& leg_data=spreader.get_leg_data(leg_idx);
|
||||
const auto& leg_params=leg_data.leg_params();
|
||||
if(leg_params.has_quote_params() &&
|
||||
leg_params.quote_params().has_conditional_quoting()){
|
||||
const auto& cond_quoting_params=
|
||||
leg_params.quote_params().conditional_quoting();
|
||||
// if(cond_quoting_params.price_type()==spark::ConditionalQuoting::LEG)
|
||||
// TODO: does the same thing regardless,
|
||||
return conditional_quoting_leg(quoting_price,
|
||||
quoting_qty,
|
||||
leg_data.trading_side(),
|
||||
leg_data.tick_size(),
|
||||
spreader.get_book(leg_idx),
|
||||
cond_quoting_params.n_ticks());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// applies the conditional quoting logic, when the
|
||||
// setting applies to the quoting leg.
|
||||
// if the calculated quoting price (first arg)
|
||||
// is not n ticks within (or through, depending
|
||||
// on the value of n_ticks) it returns false
|
||||
static bool conditional_quoting_leg (Price quoting_price,
|
||||
Quantity,
|
||||
api::Side quote_side,
|
||||
double tick_size,
|
||||
const Book& book,
|
||||
int n_ticks){
|
||||
if(quote_side==api::SIDE_BUY){
|
||||
const md::PriceSize& top_ask=book.ask()[0];
|
||||
if(top_ask.size()==0)
|
||||
return false;
|
||||
int t_diff=securities::price_diff_to_ticks(
|
||||
top_ask.price(),
|
||||
quoting_price.value(),
|
||||
tick_size);
|
||||
if(n_ticks<0)
|
||||
return t_diff<0 && t_diff>=std::abs(n_ticks);
|
||||
else
|
||||
return t_diff<0 || t_diff>=n_ticks;
|
||||
}
|
||||
else{
|
||||
const md::PriceSize& top_bid=book.bid()[0];
|
||||
if(top_bid.size()==0)
|
||||
return false;
|
||||
int t_diff=securities::price_diff_to_ticks(
|
||||
quoting_price.value(),
|
||||
top_bid.price(),
|
||||
tick_size);
|
||||
if(n_ticks<0)
|
||||
return t_diff<0 && t_diff>=std::abs(n_ticks);
|
||||
else
|
||||
return t_diff<0 || t_diff>=n_ticks;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// pre-hedge params ////////////////////////////////
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
@@ -67,6 +67,7 @@ message QuoteParams
|
||||
QuoteInsideMarketDistanceWithTravel quote_inside_market_distance_with_travel = 1030;
|
||||
QuoteMaxOrderMove quote_max_order_move = 1040;
|
||||
QuoteHidden quote_hidden = 1050;
|
||||
ConditionalQuoting conditional_quoting=1060;
|
||||
}
|
||||
|
||||
/*************************************Quote MuteZone***********************************
|
||||
|
||||
Reference in new issue
Block a user