MultiBitExchange
MultiBitExchange copied to clipboard
can market order exist in order book?
private Optional<Trade> tryToTrade(Order order, Order bestCounterOrder) { if (bestCounterOrder.isLimitOrder()) { LimitOrder bestCounterLimitOrder = (LimitOrder) bestCounterOrder; ItemPrice limitPrice = bestCounterLimitOrder.getLimitPrice(); if (order.crossesAt(limitPrice)) { Trade trade = createTrade(order, bestCounterOrder, limitPrice); return Optional.of(trade); } } return Optional.absent(); }
The code imply there is no market book in order book.
if a market order want to buy 300, there is only 200 in counter order book, how to save the remaining 100 in order book? because it don't have a price, I suggest that use null as key to save market order, the process of match is: firstly match with key is null ones, then the top order.