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.
Watchlists are not yet supported in the API.
Create a Watchlist
To create a new watchlist, use the create method and define the name
and a list of items:
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:
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:
my_watchlist = bigdata.watchlists.get(MAMAA_watchlist.id) # for instance: "b548fc37-87d3-4bc7-b482-eeeeb7060f78"
print(my_watchlist)
Output:
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)
print(my_watchlist.items)
Output:
['0157B1', 'D8442A', '4A6F00', '12E454', '228D42']
You can also retrieve all your watchlists with the method list:
all_watchlists = bigdata.watchlists.list()
CautionWhen 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.
list method support owned parameter
When owned=True is provided only watchlists which owned by logged user
will be returned
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:
my_watchlist.share_with_company()
Or using its ID:
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:
my_watchlist.unshare_with_company()
Or using its ID:
bigdata.watchlists.unshare_with_company("<the_watchlist_id>")
If you delete a shared watchlist, those queries from not owner users
will raise an error at execution time because of missing references.
Update Watchlists
Once you define a watchlist, you can always update its name:
my_watchlist.name = "MAMAA Product Release"
my_watchlist.save()
Extend the list of existing items:
my_watchlist.items.append("business,products-services,product-release,,")
my_watchlist.save()
Or entirely replace it:
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:
Or using its ID:
bigdata.watchlists.delete("<the_watchlist_id>")