Class ESPTrade


  • public class ESPTrade
    extends UserTrade

    A single ESPTrade active in the system.

    A Trade is initiated by a client and is tied to a TradeChannel. The lifecycle of a Trade consists of a number of messages, represented by TradeEvents, being sent between the client and the Trading System in both directions. These messages cause the Trade to transition between a number of predefined states.

    Trades are comprised of one or more trade legs, which each leg representing the exchange of a financial instrument and the resultant cash flow. It is possible to add, remove and update trades from the client or from the TradingDataSource.

    A Trade is uniquely identified in two ways: by RequestId set by the client and a TradeId set by the Trading System.

    • Constructor Detail

      • ESPTrade

        public ESPTrade​(@NotNull
                        @NotNull com.caplin.trading.Trade backingTrade,
                        @NotNull
                        @NotNull java.util.concurrent.ScheduledExecutorService executorService)

        Constructor used by the generated code.

        Parameters:
        backingTrade - To be used for the parent constructor
        executorService - To be used for the parent constructor (What service is going execute the backingTrade)
    • Method Detail

      • createErrorTradeEvent

        @NotNull
        public @NotNull ErrorTradeEvent createErrorTradeEvent()

        Create a TradeEvent that can be used to trigger the trade to transition into the Error state.

        Returns:
        A new instance of ErrorTradeEvent.
      • sendErrorEvent

        public void sendErrorEvent​(@NotNull
                                   @NotNull ErrorTradeEvent event)

        Send a TradeEvent to trigger the trade to transition into the Error state.

        Parameters:
        event - The event to send.
      • createSubmitAckTradeEvent

        @NotNull
        public @NotNull SubmitAckTradeEvent createSubmitAckTradeEvent()

        Create a TradeEvent that can be used to trigger the trade to transition into the SubmitAck state.

        Returns:
        A new instance of SubmitAckTradeEvent.
      • sendSubmitAckEvent

        public void sendSubmitAckEvent​(@NotNull
                                       @NotNull SubmitAckTradeEvent event)

        Send a TradeEvent to trigger the trade to transition into the SubmitAck state.

        Parameters:
        event - The event to send.
      • createRejectTradeEvent

        @NotNull
        public @NotNull RejectTradeEvent createRejectTradeEvent()

        Create a TradeEvent that can be used to trigger the trade to transition into the Reject state.

        Returns:
        A new instance of RejectTradeEvent.
      • sendRejectEvent

        public void sendRejectEvent​(@NotNull
                                    @NotNull RejectTradeEvent event)

        Send a TradeEvent to trigger the trade to transition into the Reject state.

        Parameters:
        event - The event to send.
      • createHoldTradeEvent

        @NotNull
        public @NotNull HoldTradeEvent createHoldTradeEvent()

        Create a TradeEvent that can be used to trigger the trade to transition into the Hold state.

        Returns:
        A new instance of HoldTradeEvent.
      • sendHoldEvent

        public void sendHoldEvent​(@NotNull
                                  @NotNull HoldTradeEvent event)

        Send a TradeEvent to trigger the trade to transition into the Hold state.

        Parameters:
        event - The event to send.
      • sendHoldEvent

        public void sendHoldEvent()

        Send a TradeEvent with no fields to trigger the trade to transition into the Hold state.

      • createTradeConfirmationTradeEvent

        @NotNull
        public @NotNull TradeConfirmationTradeEvent createTradeConfirmationTradeEvent()

        Create a TradeEvent that can be used to trigger the trade to transition into the TradeConfirmation state.

        Returns:
        A new instance of TradeConfirmationTradeEvent.
      • sendTradeConfirmationEvent

        public void sendTradeConfirmationEvent​(@NotNull
                                               @NotNull TradeConfirmationTradeEvent event)

        Send a TradeEvent to trigger the trade to transition into the TradeConfirmation state.

        Parameters:
        event - The event to send.
      • sendTradeConfirmationEvent

        public void sendTradeConfirmationEvent​(@NotNull
                                               @NotNull Message message)

        Send a TradeEvent to trigger the trade to transition into the TradeConfirmation state.

        Parameters:
        message - The message to send.
      • createTradeConfirmationTradeEvent

        @NotNull
        public @NotNull TradeConfirmationTradeEvent createTradeConfirmationTradeEvent​(@NotNull
                                                                                      @NotNull Message message)

        Create a TradeEvent that can be used to trigger the trade to transition into the TradeConfirmation state.

        Parameters:
        message - a Message to be passed to the TradeEvent
        Returns:
        A new instance of TradeConfirmationTradeEvent.
      • createClientCloseAckTradeEvent

        @NotNull
        public @NotNull ClientCloseAckTradeEvent createClientCloseAckTradeEvent()

        Create a TradeEvent that can be used to trigger the trade to transition into the ClientCloseAck state.

        Returns:
        A new instance of ClientCloseAckTradeEvent.
      • sendClientCloseAckEvent

        public void sendClientCloseAckEvent​(@NotNull
                                            @NotNull ClientCloseAckTradeEvent event)

        Send a TradeEvent to trigger the trade to transition into the ClientCloseAck state.

        Parameters:
        event - The event to send.
      • sendClientCloseAckEvent

        public void sendClientCloseAckEvent()

        Send a TradeEvent with no fields to trigger the trade to transition into the ClientCloseAck state.

      • createPickUpTradeEvent

        @NotNull
        public @NotNull PickUpTradeEvent createPickUpTradeEvent()

        Create a TradeEvent that can be used to trigger the trade to transition into the PickUp state.

        Returns:
        A new instance of PickUpTradeEvent.
      • sendPickUpEvent

        public void sendPickUpEvent​(@NotNull
                                    @NotNull PickUpTradeEvent event)

        Send a TradeEvent to trigger the trade to transition into the PickUp state.

        Parameters:
        event - The event to send.
      • sendPickUpEvent

        public void sendPickUpEvent()

        Send a TradeEvent with no fields to trigger the trade to transition into the PickUp state.