Caplin Trader 5.1.0

Interface: module:ct-watchlist/WatchlistService

module:ct-watchlist/WatchlistService

The WatchlistService provides access to the user's module:ct-watchlist/Watchlists.

This service can be accessed from the module:ct-core/ServiceRegistry, using the alias caplin.watchlist.watchlist-service.

This interface uses emitr allowing services implementing this interface to trigger events.

The service will emit events defined in module:ct-watchlist/WatchlistServiceEvents.

Methods

create(name, erroropt, successopt)

A request to create a module:ct-watchlist/Watchlist.

If the request is successful, an ADDED event will be raised (see module:ct-watchlist/WatchlistServiceEvents) for the newly created watchlist.

Parameters:
Name Type Attributes Description
name String

The user friendly name for the watchlist.

error function <optional>

A callback that will be invoked if the request fails.

success function <optional>

A callback that will be invoked when the request is fulfilled. The callback will be passed a single parameter which is the created module:ct-watchlist/Watchlist.

dispose(watchlists, erroropt, successopt)

A request to dispose of the given watchlists, removing them from the user's list of watchlists.

If the request is successful, a REMOVED event will be raised for each watchlist removed (see module:ct-watchlist/WatchlistServiceEvents).

Parameters:
Name Type Attributes Description
watchlists Array.<module:ct-watchlist/Watchlist>

The watchlists to dispose of.

error function <optional>

A callback that will be invoked if the request fails.

success function <optional>

A callback that will be invoked when the request is fulfilled.

dispose()

Disposes of any listeners and resources that were used by the service.

getById(id) → {module:ct-watchlist/Watchlist}

Returns the watchlist with the given id. If there is no watchlist with the given id, a special "null" watchlist will be returned instead.

Parameters:
Name Type Description
id String

The unique identifier of the required watchlist.

Returns:

the watchlist with the given id.

Type
module:ct-watchlist/Watchlist

getWatchlistCount() → {int}

Returns the number of watchlists.

Returns:

the number of watchlists.

Type
int

getWatchlists() → {Object}

Returns a snapshot of the watchlists.

Returns:

a watchlists object keyed by watchlist name.

Type
Object