Constructor
new module:ct-trading /service /TOBOUser Service Provider(oTrade OnBehalf Ofopt)
Constructs an instance of TOBOUserServiceProvider
.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
oTradeOnBehalfOf |
module:ct-trading |
<optional> |
{module:ct-trading/trademodel/TradeOnBehalfOf TradeOnBehalfOf} | The trade-on-behalf-of object. |
Methods
add Listener(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:ct-trading |
Listener object. |
- Implements:
- See:
can Perform Trade() → {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
can Trade OnBehalf Of() → {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
get Account() → {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
get Trade OnBehalf OfUser() → {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
get User Type() → {String}
Returns the type of the logged-in user.
- Implements:
- See:
Returns:
The current logged-in user's type.
- Type
- String
remove Listener(oListener)
Remove a listener of the TOBOUserServiceProvider.
Parameters:
Name | Type | Description |
---|---|---|
oListener |
module:ct-trading |
Listener object. |
- Implements:
- See:
set Account(sAccount)
Sets the current TOBO user's account to be used for trading by the logged-in user.
module:ct-trading/service/TOBOUserServiceListener#onTOBOAccountChanged
is called on
all the TOBOUserService's listeners.
Parameters:
Name | Type | Description |
---|---|---|
sAccount |
String | The account name. |
- Implements:
- See:
set Trade OnBehalf OfUser(sUser)
This method sets the TOBO user and updates the account list with the accounts available for the new
TOBO user. module:ct-trading/service/TOBOUserServiceListener#onTOBOUserChanged
is called on
all the TOBOUserService's listeners.
Parameters:
Name | Type | Description |
---|---|---|
sUser |
String | The TOBO user's userName. |
- Implements:
- See:
trade Finished()
This method is called by the trading components. If the TOBOUserService detects that no more trades
are executing, the module:ct-trading/service/TOBOUserServiceListener#onLockChanged
is called on
all the TOBOUserService's listeners, enabling them to 'unlock' their behaviour.
- Implements:
- See:
trade OnBehalf OfChange Failed(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. |
trade OnBehalf OfChange Initiated(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'. |
trade OnBehalf OfUser Changed(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'. |
trade Started()
This method is called by the trading components, triggering module:ct-trading/service/TOBOUserServiceListener#onLockChanged
on all the TOBOUserService's listeners, enabling them to 'lock' their behaviour.