Attributes | Name and Description |
---|---|
|
caplin.trading.trademodel.TradeService()
Constructs a new |
Attributes | Name and Description |
---|---|
|
void
addListener(caplin.trading.trademodel.TradeFactoryListener oTradeFactoryListener, Function (optional))
Register a listener to be informed of trade service events. |
|
void
addTradeRestoredListener(caplin.trading.restoration.TradeRestoredListener oTradeRestoredListener)
Adds a TradeRestoredListener to this service to listen to trade restoration for trades that don't currently exist on the client. |
|
Array
getTrades(Function (optional))
Return all trades stored in the trade repository maintained by TradeService. |
|
void
registerTradeFactory(Map mFieldMap, caplin.trading.trademodel.TradeFactory oTradeFactory)
Registers a TradeFactory that will be used to create or restore trades when the the trade contains data that matches the criteria in the map provided. |
|
void
removeListener(caplin.trading.trademodel.TradeFactoryListener oTradeFactoryListener)
Remove a listener from being informed of trade service events. |
|
void
removeTrade(String sRequestID)
|
|
void
removeTradeRestoredListener(caplin.trading.restoration.TradeRestoredListener oTradeRestoredListener)
Removes a TradeRestoredListener from listening to newly restored trades. |
►
caplin.trading.trademodel.TradeService()
Constructs a new TradeService
.
Behaves as both a factory and repository for trades.
It delegates creation of trades to individual factories that are
registered with this service.
►
void
addListener(caplin.trading.trademodel.TradeFactoryListener oTradeFactoryListener, Function (optional))
Register a listener to be informed of trade service events.
caplin.trading.trademodel.TradeFactoryListener | oTradeFactoryListener | The listener to be informed of the events. |
Function | (optional) | fFilter allows filtering of returned trades. This function should take a {caplin.trading.trademodel.Trade} as its only argument, and should return true if the given Trade is accepted by the filter, and false otherwise. |
►
void
addTradeRestoredListener(caplin.trading.restoration.TradeRestoredListener oTradeRestoredListener)
Adds a TradeRestoredListener to this service to listen to trade restoration for trades that don't currently exist on the client. If the trade exists on the client, you should add the listener to the Trade object itself.
caplin.trading.restoration.TradeRestoredListener | oTradeRestoredListener | The listener to add. |
►
Array
getTrades(Function (optional))
Return all trades stored in the trade repository maintained by TradeService.
Function | (optional) | fFilter allows filtering of returned trades. This function should take a {caplin.trading.trademodel.Trade} as its only argument, and should return true if the given Trade is accepted by the filter, and false otherwise. |
►
void
registerTradeFactory(Map mFieldMap, caplin.trading.trademodel.TradeFactory oTradeFactory)
Registers a TradeFactory that will be used to create or restore trades when the the trade contains data that matches the criteria in the map provided. It is possible to register multiple trade factory objects with maps that may match. In this scenario the factory that has been registered first will be used.
Map | mFieldMap | The field map to be used to match trade data. |
caplin.trading.trademodel.TradeFactory | oTradeFactory | The TradeFactory. |
►
void
removeListener(caplin.trading.trademodel.TradeFactoryListener oTradeFactoryListener)
Remove a listener from being informed of trade service events.
caplin.trading.trademodel.TradeFactoryListener | oTradeFactoryListener | The listener to be removed. |
►
void
removeTrade(String sRequestID)
String | sRequestID | Remove completed trade from the service. |
►
void
removeTradeRestoredListener(caplin.trading.restoration.TradeRestoredListener oTradeRestoredListener)
Removes a TradeRestoredListener from listening to newly restored trades.
caplin.trading.restoration.TradeRestoredListener | oTradeRestoredListener | The listener to remove. |