Caplin Trader 4.8.0

Class: module:caplin/trading/service/WorkbenchTradeService

module:caplin/trading/service/WorkbenchTradeService

Constructor

new module:caplin/trading/service/WorkbenchTradeService()

This service is meant to be used to configure the desired server events which will be used to feed the module:caplin/trading/workbench/TradeStateVisualiser. The alias for this service is caplin.workbench-trade-service.

Keep in mind that this service listens to trade creations (via the trade service) so it is recommended to configure it before any call to the create trades on the trade service has been made.


This is how you will configure it:
var oWorkbenchTradeService = require("service!caplin.workbench-trade-service");
oWorkbenchTradeService.setServerDataForTransition("RFS","OpenAck", {"TradeID": "1234567"});
oWorkbenchTradeService.setAutoServerEvents("RFS",["OpenAck", "PriceUpdate", "Execute", "ExecuteAck", "TradeConfirmation"]);
Implements:

Methods

addServerDataListeners()

Allows the registration of server data changes listeners. Callbacks registered will be triggered whenever there is a change on the server data.

addTradeListeners()

Allows the registration of trade creation and trade removal listeners. Callbacks registered will be triggered whenever a trade gets either added or removed.

getAutoServerEvents(sRequestID) → {Map}

Returns the server events for a given trade.
Parameters:
Name Type Description
sRequestID String id identifying a trade.
Returns:
Type
Map

getServerDataForTransitions(sRequestID) → {Map}

Returns the transition server data for a given trade.
Parameters:
Name Type Description
sRequestID String id identifying a trade.
Returns:
Type
Map

getStateMonitor(sRequestID) → {module:caplin/trading/workbench/model/StateMachineMonitor}

Returns the state monitor associated to a trade.
Parameters:
Name Type Description
sRequestID String id identifying a trade.
Returns:
Type
module:caplin/trading/workbench/model/StateMachineMonitor

getTrades() → {Array}

Returns the trades contained within the trade service.
Returns:
Type
Array

setAutoServerEvents(pServerEvents)

Define which will be the events that will automatically be served.
Parameters:
Name Type Description
pServerEvents Array The array of events that will be served in case no user interaction is selected.

setServerDataForTransition(sTransitionName, mData)

Defines the data that is needed for the server transitions received by the caplin.trading.trademodel.TradeMessageService when 'auto server data' switch is on. If is is off, the data will be selected by the user.
Parameters:
Name Type Description
sTransitionName String The transition name
mData Map Map with the data the transition will generate

tradeCreated()

Implements:
See:

tradeRemoved()

Implements:
See: