net.sf.emarket.order.service
Class OrderManagerServiceImpl

java.lang.Object
  extended by net.sf.emarket.order.service.OrderManagerServiceImpl
All Implemented Interfaces:
java.io.Serializable, IOrderManagerService

public class OrderManagerServiceImpl
extends java.lang.Object
implements IOrderManagerService

See Also:
Serialized Form

Constructor Summary
OrderManagerServiceImpl()
           
 
Method Summary
 float calculateCommision(Account account, Order order)
           
 void executeMatches(java.util.List<OrderMatch> matches)
          executeMatches() transfers the positions and cash after order execution.
 void fillOrders(java.util.List<OrderFill> fills)
          fillOrders .
 java.util.List<Order> getExecutedOrdersForAcctId(java.lang.String acctId)
           
 java.util.List<Order> getOpenOrdersForAcctId(java.lang.String acctId)
           
 Order placeOrder(Order order)
           
 void setAccountManager(IAccountManagerService acctMgrSvc)
           
 void setMailSender(IMailSenderService mailSender)
           
 void setOrderDao(IOrderDao dao)
           
 void setOrderExecutor(IOrderExecutorService executor)
           
 void setQuoteManager(IQuoteManagerService quoteMgrSvr)
           
 void setTemplateMessage(org.springframework.mail.SimpleMailMessage templateMessage)
           
 void setUserManager(IUserManagerService mgr)
           
 Order verifyOrder(Order order)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrderManagerServiceImpl

public OrderManagerServiceImpl()
Method Detail

setOrderDao

public void setOrderDao(IOrderDao dao)

setUserManager

public void setUserManager(IUserManagerService mgr)

setAccountManager

public void setAccountManager(IAccountManagerService acctMgrSvc)

setQuoteManager

public void setQuoteManager(IQuoteManagerService quoteMgrSvr)

setOrderExecutor

public void setOrderExecutor(IOrderExecutorService executor)

setMailSender

public void setMailSender(IMailSenderService mailSender)

setTemplateMessage

public void setTemplateMessage(org.springframework.mail.SimpleMailMessage templateMessage)

placeOrder

@Transactional(propagation=REQUIRED,
               readOnly=false)
public Order placeOrder(Order order)
                 throws AccountNotActiveException,
                        InSufficientCashBalanceException,
                        NotEnoughPositionsException,
                        InstrumentCannotTradeException,
                        WrongLimitPriceExeption
Specified by:
placeOrder in interface IOrderManagerService
Throws:
AccountNotActiveException
InSufficientCashBalanceException
NotEnoughPositionsException
InstrumentCannotTradeException
WrongLimitPriceExeption

verifyOrder

@Transactional(propagation=REQUIRED,
               readOnly=false)
public Order verifyOrder(Order order)
                  throws AccountNotActiveException,
                         InSufficientCashBalanceException,
                         NotEnoughPositionsException,
                         InstrumentCannotTradeException,
                         WrongLimitPriceExeption
Specified by:
verifyOrder in interface IOrderManagerService
Throws:
AccountNotActiveException
InSufficientCashBalanceException
NotEnoughPositionsException
InstrumentCannotTradeException
WrongLimitPriceExeption

calculateCommision

public float calculateCommision(Account account,
                                Order order)

getOpenOrdersForAcctId

public java.util.List<Order> getOpenOrdersForAcctId(java.lang.String acctId)
Specified by:
getOpenOrdersForAcctId in interface IOrderManagerService

getExecutedOrdersForAcctId

public java.util.List<Order> getExecutedOrdersForAcctId(java.lang.String acctId)
Specified by:
getExecutedOrdersForAcctId in interface IOrderManagerService

fillOrders

@Transactional(propagation=REQUIRED,
               readOnly=false)
public void fillOrders(java.util.List<OrderFill> fills)
                throws OrderCannotBeFilledException,
                       OrderFillQuantityMismatchException
fillOrders .
  1. determine how many cash transfers are needed
  2. collect money from BUY accounts
  3. collect positions from SELL accounts
  4. Transfer cash from BUY account to SELL account
  5. Transfer position from SELL account from BUY account

Specified by:
fillOrders in interface IOrderManagerService
Throws:
OrderCannotBeFilledException
OrderFillQuantityMismatchException

executeMatches

public void executeMatches(java.util.List<OrderMatch> matches)
                    throws OrderCannotBeFilledException,
                           NotEnoughCashException,
                           NotValidAccountException,
                           NotEnoughPositionsException
executeMatches() transfers the positions and cash after order execution. This method is a short term hack. This will be replaced by fillOrder() and a corresponding clearing system.

Specified by:
executeMatches in interface IOrderManagerService
Parameters:
matches -
Throws:
OrderCannotBeFilledException
NotValidAccountException
NotEnoughCashException
NotEnoughPositionsException


Copyright © 2009. All Rights Reserved.