asynctradier.clients.watchlist_client module

class asynctradier.clients.watchlist_client.WatchlistClient(session: WebUtil, account_id: str, token: str, sandbox: bool = False)[source]

Bases: object

A client for interacting with the watchlist API.

Parameters:
  • session (WebUtil) – The session object used for making HTTP requests.

  • account_id (str) – The ID of the account.

  • token (str) – The authentication token.

  • sandbox (bool, optional) – Whether to use the sandbox environment. Defaults to False.

async add_symbols_to_watchlist(watchlist_id: str, symbols: List[str]) Watchlist[source]

Add symbols to an existing watchlist.

Parameters:
  • watchlist_id (str) – The ID of the watchlist.

  • symbols (List[str]) – A list of symbols to add to the watchlist.

Returns:

The Watchlist object.

Return type:

Watchlist

async create_watchlist(name: str, symbols: List[str]) Watchlist[source]

Create a new watchlist.

Parameters:
  • name (str) – The name of the watchlist.

  • symbols (List[str]) – A list of symbols to add to the watchlist.

Returns:

The Watchlist object.

Return type:

Watchlist

async delete_watchlist(watchlist_id: str) None[source]

Delete a watchlist by ID.

Parameters:

watchlist_id (str) – The ID of the watchlist.

async get_watchlist(watchlist_id: str) Watchlist[source]

Get a specific watchlist by ID.

Parameters:

watchlist_id (str) – The ID of the watchlist.

Returns:

The Watchlist object.

Return type:

Watchlist

async get_watchlists() List[Watchlist][source]

Get all watchlists for the account.

Returns:

A list of Watchlist objects.

Return type:

List[Watchlist]

async remove_symbol_from_watchlist(watchlist_id: str, symbol: str) Watchlist[source]

Remove a symbol from an existing watchlist.

Parameters:
  • watchlist_id (str) – The ID of the watchlist.

  • symbol (str) – The symbol to remove from the watchlist.

Returns:

The Watchlist object.

Return type:

Watchlist

async update_watchlist(watchlist_id: str, name: str, symbols: List[str]) Watchlist[source]

Update an existing watchlist.

Parameters:
  • watchlist_id (str) – The ID of the watchlist.

  • name (str) – The new name of the watchlist.

  • symbols (List[str]) – A list of symbols to add to the watchlist.

Returns:

The Watchlist object.

Return type:

Watchlist