Knowledge Graph

One of the most basic tasks in Bigdata is to explore the extensive database of analytics that powers it.

The knowledge_graph service allows users to retrieve objects related to the search term passed as input. These objects can be:

  • Entities: such as Companies, People, Places, Products, etc. detected across the Bigdata universe.

  • Topics: from the Bigdata taxonomy, representing macroeconomic, geopolitical, and business events.

  • Sources: Bigdata’s ecosystem comprises key high-quality content sources, including web content, premium news, press wires, call transcripts, and regulatory filings, sourced from around 40,000 sources.

Get companies by market identifiers

Bigdata provides specialized methods to retrieve company information using unique market identifiers such as ISIN, CUSIP, SEDOL, or listings. These methods allow users to directly query the database for relevant companies based on their identifiers.

Each of these methods accepts a list of strings as input and returns a list of corresponding company objects or None for identifiers that cannot be matched. The methods include:

  • get_companies_by_isin(isins: list[str])

  • get_companies_by_cusip(cusips: list[str])

  • get_companies_by_sedol(sedols: list[str])

  • get_companies_by_listing(listings: list[str])

Examples

import os
from bigdata_client import Bigdata

# Initialize the Bigdata API
username = os.environ.get("BIGDATA_USERNAME")
password = os.environ.get("BIGDATA_PASSWORD")
bigdata = Bigdata(username, password)

# Fetch companies by ISINs
isins = ["US0378331005", "US0231351067", "LU1861138375"]
companies_by_isin = bigdata.knowledge_graph.get_companies_by_isin(isins)
for isin, company in zip(isins, companies_by_isin):
   if company:
      print(f"{company.name}: {company.id}")
   else:
      print(f"Company not found for ISIN {isin}")


# Fetch companies by CUSIPs
cusips = ["037833100", "023135106", "023135103"]
companies_by_cusip = bigdata.knowledge_graph.get_companies_by_cusip(cusips)
for cusip, company in zip(cusips, companies_by_cusip):
   if company:
      print(f"{company.name}: {company.id}")
   else:
      print(f"Company not found for CUSIP {cusip}")


# Fetch companies by SEDOLs
sedols = ["2046251", "2000019", "BNV0000"]
companies_by_sedol = bigdata.knowledge_graph.get_companies_by_sedol(sedols)
for sedol, company in zip(sedols, companies_by_sedol):
   if company:
      print(f"{company.name}: {company.id}")
   else:
      print(f"Company not found for SEDOL {sedol}")


# Fetch companies by Listings
# Listing is the combination of the Market Identifier Code (MIC) and company ticker separated by the character ":", e.g: "XNAS:META"
listings = ["XNAS:AAPL", "XNAS:AMZN", "XNAS:AAAA"]
companies_by_listing = bigdata.knowledge_graph.get_companies_by_listing(listings)
for listing, company in zip(listings, companies_by_listing):
   if company:
      print(f"{company.name}: {company.id}")
   else:
      print(f"Company not found for listing {listing}")

These methods raise a TypeError if the input is not a list of strings, ensuring users provide valid data.

Autosuggest

To obtain analytic suggestions, the Bigdata Knowledge Graph is accessible through a simple method: autosuggest. By using this method, it is possible to query the extensive database, obtaining IDs and metadata of different objects based on user input.

from bigdata_client import Bigdata

# Create a Bigdata object, the main entry point to the API
bigdata = Bigdata()
results = bigdata.knowledge_graph.autosuggest("tesla")

for obj in results:
     print(f"{obj.name}: {obj.id}")

As illustrated below, it is possible to easily generate portfolios or interest lists:

tickers = ["META", "AAPL", "AMZN", "NFLX", "GOOGL"]
FAANG = []
for t in tickers:
    FAANG.append(bigdata.knowledge_graph.autosuggest(t, limit=1))

print(FAANG)

By using the classes provided within this wrapper, users can expect to receive company-related information when querying by search term, allowing for easy filtration of results:

from bigdata_client import Bigdata, Company

results = bigdata.knowledge_graph.autosuggest("tesla")
for obj in result:
    if isinstance(obj, Company):
        print(f"{obj.name}: {obj.id}")

Go to API Reference for the full list of domain objects and their methods.

Another way to filter knowledge graph results is by using the find_{element}() method. Here is an example based on the previous one:

from bigdata_client import Bigdata

results = bigdata.knowledge_graph.find_products("tesla")

for obj in results:
   print(f"{obj.name}: {obj.id}")

The available elements for filtering are: find_companies, find_people, find_organizations, find_places, find_products, find_sources, find_topics and find_etfs.

Getting objects by ID

Next, we demonstrate how to fetch analytics in reverse, i.e., by providing an ID. When managing searches and handling responses, matches are often represented by IDs. To retrieve their metadata, the get_{object} methods are available, supporting an array of items as input:

FAANG = ["228D42", "D8442A", "4A6F00", "ECD263", "4A6F00"]
entities_lookup = bigdata.knowledge_graph.get_entities(FAANG)

for entity in entities_lookup:
   entity_data = vars(entity)
   for key, value in entity_data.items():
      print(f"{key.capitalize()}: {value}")
   print()

# Other analytic types you can look-up
topics_lookup = bigdata.knowledge_graph.get_topics(["business,stock-prices,stock-price,,"])

sources_lookup = bigdata.knowledge_graph.get_sources(["B5569E"])