Class RejectEvent<T extends UserTrade>

  • Type Parameters:
    T - A class that extends UserTrade, which this RejectEvent relates to. For example, ESPTrade or BlockTrade.

    public class RejectEvent<T extends UserTrade>
    extends ResponderEvent<T>

    An event that denotes that the trade has been rejected. Reject events are expected to contain an error code and/or an error message to indicate why the trade was rejected. An error code is generally more useful than a message, because it can be internationalised on the front end into a helpful error message in the user's own language.

    Note that some error codes or messages are provided by the trading system if your adapter submitted the trade and it failed. But you may reject the trade from your adapter code without ever submitting it to the trading system, if for example you detect that the fields on the incoming trade message are invalid. In this situation you will need to provide your own error code and/or message.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ERROR_CODE
      The field name used for sending the error code to the front end.
      static java.lang.String ERROR_MESSAGE
      The field name used for sending the error message to the front end.
      static java.lang.String REJECT
      The event name for a Reject event
    • Constructor Summary

      Constructors 
      Constructor Description
      RejectEvent​(java.lang.String errorMessage, java.lang.String errorCode)
      Constructs a RejectEvent with the event name "Reject" and the specified error message and code.
    • Field Detail

      • REJECT

        public static final java.lang.String REJECT
        The event name for a Reject event
        See Also:
        Constant Field Values
      • ERROR_CODE

        public static final java.lang.String ERROR_CODE
        The field name used for sending the error code to the front end.
        See Also:
        Constant Field Values
      • ERROR_MESSAGE

        public static final java.lang.String ERROR_MESSAGE
        The field name used for sending the error message to the front end.
        See Also:
        Constant Field Values
    • Constructor Detail

      • RejectEvent

        public RejectEvent​(java.lang.String errorMessage,
                           java.lang.String errorCode)
        Constructs a RejectEvent with the event name "Reject" and the specified error message and code.
        Parameters:
        errorMessage - A natural language message that can be displayed to the user giving more information about the rejection. This sometimes comes directly from the trading system. However it is often less useful than the error code, because it will be written in a specific language.
        errorCode - The reject code that can be displayed to the user. This can be translated to an internationalised error message rather than shown as a raw error code, to give the user useful feedback regardless of their language.