fix: running_cost accumulation in 'change_unit_qty' method
This commit is contained in:
1 parent
e413ad216e
commit
391b8ece7a
1 file changed
+3
-2
@@ -103,13 +103,14 @@ inline void change_unit_qty(
|
||||
bts_assert(unit_remainder > 0);
|
||||
if (it->quantity.value() < unit_remainder) {
|
||||
running_qty += it->quantity.value();
|
||||
running_cost = it->price * it->quantity.value();
|
||||
running_cost += it->price * it->quantity.value();
|
||||
} else {
|
||||
auto qty_in_lev = it->quantity.value();
|
||||
if (running_qty > 0) {
|
||||
running_cost += it->price * unit_remainder;
|
||||
book_out.emplace_back(running_cost, MDP3Quantity(1));
|
||||
qty_in_lev -= unit_remainder;
|
||||
running_cost = md::INT_ZERO;
|
||||
running_qty = 0;
|
||||
}
|
||||
auto unit_lev_remainder = qty_in_lev / unit_qty.value();
|
||||
@@ -146,4 +147,4 @@ void compute_synthetic_book(
|
||||
Book& book_out,
|
||||
const std::vector<std::tuple<MDP3Quantity, md::IntPrice, Book>>& leg_mkts,
|
||||
uint32_t depth);
|
||||
} // namespace bts::spartan::mdp3::book_utils
|
||||
} // namespace bts::spartan::mdp3::book_utils
|
||||
Reference in new issue
Block a user