Interface TradingApplicationListener


public interface TradingApplicationListener
Use the TradingApplicationListener interface to be notified of TradeChannel lifecycle events.

Users' trading channels are represented by TradeChannels. Typically a user has a single TradeChannel to perform multiple Trades (though it is possible to configure different trade channels to be used by the same user, for example to split asset classes or trade categories, if desired). The TradingApplicationListener is notified when a new TradeChannel is created and when a TradeChannel is closed.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Called when a channel is closed as a result of the user finishing its trading session or the connection being lost to the Liberator.
    void
    Called when a client wants to open a trading channel that will subsequently be used to perform trades.
    void
    peerDown(int peerIndex)
    Called when a peer connection is lost.
    void
    peerUp(int peerIndex)
    Called when a peer connection is established.
  • Method Details

    • channelCreated

      void channelCreated(TradeChannel channel) throws TradeException
      Called when a client wants to open a trading channel that will subsequently be used to perform trades. This allows any channel/user specific initialization to be performed.
      Parameters:
      channel - A trade channel that represents a particular user's session with the TradingDataSource.
      Throws:
      TradeException - Thrown if it is not possible to accept this trade channel, or the associated user.
    • channelClosed

      void channelClosed(TradeChannel channel)
      Called when a channel is closed as a result of the user finishing its trading session or the connection being lost to the Liberator. This enables any clean up associated with a channel/user to be performed.
      Parameters:
      channel - The TradeChannel.
    • peerUp

      void peerUp(int peerIndex)
      Called when a peer connection is established.

      This can be either the an initial peer connection after startup or a re-established connection following a peerDown(int) call.

      Parameters:
      peerIndex - the index of the peer that has just connected. This is a 0 indexed id based on the peer configuration order.
    • peerDown

      void peerDown(int peerIndex)
      Called when a peer connection is lost.

      This indicates that the connection to the remote peer (usually a Liberator) has been lost.

      Currently this should be treated as a catastrophic event for all open TradeChannels and Trades, and as such the upstream system should be notified of errors. Future version of the TradingDataSource will provide the ability to re-establish in-progress Trades (and associated channels). The behaviour after a connection lost is that this call will be followed by calls to channelClosed(TradeChannel) for any active TradeChannels for the peer.

      Parameters:
      peerIndex - the index of the peer that has just disconnected. This is a 0 indexed id based on the peer configuration order.