public interface TradeChannel
extends java.io.Serializable
The TradeChannel encapsulates a subscription by a client to the TradingDataSource. It provides a bi-directional channel allowing messages to be sent by both client and the TradingDataSource.
Modifier and Type | Method and Description |
---|---|
Trade |
createTrade(java.lang.String tradingProtocol) |
java.util.List<Trade> |
getAllTrades()
Gets all the trades that this channel is currently managing.
|
java.lang.String |
getName()
Gets the name of the channel
|
int |
getPeerIndex()
Get the index of the peer connection that is managing this TradeChannel.
|
Trade |
getTrade(java.lang.String requestId)
Gets a Trade associated with this TradeChannel.
|
TradeChannelListener |
getTradeChannelListener()
Gets the ChannelListener that is set on this TradeChannel.
|
java.lang.String |
getUser()
Gets the username of the user represented by this channel
|
Trade |
restoreTrade(java.lang.String assetClass,
java.lang.String tradeProtocol,
java.lang.String restorationId)
Creates a trade object to faciliate restoration of a trade with a client.
|
void |
setTradeChannelListener(TradeChannelListener listener)
Sets the ChannelListener for this TradeChannel.
|
java.lang.String getUser()
java.lang.String getName()
int getPeerIndex()
void setTradeChannelListener(TradeChannelListener listener)
listener
- The ChannelListener.TradeChannelListener getTradeChannelListener()
Trade getTrade(java.lang.String requestId)
requestId
- The RequestId for the Trade.java.util.List<Trade> getAllTrades()
Trade restoreTrade(java.lang.String assetClass, java.lang.String tradeProtocol, java.lang.String restorationId) throws TradeException
Creates a trade object to faciliate restoration of a trade with a client. Once the trade
has been created, a restore event should be created via an invocation to
Trade.createRestoreEvent(String)
.
To allow for trades to be restored on the client, TradeEvent.setRestorationId(String)
should be invoked on the first message sent to the client when it opens a trade. If the connection between the
client and the Trading DataSource is lost and then re-established, the client will be able
to identify the trade restoration message via the restorationId passed as an argument to this
method.
assetClass
- The asset class of the trade, e.g FX or FI.tradeProtocol
- The trade protocol. This must be the name of the state model.restorationId
- The system identifier for the trade.TradeException
- Thrown if the trade would be in an invalid state.TradeEvent.setRestorationId(String)
Trade createTrade(java.lang.String tradingProtocol) throws TradeException
TradeException
Please send bug reports and comments to Caplin support