Package com.caplin.trading
Interface TradeChannelListener
public interface TradeChannelListener
Provides notifications relating to the
Trade
lifecycle.
When a client initiates a new Trade the TradeChannelListener is notified with a call to tradeCreated(Trade)
.
When a trade has been closed (either due to a successful completion or any other exit case),
the TradeChannelListener is notified with a call to tradeClosed(Trade)
.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
tradeClosed
(Trade trade) Called when a trade has closed due to it reaching a terminal state, or the channel is being closed while the trade is in progress.void
tradeCreated
(Trade trade) Called when a new trade is initiated by a client.
-
Method Details
-
tradeCreated
Called when a new trade is initiated by a client. The implementation of this method will typically initiate a trade conversation with the trading system and / or set up any required infrastructure for a trade.- Parameters:
trade
- The Trade object representing the trade conversation that has been initiated. This object should be used for subsequent events relating to the trade conversation.- Throws:
TradeException
- Throw this if it is not possible to start this trade, for example if the trading system is unavailable or cannot accept this trade conversion for some reason.
-
tradeClosed
Called when a trade has closed due to it reaching a terminal state, or the channel is being closed while the trade is in progress.- Parameters:
trade
- The Trade object representing this trade conversation.
-