Skip to main content
Version: v26

IWatchListApi

Interface

An API object for interacting with the widgetbar (right sidebar) watchlist.

Notes about watchlist contents

Watchlist items should be symbol names which your datafeed resolveSymbol method can resolve. This means that generally shorter names such as AAPL can be used if your datafeed understands it. However, it is recommend that you provided the symbol names as they appear within the symbolInfo result (for example: NASDAQNM:AAPL).

Additionally, any item in the list which is prefixed with ### will be considered a section divider in the watchlist.

Methods

createList

Create a list of symbols with listName name. If the listName parameter is not provided or there is no WatchList then null will be returned;

Signature

createList(listName?: string, symbols?: string[]) => WatchListSymbolList

Parameters

NameTypeDescription
listName?stringname for the watchlist
symbols?string[]symbol IDs for the watchlist. Any item in the list which is prefixed with ### will be considered a section divider in the watchlist.

Returns

WatchListSymbolList

WatchListSymbolList


defaultList

Get a default list of symbols.

Signature

defaultList() => string[]

Returns

default list of symbols

string[]


deleteList

Delete a watchlist of symbols

Signature

deleteList(listId: string) => void

Parameters

NameTypeDescription
listIdstringwatchlist ID

Returns

void


getActiveListId

Get the ID of the current watchlist. If there is no WatchList then null will be returned.

Signature

getActiveListId() => string

Returns

id of active watchlist

string


getAllLists

Get all watchlists. If there is no WatchList then null will be returned.

Signature

getAllLists() => WatchListSymbolListMap

Returns

object of all watchlists

WatchListSymbolListMap


getList

Get a list of symbols. If the id parameter is not provided then the current list will be returned. If there is no WatchList then null will be returned.

Signature

getList(id?: string) => string[]

Parameters

NameTypeDescription
id?stringWatchlist ID

Returns

list of symbols for watchlist

string[]


onActiveListChanged

Subscription for when the active watchlist is changed to a different list. Use the subscribe method of the returned ISubscription object to subscribe to the notifications.

Signature

onActiveListChanged() => ISubscription<EmptyCallback>

Returns

ISubscription<EmptyCallback>


onListAdded

Subscription for when a new list is added to the watchlist widget. Use the subscribe method of the returned ISubscription object to subscribe to the notifications.

Signature

onListAdded() => ISubscription<WatchListSymbolListAddedCallback>

Returns

ISubscription<WatchListSymbolListAddedCallback>


onListChanged

Subscription for when the symbols of the active watchlist are changed. Use the subscribe method of the returned ISubscription object to subscribe to the notifications.

Signature

onListChanged() => ISubscription<WatchListSymbolListChangedCallback>

Returns

ISubscription<WatchListSymbolListChangedCallback>


onListRemoved

Subscription for when a list is removed from the watchlist widget. Use the subscribe method of the returned ISubscription object to subscribe to the notifications.

Signature

onListRemoved() => ISubscription<WatchListSymbolListRemovedCallback>

Returns

ISubscription<WatchListSymbolListRemovedCallback>


onListRenamed

Subscription for when a list is renamed. Use the subscribe method of the returned ISubscription object to subscribe to the notifications.

Signature

onListRenamed() => ISubscription<WatchListSymbolListRenamedCallback>

Returns

ISubscription<WatchListSymbolListRenamedCallback>


renameList

Rename the watchlist.

Signature

renameList(listId: string, newName: string) => void

Parameters

NameTypeDescription
listIdstringID of the watchlist
newNamestringnew name to set for the watchlist

Returns

void


saveList

Save a list of symbols.

Signature

saveList(list: WatchListSymbolList) => boolean

Parameters

NameType
listWatchListSymbolList

Returns

If there is no WatchList or an equivalent list already exists then false will be returned, otherwise true will returned.

boolean


setActiveList

Make the watchlist with the specified id active.

Signature

setActiveList(id: string) => void

Parameters

NameTypeDescription
idstringwatchlist ID

Returns

void


setList

Obsolete. Use updateList instead.

Set the list of symbols for the watchlist. It will replace the entire list.

Signature

setList(symbols: string[]) => void

Parameters

NameTypeDescription
symbolsstring[]symbol IDs

Returns

void


updateList

Edit the list of symbols for a watchlist.

Signature

updateList(listId: string, symbols: string[]) => void

Parameters

NameTypeDescription
listIdstringID of the watchlist
symbolsstring[]symbols to be set for the watchlist. Any item in the list which is prefixed with ### will be considered a section divider in the watchlist.

Returns

void