Class OCOStrategy

  • All Implemented Interfaces:

    public class OCOStrategy
    extends MotifOrderStrategy

    Represents the contingent order strategy One Cancels the Other.

    The structure of this order is defined as:

    • Stop Loss
    • Take Profit
    • Constructor Detail

      • OCOStrategy

        public OCOStrategy​( trade,
                           String tradingSubProtocol,
                           String currencyPair,
                           String user,
                           String toboUser,
                           String remarks,
                           Set<AlertType> alertTypes,
                           String requestId,
                           String account,
                           List<Order> orders,
                           ActivationDate activationDate,
                           ExpirationDate expirationDate)
        Creates a new OCOStrategy from the provided parameters.
        trade - The underlying Trading DataSource trade object containing the raw field map that this strategy will be built from.
        tradingSubProtocol - The trading sub protocol, used to determine small variations of OrderStrategy.
        currencyPair - The currency pair for the strategy. All child orders in an OCO strategy are expected to relate to the same currency pair.
        user - The user who submitted the strategy.
        toboUser - The trade on behalf of user.
        remarks - The contents of the free text remarks field for the strategy, for example "Call this number when the order fills".
        alertTypes - A set of AlertTypes that should be used when the order fills, for example SMS or email.
        requestId - The client-generated ID for the strategy.
        account - The account that the strategy relates to.
        orders - A list of child orders that make up the strategy. The ordering in the list is important. The first child order in the list must be the stop loss order, and the second order in the list must be the take profit order; otherwise the getStopLossOrder() and getTakeProfitOrder() methods will not work correctly. There should never be more or less than two orders in the list.
        activationDate - The date on which this strategy should become active in the market.
        expirationDate - The date on which this strategy should expire.
    • Method Detail

      • getTakeProfitOrder

        public Order getTakeProfitOrder()
        Returns the take profit child order from within the OCO.
        The take profit order.
      • getStopLossOrder

        public Order getStopLossOrder()
        Returns the stop loss child order from within the OCO.
        The stop loss order.