quoting qty (from walking the hedging depth) be floor'ed and not rounded
This commit is contained in:
1 parent
7e00d8cce3
commit
75627d0fb3
2 files changed
+9
-3
No files matched your search
@@ -530,9 +530,15 @@ public:
|
||||
// this is the size ratio of the other leg vs this leg
|
||||
double effective_mult = std::abs(other_leg_data.leg_params().quote_params().lean_quantity_ratio() * other_leg_data.size_multiplier() / this_leg_data.size_multiplier());
|
||||
// to be conservative round the required size up
|
||||
double other_leg_target_quantity = std::round(effective_mult * this_leg_target_quantity.value());
|
||||
double other_leg_target_quantity = std::ceil(effective_mult * this_leg_target_quantity.value());
|
||||
SpreaderUtils::traverse_depth_for_quantity(other_leg_book, SpreaderUtils::invert_side (other_leg_data.trading_side()), Quantity(other_leg_target_quantity), other_leg_price, other_leg_quantity);
|
||||
double out_quantity = std::round(other_leg_quantity.value() / effective_mult);
|
||||
// when we floor we essentially go back up the hedging ladder
|
||||
// so we should re-evaluate
|
||||
// ex, consider the hedge book depth with qty's 5, 10, 5, 20, 10 (5 is the inside)
|
||||
// and hedge ratio 20 and target qty = 5, so effectively target = 100,
|
||||
// we get 50 at the last level, out_qty = floor (50/20) = 2, so the
|
||||
// price should not be the last level but the second last level
|
||||
double out_quantity = std::floor(other_leg_quantity.value() / effective_mult);
|
||||
quantity = Quantity (out_quantity);
|
||||
double out_price = (target_spread_price.value() - other_leg_price.value() * other_leg_data.price_multiplier())/this_leg_data.price_multiplier();
|
||||
out_price = bts::securities::raw_round_to_quote_price (out_price, this_leg_data.tick_size(), this_leg_data.trading_side());
|
||||
|
||||
@@ -380,7 +380,7 @@ TEST_CASE ("compute quoting price quantity 2 legs", "[spreader]")
|
||||
LegPropertyData leg_prop_data_2_lm_20 = create_leg_property_data (leg_2, 1, -1.0, true, lean_mult);
|
||||
SpreaderUtils::compute_price_quantity_2_legs (spreader_price, spreader_quantity, leg_prop_data_1, leg_prop_data_2_lm_20, book_2, out_price, out_quantity);
|
||||
bts_assert (out_price.value() == 2502.25);
|
||||
bts_assert (out_quantity.value() == 3); // TODO:check
|
||||
bts_assert (out_quantity.value() == 2); // TODO:check
|
||||
// fractional leg mults
|
||||
lean_mult = 1.5;
|
||||
LegPropertyData leg_prop_data_2_lm_1_5 = create_leg_property_data (leg_2, 1, -1.0, true, lean_mult);
|
||||
|
||||
Reference in new issue
Block a user