Interface LegAction


  • public interface LegAction

    The LegAction interface represents a change to the legs that make up a trade. During the lifecycle of a trade legs can be added, removed or updated - these operations are represented by the LegAction.LegActionType enumeration.

    Trade events can be sent between the client and the server in either direction and each TradeEvent will contain zero or more leg actions.

    In the case of a trade event being received from the client using the TradeListener interface, the TradeEvent.getLegActions() method can be used by the TradingDataSource API developer to determine what leg actions the client has performed on the trade.

    In the case of a trade event being sent to the client using the Trade.sendEvent(TradeEvent) method, the TradeEvent.addLegAction(LegAction) method can be used by the TradingDataSource API developer to add leg actions to the trade.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  LegAction.LegActionType
      An enumeration of possible actions that can be performed on a leg.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addField​(java.lang.String name, int value)
      Adds a field that relates to this leg, for example the bid price for this transaction.
      void addField​(java.lang.String name, java.lang.String value)
      Adds a field that relates to this leg, for example the base currency of this transaction.
      java.lang.String getField​(java.lang.String name)
      Gets the value of a field on this leg action.
      java.util.Map<java.lang.String,​java.lang.String> getFields()
      Gets an unmodifiable copy of all the fields on this leg action.
      Leg getLeg()
      Gets the underlying Leg that this action relates to.
      LegAction.LegActionType getType()
      Gets the type of action that this instance represents.
    • Method Detail

      • getType

        LegAction.LegActionType getType()
        Gets the type of action that this instance represents.
        Returns:
        The action type.
      • addField

        void addField​(java.lang.String name,
                      java.lang.String value)

        Adds a field that relates to this leg, for example the base currency of this transaction.

        Each leg has a unique identifier, and any fields added using this method will automatically be prefixed with the correct identifier. For example, if the ID of the underlying leg is 1 and the field name added to this leg is "BaseCurrency" then the field name sent over the wire will be "L1_BaseCurrency".

        Parameters:
        name - The field name.
        value - The field value as a String.
      • addField

        void addField​(java.lang.String name,
                      int value)

        Adds a field that relates to this leg, for example the bid price for this transaction.

        Each leg has a unique identifier, and any fields added using this method will automatically be prefixed with the correct identifier. For example, if the ID of the underlying leg is 1 and the field name added to this leg is "BidPrice" then the field name sent over the wire will be "L1_BidPrice".

        Parameters:
        name - The field name.
        value - The field value as an integer.
      • getField

        java.lang.String getField​(java.lang.String name)

        Gets the value of a field on this leg action.

        It is not necessary to prefix the field name with the leg identifier, as this is handled by the TradingDataSource. For example, calling this method with the parameter "Amount" will return the value of the field stored as "L1_Amount" if the identifier of the underlying leg is 1.

        Parameters:
        name - The field name.
        Returns:
        The value of the field with the specified name, or null if the field does not exist.
      • getFields

        java.util.Map<java.lang.String,​java.lang.String> getFields()

        Gets an unmodifiable copy of all the fields on this leg action. The field names will be prefixed.

        Returns:
        A map of field name to field value for all the fields on this leg action.
      • getLeg

        Leg getLeg()
        Gets the underlying Leg that this action relates to.
        Returns:
        The leg.