Interface TradeEvent

All Known Subinterfaces:

public interface TradeEvent

A single event acting on a Trade.

The event may be client generated and received through the TradeListener interface or it may be generated by custom code to be sent to the client using the Trade.sendEvent(TradeEvent) method.

A TradeEvent is created using the Trade it relates to by calling the Trade.createEvent(String) method of the appropriate Trade instance.

A TradeEvent typically represents a message received from the client or sent by the server. A message contains a set of fields and values which can be accessed using the getFields() method.

A Typical message represented by a TradeEvent might be:

Field Value
MsgType Execute
MsgVersion 5
RequestId 123
TradeId 456789
PriceVersion 3
BuySell BUY
Price 1.9950
  • Method Details

    • getType

      String getType()
      Gets the type of the TradeEvent.
      The type of this event.
    • isType

      boolean isType(String type)
      Confirms that the TradeEvent is of a certain type
      type - The trade type to check.
      True if the requested type matches the TradeEvent type.
    • getTrade

      Trade getTrade()
      Gets the Trade object that this TradeEvent belongs to. As long as your code executes on the thread in which TradeListener.receiveEvent(TradeEvent) was called, the Trade's fields will not be updated by subsequent events, though its state may change.
      The Trade object.
    • getSource

      String getSource()
      Gets the source of this TradeEvent.
      The name of the source of this TradeEvent.
    • setRestorationId

      void setRestorationId(String restorationId)
      Sets an id that will identify a trade restoration message. A restoration id should be supplied for the first TradeEvent on a client opened trade. This identifier should be retreived from the system that the Trading DataSource is integrating with.
      restorationId - the system identifier for the trade.
      See Also:
    • addField

      void addField(String name, String value)
      Adds a field to this TradeEvent.
      name - The name of the field to add.
      value - The value of the field to add.
    • addField

      void addField(String name, int value)
      Adds a field to this TradeEvent.
      name - The name of the field to add.
      value - The value of the field to add.
    • setInitialTimestamp

      void setInitialTimestamp(Date date)
      Sets LTY_INIT_TS field to this TradeEvent.
      date - The time the LTY_INIT_TS field will be set to.
    • getField

      String getField(String name)
      Gets the value of a field in this TradeEvent.
      name - The name of the field.
      The value of the named field.
    • addLegAction

      void addLegAction(LegAction action)
      Adds a leg action to the trade. This method is typically used when leg changes need to be made from the server side.
      action - The leg action.
    • getLegActions

      List<LegAction> getLegActions()
      Gets the leg actions associated with this event. This method is typically used when the server receives a trade event from the client using the TradeListener interface and needs to determine what leg actions the client has performed on the trade.
      A list of leg actions.
    • getFields

      Map<String,String> getFields()
      Gets the fields of this TradeEvent as a Map
      a map of the fields;
    • getEventSource

      EventSource getEventSource()
      Returns the source of this event: CLIENT, SERVER, or RESTORE
      a map of the fields;