Reformat matcher

This commit is contained in:
Tim Kächele 2024-02-03 20:21:40 +01:00
parent 8c33a21052
commit 64b17e0803

View File

@ -12,7 +12,10 @@ module Rex
return trades if highest_buy_order.nil? || lowest_sell_order.nil? return trades if highest_buy_order.nil? || lowest_sell_order.nil?
while highest_buy_order.price >= lowest_sell_order.price while highest_buy_order.price >= lowest_sell_order.price
max_quantity = min(highest_buy_order.remaining_quantity, lowest_sell_order.remaining_quantity) max_quantity = min(
highest_buy_order.remaining_quantity,
lowest_sell_order.remaining_quantity
)
trade = Trade.new( trade = Trade.new(
id: next_trade_id, id: next_trade_id,
buy_order: highest_buy_order, buy_order: highest_buy_order,
@ -28,7 +31,7 @@ module Rex
highest_buy_order = order_book.highest_buy_order highest_buy_order = order_book.highest_buy_order
lowest_sell_order = order_book.lowest_sell_order lowest_sell_order = order_book.lowest_sell_order
return trades if highest_buy_order.nil? || lowest_sell_order.nil? break if highest_buy_order.nil? || lowest_sell_order.nil?
end end
trades trades