new module:ct-trading /service /Workbench Trade Service()
This service is meant to be used to configure the desired server events which will be used to feed the
module:ct-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"]);
Methods
add Server Data Listeners()
Allows the registration of server data changes listeners. Callbacks registered will be triggered whenever there is a change on the server data.
add Trade Listeners()
Allows the registration of trade creation and trade removal listeners. Callbacks registered will be triggered whenever a trade gets either added or removed.
get Auto Server Events(sRequest ID) → {Map}
Returns the server events for a given trade.
Parameters:
Name | Type | Description |
---|---|---|
sRequestID |
String | id identifying a trade. |
Returns:
- Type
- Map
get Server Data For Transitions(sRequest ID) → {Map}
Returns the transition server data for a given trade.
Parameters:
Name | Type | Description |
---|---|---|
sRequestID |
String | id identifying a trade. |
Returns:
- Type
- Map
get State Monitor(sRequest ID) → {module:ct-trading /workbench /model /State Machine Monitor}
Returns the state monitor associated to a trade.
Parameters:
Name | Type | Description |
---|---|---|
sRequestID |
String | id identifying a trade. |
Returns:
get Trades() → {Array}
Returns the trades contained within the trade service.
Returns:
- Type
- Array
set Auto Server Events(pServer Events)
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. |
set Server Data For Transition(sTransition Name, mData)
Defines the data that is needed for the server transitions received by the 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 |
trade Created()
- Implements:
- See: