ticks in net change working now, by transforming the spread
This commit is contained in:
1 parent
76a1367510
commit
b2d1969e9f
3 files changed
+18
-4
No files matched your search
@@ -163,7 +163,7 @@ public:
|
||||
_settlement_price,
|
||||
_leg_property_data.tick_size(),
|
||||
_leg_property_data.md_type(),
|
||||
_leg_property_data.price_calc(),
|
||||
bts::api::SyntheticContract::PRICECALC_STANDARD,
|
||||
_book);
|
||||
}
|
||||
void update_settlement_price(md::IntPrice price){
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
_settlement_price,
|
||||
_leg_property_data.tick_size(),
|
||||
_leg_property_data.md_type(),
|
||||
_leg_property_data.price_calc(),
|
||||
bts::api::SyntheticContract::PRICECALC_STANDARD,
|
||||
_book);
|
||||
|
||||
}
|
||||
|
||||
@@ -25,8 +25,9 @@ bool SpreaderUtils::resolve_synthetic_spread (const SpreaderPreActivationOrderSe
|
||||
&order_def.custom_def().spreader().security();
|
||||
if (sec_ptr != nullptr){
|
||||
const spark::ExecutionStrategy& execution_strategy = order_def.custom_def().spreader().execution_strategy();
|
||||
const bts::api::Security& sec = *sec_ptr;
|
||||
bts::api::Security sec = *sec_ptr;
|
||||
if (sec.has_synthetic() && sec.synthetic().legs().size() > 0){
|
||||
transform_spread_price_mults(sec);
|
||||
size_t leg_idx = 0;
|
||||
for (auto it = sec.synthetic().legs().begin(); it != sec.synthetic().legs().end(); ++it){
|
||||
const bts::api::ContractLeg& leg = *it;
|
||||
@@ -81,7 +82,18 @@ bool SpreaderUtils::resolve_synthetic_spread (const SpreaderPreActivationOrderSe
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void SpreaderUtils::transform_spread_price_mults (api::Security& sec){
|
||||
if(sec.has_synthetic() &&
|
||||
sec.synthetic().price_calc()==api::SyntheticContract::PRICECALC_NET_CHANGE){
|
||||
for(int i=0;i<sec.synthetic().legs_size();i++){
|
||||
api::ContractLeg* leg_ptr=sec.mutable_synthetic()->mutable_legs(i);
|
||||
double tick_size=leg_ptr->security().contract_spec().low_tick(),
|
||||
price_mult=leg_ptr->price_multiplier(),
|
||||
new_mult=price_mult/tick_size;
|
||||
leg_ptr->set_price_multiplier(new_mult);
|
||||
}
|
||||
}
|
||||
}
|
||||
std::string SpreaderUtils::book_to_str(const bts::orderman::Book& book,
|
||||
api::Side side){
|
||||
std::ostringstream oss;
|
||||
|
||||
@@ -77,6 +77,8 @@ public:
|
||||
std::vector<bts::api::orderman::OrderDefinition>& out_quoter_defs,
|
||||
std::vector<bts::api::orderman::OrderDefinition>& out_hedger_defs,
|
||||
bool resolve_synthetic = true);
|
||||
// for each leg, changes its price_mult to price_mult/leg_tick_size
|
||||
static void transform_spread_price_mults (api::Security& sec);
|
||||
////////////////////////////////////////////////////
|
||||
// orders //////////////////////////////////////////
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
Reference in new issue
Block a user