1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package net.sf.emarket.trade.service;
21
22 import java.io.Serializable;
23 import java.util.List;
24
25 import net.sf.emarket.account.service.NotEnoughCashException;
26 import net.sf.emarket.account.service.NotEnoughPositionsException;
27 import net.sf.emarket.account.service.NotValidAccountException;
28 import net.sf.emarket.order.domain.Order;
29 import net.sf.emarket.order.service.OrderCannotBeFilledException;
30 import net.sf.emarket.order.service.OrderFillQuantityMismatchException;
31 import net.sf.emarket.trade.domain.MarketDepth;
32 import net.sf.emarket.trade.domain.OrderBook;
33 import net.sf.emarket.trade.domain.OrderBookLock;
34 import net.sf.emarket.trade.domain.OrderFill;
35 import net.sf.emarket.trade.domain.OrderMatch;
36 import net.sf.emarket.trade.domain.ReceivedOrder;
37
38 /***
39 * ITradingService implements low level services of the matching engine.
40 * @author snambi
41 */
42 interface ITradingService extends Serializable {
43
44 public ReceivedOrder getReceivedOrderById( String orderId );
45 public void addReceivedOrder( ReceivedOrder order);
46
47 public OrderBookLock lockOrderBook( String symbol);
48 public void releaseOrderBook(String symbol);
49
50 public OrderBook getOrderBook(String symbol);
51 public void updateOrderBook( ReceivedOrder order );
52
53 public List<OrderFill> createOrderFills( List<OrderMatch> matches);
54 public void addMatchedOrders( List<OrderMatch> matches );
55 public List<OrderMatch> getMatchedOrders( ReceivedOrder order );
56 public void updateOrderBook( ReceivedOrder receivedOrder, List<OrderMatch> matches, int matchedQuantity );
57
58 public void matchOrder(Order order);
59 public void sendOrderFills(List<OrderFill> fills) throws OrderCannotBeFilledException, OrderFillQuantityMismatchException;
60 public void sendOrderMatches(List<OrderMatch> matches) throws OrderCannotBeFilledException, NotEnoughCashException, NotValidAccountException, NotEnoughPositionsException;
61
62 public MarketDepth getMarketDepth(String symbol);
63
64 }