SPARK-1175, Picked price of the resting rather than the aggressor
This commit is contained in:
1 parent
7a74c5852a
commit
1b100bccf7
4 files changed
+15
-2
No files matched your search
@@ -99,7 +99,10 @@ void OrderMatcher::update(std::string const &clordid, Price price, Quantity qty,
|
||||
bts_assert(order);
|
||||
|
||||
auto order_cpy = *order;
|
||||
|
||||
order_cpy.set_price(price.value());
|
||||
*order_cpy.mutable_last_update_time() = utils::pb::pb_now();
|
||||
|
||||
if (order_cpy.quantity() != qty.value()) {
|
||||
order_cpy.set_quantity(qty.value());
|
||||
order_cpy.set_open_quantity(qty.value());
|
||||
@@ -191,7 +194,13 @@ void OrderMatcher::match(std::vector<Order> *out) {
|
||||
}
|
||||
|
||||
void OrderMatcher::match(Order *bid, Order *ask) {
|
||||
auto price = Price(ask->price());
|
||||
Price price(0);
|
||||
|
||||
if (utils::pb::greater(bid->last_update_time(), ask->last_update_time()))
|
||||
price = Price(ask->price());
|
||||
else
|
||||
price = Price(bid->price());
|
||||
|
||||
Quantity quantity;
|
||||
|
||||
if (bid->open_quantity() > ask->open_quantity())
|
||||
|
||||
Reference in new issue
Block a user