net.sf.emarket.trade.domain
Class OrderBook
java.lang.Object
net.sf.emarket.trade.domain.OrderBook
public class OrderBook
- extends java.lang.Object
OrderBook
arranges the orders according to their price, in their precedence.
buy size price sell size
---------------------------------------
31.8 20
31.7 3
31.6 8
31.5
31.4 10
5 31.3
20 31.2
40 31.1
- Author:
- nambi sankaran
Constructor Summary |
OrderBook(java.lang.String symbol)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
limitPriceComparator
public static java.util.Comparator<? super Order> limitPriceComparator
timeComparator
public static java.util.Comparator<Order> timeComparator
OrderBook
public OrderBook(java.lang.String symbol)
getSymbol
public java.lang.String getSymbol()
loadOrders
public void loadOrders(java.util.List<ReceivedOrder> orders)
getQuote
public Quote getQuote(Quote quote)
getQuote
public Quote getQuote()
getBuyPriceDepths
public java.util.List<PriceDepth> getBuyPriceDepths(int level)
getSellPriceDepths
public java.util.List<PriceDepth> getSellPriceDepths(int level)
findMatchingOrders
public int findMatchingOrders(ReceivedOrder order,
java.util.List<ReceivedOrder> matchedOrders)
findMatchingOrders
creates a list of matching orders from order book.
If there are no matches, the list is empty.
The list simply contains a list of orders, that contains the list of matching orders.
This method doesn't take care of partial matches.
- Parameters:
order
-
- Returns:
Copyright © 2009. All Rights Reserved.