Caplin Trader 5.1.0

Interface: module:ct-trading/service/TOBOUserService

module:ct-trading/service/TOBOUserService

The TOBOUserService interface — this should never be constructed.

The TOBOUserService is the interface designed for managing the activities of a client user who is permissioned to trade on behalf of other (TOBO) users. The interface provides a way to obtain the list of TOBO users and their respective accounts which the logged-in user can trade upon, as well as querying and setting the current TOBO user and account selected. An interface is also provided to notify the service when a trade is started or ended so that the TOBOUserService can manage and alter the logged-in users's ability to trade, switch accounts, or perform other TOBO-related activities while a trade is ongoing.

Implementations of a TOBOUserService should be registered with the module:ct-core/ServiceRegistry#registerService method.

Methods

addListener(oListener)

Adds a listener which will be notified when the TOBOUserService state is changed. The listener must be an instance of module:ct-trading/service/TOBOUserServiceListener.

Parameters:
Name Type Description
oListener module:ct-trading/service/TOBOUserServiceListener

Listener object.

canPerformTrade()

This method can be used to query whether the logged-in user can perform a trade on behalf of the currently TOBO user.

canTradeOnBehalfOf()

This method can be used to query whether the logged-in user can trade on behalf of other users.

getAccount()

Returns the account of the currently selected TOBO user which is being used by the logged-in user.

getTradeOnBehalfOfUser()

Returns the TOBO user whom the logged-in user is trading on behalf of.

getUserType()

Returns the user type of the logged-in user. Used to query whether the user is a trader or a user who is allowed to trade on behalf of other users.

removeListener(oListener)

Removes a listener on the TOBOUserService.

Parameters:
Name Type Description
oListener module:ct-trading/service/TOBOUserServiceListener

Listener object.

setAccount()

Called to set the current TOBO user's account to be used for trading by the logged-in user.

setTradeOnBehalfOfUser()

Called to set the TOBO user whom the logged-in user wishes to trade on behalf of.

tradeFinished()

This method is called by the trading components to notify the TOBOUserService when a trade has finished.

tradeStarted()

This method is called by the trading components to notify the TOBOUserService when a trade has started.