Class StrategyFactory


  • public class StrategyFactory
    extends java.lang.Object
    Creates the individual order components which make up a strategy.

    This strategy factory does not support arbitrarily complex strategies, however it is possible to chain IF-DONE and OCO orders to create an IF-DONE-OCO; in most cases therefore the documentation refers to a SINGLE order as the 'parent' order.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.caplin.ret.trapi.fx.FXOrder buildIfDoneChildOrder​(com.caplin.motif.fx.trading.orders.submission.Order submittedOrder, com.caplin.ret.trapi.fx.FXOrder parentOrder, java.lang.String requestId)
      The if done child is the conditionally executed order in an IF-DONE or IF-DONE-OCO strategy.
      com.caplin.ret.trapi.fx.FXOrder buildIfTimeoutOrder​(com.caplin.motif.fx.trading.orders.submission.Order submittedOrder, com.caplin.ret.trapi.fx.FXOrder parentOrder, java.lang.String requestId)
      The if timeout is a conditionally executed order in an IF-TIMEOUT pairing.
      com.caplin.ret.trapi.fx.FXOrder buildOCOPartnerOrder​(com.caplin.motif.fx.trading.orders.submission.Order submittedOrder, com.caplin.ret.trapi.fx.FXOrder partnerOrder, java.lang.String requestId)
      The OCO partner is a conditionally executed order in an OCO (One-Cancels-Other) or IF-DONE-OCO strategy.
      com.caplin.ret.trapi.fx.FXOrder buildSingleOrder​(com.caplin.motif.fx.trading.orders.submission.Order submittedOrder, java.lang.String requestId)
      The single order is the sole order in a Single strategy, as well as the basis of complex orders.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StrategyFactory

        public StrategyFactory​(com.caplin.ret.trapi.fx.order.transaction.strategy.submit.OrderSubmissionTransaction transaction,
                               OrderAdapterInitialiser configuration,
                               StrategyHandler strategyHandler)
    • Method Detail

      • buildSingleOrder

        public com.caplin.ret.trapi.fx.FXOrder buildSingleOrder​(com.caplin.motif.fx.trading.orders.submission.Order submittedOrder,
                                                                java.lang.String requestId)
                                                         throws java.lang.Exception
        The single order is the sole order in a Single strategy, as well as the basis of complex orders. Call this method to get an order which can be submitted as either an independent, or first order in a strategy.
        Parameters:
        submittedOrder - an object which represents the order submitted via the FXMotif
        Throws:
        java.lang.Exception
      • buildIfDoneChildOrder

        public com.caplin.ret.trapi.fx.FXOrder buildIfDoneChildOrder​(com.caplin.motif.fx.trading.orders.submission.Order submittedOrder,
                                                                     com.caplin.ret.trapi.fx.FXOrder parentOrder,
                                                                     java.lang.String requestId)
                                                              throws java.lang.Exception
        The if done child is the conditionally executed order in an IF-DONE or IF-DONE-OCO strategy.
        Parameters:
        submittedOrder - an object which represents the order submitted via the FXMotif
        parentOrder - a configured single order which will be the parent of the newly created order
        Throws:
        java.lang.Exception
      • buildOCOPartnerOrder

        public com.caplin.ret.trapi.fx.FXOrder buildOCOPartnerOrder​(com.caplin.motif.fx.trading.orders.submission.Order submittedOrder,
                                                                    com.caplin.ret.trapi.fx.FXOrder partnerOrder,
                                                                    java.lang.String requestId)
                                                             throws java.lang.Exception
        The OCO partner is a conditionally executed order in an OCO (One-Cancels-Other) or IF-DONE-OCO strategy.
        Parameters:
        submittedOrder - an object which represents the order submitted via the FXMotif
        partnerOrder - a configured order which will be the partner of the newly created order
        Throws:
        java.lang.Exception
      • buildIfTimeoutOrder

        public com.caplin.ret.trapi.fx.FXOrder buildIfTimeoutOrder​(com.caplin.motif.fx.trading.orders.submission.Order submittedOrder,
                                                                   com.caplin.ret.trapi.fx.FXOrder parentOrder,
                                                                   java.lang.String requestId)
                                                            throws java.lang.Exception
        The if timeout is a conditionally executed order in an IF-TIMEOUT pairing.
        Parameters:
        submittedOrder - an object which represents the order submitted via the FXMotif
        parentOrder - a configured single order which will be the parent of the newly created order
        Throws:
        java.lang.Exception