Caplin Trader 4.8.0

Interface: module:caplin/watchlist/WatchlistService

module:caplin/watchlist/WatchlistService

The WatchlistService provides access to the user's module:caplin/watchlist/Watchlists.
This service can be accessed from the module:caplin/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:caplin/watchlist/WatchlistServiceEvents.

Implementations:

Methods

create(name, erroropt, successopt)

A request to create a module:caplin/watchlist/Watchlist.

If the request is successful, an ADDED event will be raised (see module:caplin/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:caplin/watchlist/Watchlist.
Implementations:

dispose()

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

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:caplin/watchlist/WatchlistServiceEvents).

Parameters:
Name Type Attributes Description
watchlists Array.<module:caplin/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.

getById(id) → {module:caplin/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.
Implementations:
Returns:
the watchlist with the given id.
Type
module:caplin/watchlist/Watchlist

getWatchlistCount() → {int}

Returns the number of watchlists.
Implementations:
Returns:
the number of watchlists.
Type
int

getWatchlists() → {Object}

Returns a snapshot of the watchlists.
Implementations:
Returns:
a watchlists object keyed by watchlist name.
Type
Object