Creating orders for the strategy
After the strategy instance has been created, use the StrategyInterface to create new orders and to handle existing orders.
The StrategyInterface supports the following methods:
create()– Creates a new order for the strategy instance.
amend()– Amends an order currently being handled by the strategy instance.
cancel()– Cancels an order currently being handled by the strategy instance.
stopStrategy()– Stops the strategy instance. If child orders exist in the market these will be pulled before the strategy is stopped.
getStrategyName()– Returns the name of the strategy.
getParentOrder()– Returns the parent order from the strategy for the
OrderId provided.
Once the new order has been received and validated by the application, the create() action is called to create new order with the Strategy. This action takes a success and a failure callback action. If there was an error creating the order with the Strategy, then the failure callback will be called with the OrderId and an appropriate error message. If the order was successful, the success callback is called with the ParentOrderContainer object.
There are various actions that can be performed on the ParentOrderContainer to assist the user in creating an algorithm to execute the order. These include:
makeChildOrder()– This is the primary function that is used to create the underlying child orders.
amendChildOrder()– Amends a specific child order given a specific
OrderId.
cancelChildOrder()– Cancels a specific child order given a specific
OrderId.
cancelChildOrders()– Cancels child orders given a list of
OrderIds
cancelAllChildOrdersFromDestination()– Cancels all child orders made to a given destination
cancelAllChildOrders() – Cancels all active child orders
Other actions are available to get to get details about the order itself such as the quantity, price, side, type of order, quantity remaining, quantity working, etc.