net.sf.emarket.order.service
Class OrderManagerServiceImpl
java.lang.Object
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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
OrderManagerServiceImpl
public OrderManagerServiceImpl()
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
.
- determine how many cash transfers are needed
- collect money from BUY accounts
- collect positions from SELL accounts
- Transfer cash from BUY account to SELL account
- 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.