The TradeMessageService interface — this should never be constructed.
The TradeMessageService is the interface between a module:ct-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:ct-trading/trademodel/TradeMessageService#sendTradeEvent
method. Messages are received from the server by the client using the
module:ct-trading/trademodel/Trade#processServerEvent method.
It is the responsibility of the TradeMessageService to store references to
module:ct-trading/trademodel/Trade objects when the
module:ct-trading/trademodel/TradeMessageService#sendTradeEvent method is invoked, and to be able to
pair return messages from the server with previously stored module:ct-trading/trademodel/Trade objects
so that the module:ct-trading/trademodel/Trade#processServerEvent method can be called on the
appropriate object.
Methods
add Trade(oTrade)
Registers the specified trade with the trade subscriber. Will throw an exception if the object passed in is not an instance of ct-trading/trademodel/Trade
Parameters:
| Name | Type | Description |
|---|---|---|
oTrade |
module:ct-trading |
the trade object. May not be null. |
remove Trade(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:ct-trading |
the trade object. May not be null. |
send Trade Event(sEvent Name, 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:ct-trading |
the trade object. May not be null. |
oData |
module:ct-trading |
the data sent with this event. May not be null. |