Class
caplin.trading.trademodel

TradeOnBehalfOf

Is responsible for communicating with Liberator that the current user (generally a salesman or head trader) executes trades on behalf of another user (generally a client trader). When "trading on behalf of" the salesman needs to trade on the prices the trader would trade on if they were logged into the system themselves. Liberator does this by maintaining multiple prices (tiers) for each instrument (e.g. currency /FX/GBPUSD/T1 and /FX/GBPUSD/T2). Different users are mapped to different tiers. Usually liberator performs mapping based on the identity of the logged in user. When "trading on behalf of" Liberator uses the field "UserName" in a well know user subject to drive the mapping. This class simply contributes the userName to be traded on behalf of. When the contribution is successfully processed by Liberator it publishes the new tier prices to the Caplin Trader client. We must not allow the user to trade on old prices prior to the tier change. To change the mappings, Liberator invalidates the internal user session (this is not communicated to the client), any price received thereafter is guaranteed to be from the new tier. We therefore listen on the "/TOBOCHANGEUSER" subject, because changes to this are published to listeners AFTER the Liberator internal session invalidation. We then notify any listeners that any subsequent prices are valid from the new tier and trading may re-commence.

Constructor Summary

Attributes Name and Description
caplin.trading.trademodel.TradeOnBehalfOf(caplin.services.messaging.MessageService oMessageService)

Method Summary

Attributes Name and Description
void addListener(caplin.trading.trademodel.TradeOnBehalfOfListener oTradeOnBehalfOfListener)

Register a listener to be informed of "trade on behalf of" events.

void clearTradeOnBehalfOfPermissionable(String sNamespace)

Clears any current "trade on behalf of" settings, reverting back to the original user's prices .

void destroy()

Destructor method.

void setTradeOnBehalfOfPermissionable(String sNamespace, String sPermissionable)

Initiate a trade on behalf of change, switching your application to display the prices for the specified permissionable item.

Constructor Detail

caplin.trading.trademodel.TradeOnBehalfOf(caplin.services.messaging.MessageService oMessageService)

Parameters
caplin.services.messaging.MessageService oMessageService Message Service implementation.

Method Detail

void addListener(caplin.trading.trademodel.TradeOnBehalfOfListener oTradeOnBehalfOfListener)

Register a listener to be informed of "trade on behalf of" events.

Parameters
caplin.trading.trademodel.TradeOnBehalfOfListener oTradeOnBehalfOfListener The listener to be informed of the events.

void clearTradeOnBehalfOfPermissionable(String sNamespace)

Clears any current "trade on behalf of" settings, reverting back to the original user's prices .

Parameters
String sNamespace The namespace of the permissionable to clear.

void destroy()

Destructor method.

void setTradeOnBehalfOfPermissionable(String sNamespace, String sPermissionable)

Initiate a trade on behalf of change, switching your application to display the prices for the specified permissionable item.

Parameters
String sNamespace The namespace within the /TOBOCHANGEUSER subject you want to contrib to. The value for this depends on what permissionable object you're changing to, e.g. UserName or Account.
String sPermissionable Identifier for the permissioned item you want to trade on behalf of. Typically this would be a username, however could be anything with permissions (e.g. accounts in some instances). Passing in a null value will clear any current "trade on behalf of" settings, as if the clearTradeOnBehalfOfPermissionable function had been called.