The method sendOrder
of the OrderService
is responsible for placing Orders. This method takes an Order Entity or Order Value Object as parameter.
Sending an order using and Order Entity looks like this:
MarketOrder order = MarketOrder.Factory.newInstance(); order.setStrategy(strategy); order.setAccount(account); order.setSecurity(security); order.setQuantity(orderQuantity); order.setSide(Side.BUY);
getOrderService().sendOrder(order);
The associated Entities (i.e. strategy, account and security) can be retrieved via the LookupService
.
Sending an order using Order Value Objects looks like this:
MarketOrderVO order = MarketOrderVOBuilder.create() .setStrategyId(strategyId) .setAccountId(accountId) .setSecurityId(securityId) .setQuantity(orderQuantity) .setSide(Side.BUY) .build();
getOrderService().sendOrder(order);
For further details see chapter Order Management in the AlgoTrader documentation.
Comments
0 comments
Please sign in to leave a comment.