Caplin Trader 4.8.0

Interface: module:caplin/trading/trademodel/TradeMessageService

module:caplin/trading/trademodel/TradeMessageService

The TradeMessageService interface — this should never be constructed.

The TradeMessageService is the interface between a module:caplin/trading/trademodel/Trade and the connector that will perform the actual communication with the back-end trading system. Messages are sent from the client to the server using the module:caplin/trading/trademodel/TradeMessageService#sendTradeEvent method. Messages are received from the server by the client using the module:caplin/trading/trademodel/Trade#processServerEvent method.

It is the responsibility of the TradeMessageService to store references to module:caplin/trading/trademodel/Trade objects when the module:caplin/trading/trademodel/TradeMessageService#sendTradeEvent method is invoked, and to be able to pair return messages from the server with previously stored module:caplin/trading/trademodel/Trade objects so that the module:caplin/trading/trademodel/Trade#processServerEvent method can be called on the appropriate object.

Implementations:

Methods

addTrade(oTrade)

Registers the specified trade with the trade subscriber. Will throw an exception if the object passed in is not an instance of caplin.trading.trademodel.Trade
Parameters:
Name Type Description
oTrade module:caplin/trading/trademodel/Trade the trade object. May not be null.
Implementations:

removeTrade(oTrade)

Unregisters the specified trade with the trade subscriber. The trade subscriber may now clean up any allocated resources for that trade.
Parameters:
Name Type Description
oTrade module:caplin/trading/trademodel/Trade the trade object. May not be null.
Implementations:

sendTradeEvent(sEventName, oTrade, oData)

SendTradeEvent is called by the Trade when it wishes to send some data to the server.
Parameters:
Name Type Description
sEventName String the event name that should be sent to the server. May not be null.
oTrade module:caplin/trading/trademodel/Trade the trade object. May not be null.
oData module:caplin/trading/trademodel/DataHolder the data sent with this event. May not be null.
Implementations: