public class OrderBook
Modifier and Type | Class and Description |
---|---|
protected static class |
OrderBook.Key
For system use only.
|
Modifier and Type | Field and Description |
---|---|
static Fun_0_2 <Order,Order,Int> |
HIGHERS_FIRST
Field Type: (plham.Order,plham.Order)=>Int
|
static Fun_0_2 <Order,Order,Int> |
LOWERS_FIRST
Field Type: (plham.Order,plham.Order)=>Int
|
protected Set<OrderBook.Key> |
cancelCache
A cache for cancel management.
|
SortedQueue<Order> |
queue |
Time |
time |
Constructor and Description |
---|
OrderBook(Fun_0_2 <Order,Order,Int> comparator)
Declaration: this(comparator:(plham.Order,plham.Order)=>Int):plham.OrderBook.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Order order) |
void |
cancel(Order order)
Cancel the order.
|
void |
dump()
Dump this orderbook with the time-stamp in an undefined order.
|
void |
dump(Fun_0_2 <Order,Order,Int> comparator)
Declaration: dump(comparator:(plham.Order,plham.Order)=>Int):void.
Dump this orderbook with the time-stamp in the specified order.
|
static void |
dump(Iterator<Order> it,
Long time) |
static void |
dump(List<Order> orders,
Long time) |
Order |
getBestOrder()
Get the order at the best bid(buy)/ask(sell).
|
Double |
getBestPrice()
Get the price of the best bid(buy)/ask(sell) order.
|
protected Long |
getTime() |
Boolean |
isCancelled(Order order)
Test if the order (having
agentId and orderId ) is requested for cancel. |
static void |
main(Rail<String> id$24) |
protected void |
popUntil()
For system use only.
|
void |
remove(Order order) |
Boolean |
removeAllWhere(Fun_0_1 <Order,Boolean> p)
Declaration: removeAllWhere(p:(plham.Order)=>Boolean):Boolean.
Remove all orders satisfying the condition
p . |
protected void |
setTime(Time time) |
Long |
size() |
List<Order> |
toList()
Get all orders in this orderbook sorted in an undefined order.
|
List<Order> |
toList(Fun_0_2 <Order,Order,Int> comparator)
Declaration: toList(comparator:(plham.Order,plham.Order)=>Int):List[plham.Order].
Get all orders in this orderbook sorted in the specified order.
|
public SortedQueue<Order> queue
public Time time
protected Set<OrderBook.Key> cancelCache
public static final Fun_0_2 <Order,Order,Int> LOWERS_FIRST
protected void setTime(Time time)
protected Long getTime()
protected void popUntil()
public Long size()
public void add(Order order)
public void remove(Order order)
public Order getBestOrder()
public Boolean removeAllWhere(Fun_0_1 <Order,Boolean> p)
Remove all orders satisfying the condition
p
.public Double getBestPrice()
public void cancel(Order order)
plham.Cancel
instead.order
- a cancel requestpublic Boolean isCancelled(Order order)
agentId
and orderId
) is requested for cancel.order
- plham.Cancel
public static void dump(Iterator<Order> it, Long time)
public static void dump(List<Order> orders, Long time)
public void dump()
public void dump(Fun_0_2 <Order,Order,Int> comparator)
Dump this orderbook with the time-stamp in the specified order.
public List<Order> toList()
public List<Order> toList(Fun_0_2 <Order,Order,Int> comparator)
Get all orders in this orderbook sorted in the specified order.
public static void main(Rail<String> id$24)