> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bigdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage your Watchlists

Watchlists are an essential feature in Bigdata, allowing users to track
specific securities or assets of interest with ease. Below, we'll walk
you through the process of managing your watchlists.

<Note>
  Watchlists are not yet supported in the API.
</Note>

# Create a Watchlist

To create a new watchlist, use the `create` method and define the name
and a list of items:

```python theme={null}
from bigdata_client import Bigdata

bigdata = Bigdata()

# Entity IDs:
META = "12E454"
AMAZON = "0157B1"
MICROSOFT = "228D42"
APPLE = "D8442A"
ALPHABET = "4A6F00"

MAMAA_watchlist = bigdata.watchlists.create(name="MAMAA stocks news", items=[META, AMAZON, MICROSOFT, APPLE, ALPHABET])
print(MAMAA_watchlist)
```

Output:

```text theme={null}
id='b548fc37-87d3-4bc7-b482-eeeeb7060f78' name='MAMAA stocks news' date_created=datetime.datetime(2024, 9, 18, 14, 45, 23, 659778) last_updated=datetime.datetime(2024, 9, 18, 14, 45, 23, 659831) query_type='watchlist' company_shared_permission=None
```

# Retrieve Watchlists

You can retrieve a watchlist by ID using the method `get`:

```python theme={null}
my_watchlist = bigdata.watchlists.get(MAMAA_watchlist.id)  # for instance: "b548fc37-87d3-4bc7-b482-eeeeb7060f78"
print(my_watchlist)
```

Output:

```console theme={null}
id='b548fc37-87d3-4bc7-b482-eeeeb7060f78' name='MAMAA stocks news' date_created=datetime.datetime(2024, 9, 18, 14, 45, 23, 659778) last_updated=datetime.datetime(2024, 9, 18, 14, 45, 23, 659831) query_type='watchlist' company_shared_permission=None
```

The retrieved watchlist object contains the `id`, `name` and metadata
such as `date_created` or `last_updated`, representing the dates when
the object was created and last updated, respectively.

And you can access the watchlist `items` list from the object (Items are
[lazy evaluated](https://en.wikipedia.org/wiki/Lazy_evaluation))

```python theme={null}
print(my_watchlist.items)
```

Output:

```console theme={null}
['0157B1', 'D8442A', '4A6F00', '12E454', '228D42']
```

You can also retrieve all your watchlists with the method `list`:

```python theme={null}
all_watchlists = bigdata.watchlists.list()
```

<Warning>
  Caution

  When fetching all watchlists (`bigdata.watchlists.list()`) you will get
  all the watchlists you have access to, that is, those that belong to you
  and those that were shared from someone within your organization.
</Warning>

`list` method support `owned` parameter

When `owned=True` is provided only watchlists which owned by logged user
will be returned

```python theme={null}
owned_watchlists = bigdata.watchlists.list(owned=True)
```

# Share Watchlists

Watchlists can be **shared** with everyone else in the company. Once a
watchlist is shared users will gain read access. They won't be able to
modify it but they will be able to use it in their queries. To share a
watchlist, use the `share_with_company` method.

You can share a watchlist using the object in memory:

```python theme={null}
my_watchlist.share_with_company()
```

Or using its ID:

```python theme={null}
bigdata.watchlists.share_with_company("<the_watchlist_id>")
```

After sharing, the `company_shared_permission` attribute of the
watchlist object will be set to `SharePermission.READ`.

# Unshare Watchlists

You can **unshare** a watchlist using the method `unshare_with_company`.

Using the object in memory:

```python theme={null}
my_watchlist.unshare_with_company()
```

Or using its ID:

```python theme={null}
bigdata.watchlists.unshare_with_company("<the_watchlist_id>")
```

<Warning>
  If you delete a shared watchlist, those queries from not owner users
  will raise an error at execution time because of missing references.
</Warning>

# Update Watchlists

Once you define a watchlist, you can always update its name:

```python theme={null}
my_watchlist.name = "MAMAA Product Release"
my_watchlist.save()
```

Extend the list of existing items:

```python theme={null}
my_watchlist.items.append("business,products-services,product-release,,")
my_watchlist.save()
```

Or entirely replace it:

```python theme={null}
my_watchlist.items = ["<new_list>"]
my_watchlist.save()
```

# Delete Watchlists

If you no longer need a watchlist, you can delete it using the `delete`
method.

Using the object in memory:

```python theme={null}
my_watchlist.delete()
```

Or using its ID:

```python theme={null}
bigdata.watchlists.delete("<the_watchlist_id>")
```
