Caplin Trader 5.1.0

Interface: module:ct-trading/service/TradePermissionService

module:ct-trading/service/TradePermissionService

A helper class that fronts module:ct-services/security/PermissionService, and provides higher level permissioning information that can be used throughout the application.

Methods

addAccountsListener(sInstrument, oListener) → {int}

Add a listener that will be called back each time the permission on the given instrument changes in respect to the set of accounts the user has.

Parameters:
Name Type Description
sInstrument String
oListener Object

Listener to receive onAccountsPermissionsChanged() callbacks

Returns:

a unique identifier for this listener so it can later be removed using module:ct-trading/service/TradePermissionService#removeListener

Type
int

addInstrumentViewableListener(sInstrument, oListener) → {int}

Add a listener that will be called back each time the permission on the given instrument changes in respect to whether is it is viewable.

Parameters:
Name Type Description
sInstrument String
oListener Object

Listener to receive onViewPermissionsChanged() callbacks

Returns:

a unique identifier for this listener so it can later be removed using module:ct-trading/service/TradePermissionService#removeListener

Type
int

addTicketTradableListener(sInstrument, oListener) → {int}

Add a listener that will be called back each time the permission on the given instrument changes in respect to whether ticket trading is possible.

Parameters:
Name Type Description
sInstrument String
oListener Object

Listener to receive onTicketPermissionsChanged() callbacks

Returns:

a unique identifier for this listener so it can later be removed using module:ct-trading/service/TradePermissionService#removeListener

Type
int

addTileTradableListener(sInstrument, oListener) → {int}

Add a listener that will be called back each time the permission on the given instrument changes in respect to whether tile trading is possible.

Parameters:
Name Type Description
sInstrument String
oListener Object

Listener to receive onTilePermissionsChanged() callbacks

Returns:

a unique identifier for this listener so it can later be removed using module:ct-trading/service/TradePermissionService#removeListener

Type
int

canTradeInTicket(sInstrument)

Determine whether the user is permitted to trade the given instrument within a ticket.

Parameters:
Name Type Description
sInstrument String

the instrument to be traded.

canTradeInTile(sInstrument)

Determine whether the user is permitted to trade the given instrument within a tile.

Parameters:
Name Type Description
sInstrument String

the instrument to be traded.

filterOutNonViewPermissionedBaseCurrencies(pListOfBaseCurrencies, pCompleteList)

Returns a filtered array of currency bases, filtering pListOfBaseCurrencies, letting through the filter only the currency bases that are VIEW permitted.

Parameters:
Name Type Description
pListOfBaseCurrencies Array

an array of the possible currency bases.

pCompleteList Array

an array containing all possible currencies.

filterOutNonViewPermissionedCurrencyPairs(pListOfPairs)

Returns a filtered array of currency pairs, filtering pListOfPairs, letting through the filter only the currency pairs that are VIEW permitted.

Parameters:
Name Type Description
pListOfPairs Array

an array of the possible currencies.

removeListener(nListenerId)

Remove a previously registered listener using the given identifier

Parameters:
Name Type Description
nListenerId int

The id of the listener to remove.