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
add Listener(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 |
Listener object. |
can Perform Trade()
This method can be used to query whether the logged-in user can perform a trade on behalf of the currently TOBO user.
can Trade OnBehalf Of()
This method can be used to query whether the logged-in user can trade on behalf of other users.
get Account()
Returns the account of the currently selected TOBO user which is being used by the logged-in user.
get Trade OnBehalf OfUser()
Returns the TOBO user whom the logged-in user is trading on behalf of.
get User Type()
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.
remove Listener(oListener)
Removes a listener on the TOBOUserService.
Parameters:
Name | Type | Description |
---|---|---|
oListener |
module:ct-trading |
Listener object. |
set Account()
Called to set the current TOBO user's account to be used for trading by the logged-in user.
set Trade OnBehalf OfUser()
Called to set the TOBO user whom the logged-in user wishes to trade on behalf of.
trade Finished()
This method is called by the trading components to notify the TOBOUserService when a trade has finished.
trade Started()
This method is called by the trading components to notify the TOBOUserService when a trade has started.