Constructor
new module:caplin/trading/service/TOBOUserServiceProvider(oTradeOnBehalfOfopt)
Constructs an instance of
TOBOUserServiceProvider
.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
oTradeOnBehalfOf |
module:caplin/trading/trademodel/TradeOnBehalfOf |
<optional> |
{module:caplin/trading/trademodel/TradeOnBehalfOf TradeOnBehalfOf} | The trade-on-behalf-of object. |
Methods
-
addListener(oListener)
-
Add a listener to the TOBOUserServiceProvider to be notified of changes in the selected TOBO user, user type and account, the list of available TOBO users and accounts and the TOBO user service lock.
Parameters:
Name Type Description oListener
module:caplin/trading/service/TOBOUserServiceListener Listener object. -
canPerformTrade() → {boolean}
-
Returns true if the logged-in user can trade on behalf of other users and has selected a TOBO user to trade on behalf of.
- Implements:
- See:
Returns:
- Type
- boolean
-
canTradeOnBehalfOf() → {boolean}
-
This method can be used to query whether the logged-in user can trade on behalf of other users.
- Implements:
- See:
Returns:
True if logged-in user can trade on behalf of other users.- Type
- boolean
-
getAccount() → {String}
-
Returns the account of the currently selected TOBO user which is being used by the logged-in user.
- Implements:
- See:
Returns:
The account name.- Type
- String
-
getTradeOnBehalfOfUser() → {String}
-
Returns the TOBO user whom the logged-in user is trading on behalf of.
- Implements:
- See:
Returns:
The current TOBO user's userName.- Type
- String
-
getUserType() → {String}
-
Returns the type of the logged-in user.
- Implements:
- See:
Returns:
The current logged-in user's type.- Type
- String
-
removeListener(oListener)
-
Remove a listener of the TOBOUserServiceProvider.
Parameters:
Name Type Description oListener
module:caplin/trading/service/TOBOUserServiceListener Listener object. -
setAccount(sAccount)
-
Sets the current TOBO user's account to be used for trading by the logged-in user.
module:caplin/trading/service/TOBOUserServiceListener#onTOBOAccountChanged
is called on all the TOBOUserService's listeners.Parameters:
Name Type Description sAccount
String The account name. -
setTradeOnBehalfOfUser(sUser)
-
This method sets the TOBO user and updates the account list with the accounts available for the new TOBO user.
module:caplin/trading/service/TOBOUserServiceListener#onTOBOUserChanged
is called on all the TOBOUserService's listeners.Parameters:
Name Type Description sUser
String The TOBO user's userName. -
tradeFinished()
-
This method is called by the trading components. If the TOBOUserService detects that no more trades are executing, the
module:caplin/trading/service/TOBOUserServiceListener#onLockChanged
is called on all the TOBOUserService's listeners, enabling them to 'unlock' their behaviour. -
tradeOnBehalfOfChangeFailed(sReason)
-
A pending 'trade on behalf of' change has failed, and any subsequent prices are from the old tier.
Parameters:
Name Type Description sReason
String A string description of the reason for failure. -
tradeOnBehalfOfChangeInitiated(sPermissionable)
-
A 'trade on behalf of' change has been initiated, and we are currently awaiting prices for the new tier. Any existing prices should be considered stale.
Parameters:
Name Type Description sPermissionable
String A string representing the permissionable item that we are going to 'trade on behalf of'. -
tradeOnBehalfOfUserChanged(sPermissionable)
-
A 'trade on behalf of' change has been completed, and any subsequent prices are from the new tier.
Parameters:
Name Type Description sPermissionable
String A string representing the permissionable item that we are now 'trading on behalf of'. -
tradeStarted()
-
This method is called by the trading components, triggering
module:caplin/trading/service/TOBOUserServiceListener#onLockChanged
on all the TOBOUserService's listeners, enabling them to 'lock' their behaviour.