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:caplin/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:caplin/trading/service/TOBOUserServiceListener
.Parameters:
Name Type Description oListener
module:caplin/trading/service/TOBOUserServiceListener Listener object. - Implementations:
- module:caplin/trading/service/TOBOUserServiceProvider#addListener
- module:caplin/trading/testing/TOBOUserServiceStub#addListener
-
canPerformTrade()
-
This method can be used to query whether the logged-in user can perform a trade on behalf of the currently TOBO user.
- Implementations:
- module:caplin/trading/service/TOBOUserServiceProvider#canPerformTrade
- module:caplin/trading/testing/TOBOUserServiceStub#canPerformTrade
-
canTradeOnBehalfOf()
-
This method can be used to query whether the logged-in user can trade on behalf of other users.
- Implementations:
- module:caplin/trading/service/TOBOUserServiceProvider#canTradeOnBehalfOf
- module:caplin/trading/testing/TOBOUserServiceStub#canTradeOnBehalfOf
-
getAccount()
-
Returns the account of the currently selected TOBO user which is being used by the logged-in user.
- Implementations:
- module:caplin/trading/service/TOBOUserServiceProvider#getAccount
- module:caplin/trading/testing/TOBOUserServiceStub#getAccount
-
getTradeOnBehalfOfUser()
-
Returns the TOBO user whom the logged-in user is trading on behalf of.
- Implementations:
- module:caplin/trading/service/TOBOUserServiceProvider#getTradeOnBehalfOfUser
- module:caplin/trading/testing/TOBOUserServiceStub#getTradeOnBehalfOfUser
-
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.
- Implementations:
- module:caplin/trading/service/TOBOUserServiceProvider#getUserType
- module:caplin/trading/testing/TOBOUserServiceStub#getUserType
-
removeListener(oListener)
-
Removes a listener on the TOBOUserService.
Parameters:
Name Type Description oListener
module:caplin/trading/service/TOBOUserServiceListener Listener object. - Implementations:
- module:caplin/trading/service/TOBOUserServiceProvider#removeListener
- module:caplin/trading/testing/TOBOUserServiceStub#removeListener
-
setAccount()
-
Called to set the current TOBO user's account to be used for trading by the logged-in user.
- Implementations:
- module:caplin/trading/service/TOBOUserServiceProvider#setAccount
- module:caplin/trading/testing/TOBOUserServiceStub#setAccount
-
setTradeOnBehalfOfUser()
-
Called to set the TOBO user whom the logged-in user wishes to trade on behalf of.
- Implementations:
- module:caplin/trading/service/TOBOUserServiceProvider#setTradeOnBehalfOfUser
- module:caplin/trading/testing/TOBOUserServiceStub#setTradeOnBehalfOfUser
-
tradeFinished()
-
This method is called by the trading components to notify the TOBOUserService when a trade has finished.
- Implementations:
- module:caplin/trading/service/TOBOUserServiceProvider#tradeFinished
- module:caplin/trading/testing/TOBOUserServiceStub#tradeFinished
-
tradeStarted()
-
This method is called by the trading components to notify the TOBOUserService when a trade has started.
- Implementations:
- module:caplin/trading/service/TOBOUserServiceProvider#tradeStarted
- module:caplin/trading/testing/TOBOUserServiceStub#tradeStarted