> ## 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.

# Crypto Institutional Adoption

> Assess crypto exposure to institutional adoption trends using premium sources

Identify cryptocurrencies positioned to benefit from institutional adoption ahead of broader market recognition. This workflow adapts our proven equity research screening methodology to digital assets, systematically identifying cryptocurrencies genuinely aligned with key institutional adoption drivers.

## Why It Matters

Crypto institutional adoption is accelerating rapidly, but identifying which digital assets stand to benefit most requires analyzing vast amounts of information from news, regulatory updates, and market data. Manual analysis is inefficient and prone to bias. As institutional capital enters the market, the window to identify well-positioned cryptocurrencies before mass recognition is narrowing. A systematic, data-driven approach is essential to uncover emerging leaders ahead of the crowd.

## What It Does

The cookbook REST modules (`src/bigdata_rest.py`, `src/search_entities.py`, and OpenAI helpers) combined with the Bigdata.com REST API deliver institutional-grade thematic intelligence at scale. Designed for analysts, PMs, and strategists, the workflow systematically connects cryptocurrencies to investment themes using unstructured news from the dedicated Crypto Wire source.

## How It Works

This workflow follows a systematic 4-step process to transform investment themes into actionable intelligence:

1. **Generate Theme Taxonomy** - OpenAI-powered breakdown of the main theme into specific, measurable sub-themes
2. **Search with Premium Sources** - Semantic content retrieval leveraging our dedicated Crypto Wire source, delivering 'gold-standard' quality, topicality, volume, source diversity, coverage and timeliness for comprehensive digital asset intelligence
3. **Label Results** - LLM-based classification to analyze text chunks and determine relevance to sub-themes, filtering out content not explicitly linked to the main theme
4. **Post-process & Score** - Qualitative-to-quantitative transformation that aggregates thematic signals into structured scoring methodologies for portfolio-level assessment

## A Real-World Use Case

This cookbook demonstrates a systematic approach for identifying institutional adoption trends across 15 major cryptocurrencies, leveraging our dedicated Crypto Wire source. The workflow enables early detection of digital assets positioned to benefit from increasing institutional capital flows, delivering actionable insights before these trends become widely apparent.

**Ready to get started? Let's dive in!**

<div style={{display: 'flex', gap: '10px', alignItems: 'center', margin: '0', lineHeight: '1'}}>
  <a href="https://github.com/Bigdata-com/bigdata-cookbook/tree/main/Screener_for_Crypto" target="_blank" style={{textDecoration: 'none'}}>
    <img alt="Open in GitHub" noZoom src="https://img.shields.io/badge/GitHub-View%20Repository-black?style=flat&logo=github" />
  </a>
</div>

## Prerequisites

To run the Crypto Thematic Exposure workflow, you can choose between two options:

* 💻 **GitHub cookbook**
  * Use this if you prefer working locally or in a custom environment.
  * Follow the setup and execution instructions in the [`README.md`](https://github.com/Bigdata-com/bigdata-cookbook/blob/main/Screener_for_Crypto/README.md).
  * Copy `.env.example` to `.env` and set:
    * `BIGDATA_API_KEY` — your [Bigdata.com API key](https://docs.bigdata.com/api-reference/introduction#api-key)
    * `OPENAI_API_KEY` — your OpenAI API key (required for theme generation and labeling)
    * See the cookbook [`README.md`](https://github.com/Bigdata-com/bigdata-cookbook/blob/main/Screener_for_Crypto/README.md) for full setup instructions.

* 🐳 **Docker Installation**
  * [Docker installation](https://github.com/Bigdata-com/bigdata-cookbook/blob/main/Screener_for_Crypto/README.md#docker-installation-and-usage) is available for containerized deployment.
  * Provides an alternative setup method with containerized deployment, simplifying the environment configuration for those preferring Docker-based solutions.

## Setup and Imports

Below is the Python code required for setting up our environment and importing necessary libraries.

```python [expandable] theme={null}
import json
import os

import pandas as pd
from dotenv import load_dotenv
from pathlib import Path
from openai import OpenAI

from src.bigdata_rest import BigdataRestClient, load_crypto_universe
from src.openai_utils import sampling_params_for_model
from src.search_entities import search_by_entities, post_process_dataframe
from src.visualization_tool import display_figures

# Load credentials
script_dir = Path(__file__).parent if '__file__' in globals() else Path.cwd()
load_dotenv(script_dir / '.env')

BIGDATA_API_KEY = os.getenv("BIGDATA_API_KEY")
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")

if not all([BIGDATA_API_KEY, OPENAI_API_KEY]):
    raise ValueError("Missing required environment variables. Check your .env file.")

rest_client = BigdataRestClient(api_key=BIGDATA_API_KEY)
openai_client = OpenAI(api_key=OPENAI_API_KEY)
```

## Defining your Screening Parameters

* **Main Theme** (`main_theme`): The central concept to explore
* **Entity Universe** (`entity_ids` / `entity_names`): The Top 15 cryptocurrencies to screen, loaded from `data/top_15_cryptos.csv` (`RP_ENTITY_ID`, `ENTITY_NAME`)
* **Control Entities** (`control_entities`): Optional co-mention entities (people, places, organizations) appended to REST search filters
* **Time Period** (`start_date` and `end_date`): The date range over which to
  run the search
* **Document Type** (`document_type`): Specify which documents to search over
  (transcripts, filings, news)
* **Sources** (`sources`): Specify set of sources within a document type, for
  example which news outlets (available via Bigdata API) you wish to
  search over. For this crypto analysis, we leverage our dedicated **Crypto Wire \[D6D057]** source, which represents the 'gold-standard' in terms of quality, topicality, volume, source diversity, coverage and timeliness for cryptocurrency market intelligence
* **Fiscal Year** (`fiscal_year`): If the document type is transcripts or
  filings, fiscal year needs to be specified
* **Model Selection** (`llm_model`): The LLM model used to mindmap the theme
  and label the search result chunks
* **Rerank Threshold** (`rerank_threshold`): By setting this value, you're
  enabling the cross-encoder which reranks the results and selects
  those whose relevance is above the percentile you specify (0.7 being
  the 70th percentile). More information on the re-ranker can be found
  [here](https://sdk.bigdata.com/en/latest/how_to_guides/rerank_search.html).
* **Focus** (`focus`): Specify a focus within the main theme. This will then
  be used in building the LLM generated mindmapper

```python theme={null}
# ===== Theme Definition =====
main_theme = "Crypto Institutional Adoption"
focus="Include know your customer (KYC) and anti-money laundering (AML) themes"

# ===== Entity Universe (Top 15 Cryptos CSV) =====
# Entity IDs resolved from Bigdata.com and saved under Screener_for_Crypto/data/
from src.bigdata_rest import load_crypto_universe

entity_ids, entity_names = load_crypto_universe("data/top_15_cryptos.csv")
control_entities = None

# ===== LLM Specification =====
llm_model = "gpt-5.6-luna"

# ===== Docs Configuration =====
document_type = "news"
fiscal_year = None

# ===== Enable/Disable Reranker =====
rerank_threshold = None

# ===== Specify Time Range =====
start_date = "2025-01-01"
end_date = "2025-09-08"

# ===== Source Selection =====
# Crypto Wire [D6D057] - Gold-standard crypto intelligence
# Premium dedicated source providing superior quality, topicality, volume, 
# source diversity, coverage and timeliness for cryptocurrency market analysis
sources = ["D6D057"]
```

## Generate a Theme Taxonomy

Use OpenAI to break the main theme into sub-themes (replacing the removed SDK `generate_theme_tree`):

````python theme={null}
def generate_themes(main_theme: str, focus: str = "", n_themes: int = 5) -> list[str]:
    prompt = f'''Generate {n_themes} specific, measurable sub-themes for analyzing: "{main_theme}"

{"Focus: " + focus if focus else ""}

Each sub-theme should be a short descriptive sentence that explicitly connects back to the main theme.
Return ONLY a JSON array of strings.'''
    response = openai_client.chat.completions.create(
        model=llm_model,
        messages=[{"role": "user", "content": prompt}],
        **sampling_params_for_model(llm_model, temperature=0.3),
    )
    text = response.choices[0].message.content.strip()
    if text.startswith("```"):
        text = text.split("```")[1]
        if text.startswith("json"):
            text = text[4:]
        text = text.strip()
    return json.loads(text)

node_summaries = generate_themes(main_theme, focus=focus, n_themes=5)
````

<Frame>
  <img src="https://mintcdn.com/ravenpackinternational/CdOOjql56-heSQBI/images/screener-for-crypto/tree_crypto.png?fit=max&auto=format&n=CdOOjql56-heSQBI&q=85&s=22ea08efbd9514cdb12bfbec04f9c01b" alt="Theme Tree Visualization showing Crypto Institutional Adoption broken down into sub-themes" width="2664" height="1907" data-path="images/screener-for-crypto/tree_crypto.png" />
</Frame>

The taxonomy includes descriptive sentences that explicitly connect each sub-theme back to the main theme, ensuring all search results remain contextually relevant to our central trend.

## Retrieve Content

With the theme taxonomy and screening parameters, call `search_by_entities` to retrieve news chunks for each crypto entity:

* **Document Limit** (`document_limit`): The maximum number of documents to return per entity/theme query (kept small for cost control)

```python theme={null}
document_limit = 10

df_sentences = search_by_entities(
    entity_ids=entity_ids,
    entity_names=entity_names,
    sentences=node_summaries,
    start_date=start_date,
    end_date=end_date,
    rest_client=rest_client,
    document_limit=document_limit,
)
```

## Label the Results

Use OpenAI to classify each text chunk against the theme taxonomy (replacing the removed `ScreenerLabeler`):

```python theme={null}
def label_crypto_text(text: str, entity_name: str, themes: list[str]) -> dict:
    prompt = f'''Analyze this text about {entity_name} and identify which theme it relates to most.

Themes: {", ".join(themes)}

Text: {text}

Return JSON: {{"label": "the closest matching theme, verbatim, or 'unclear'", "motivation": "brief one-sentence explanation"}}'''
    response = openai_client.chat.completions.create(
        model=llm_model,
        messages=[{"role": "user", "content": prompt}],
        response_format={"type": "json_object"},
        **sampling_params_for_model(llm_model, temperature=0.0),
    )
    return json.loads(response.choices[0].message.content)

label_results = df_sentences.apply(
    lambda row: label_crypto_text(row["text"], row["entity_name"], node_summaries),
    axis=1,
)
df_sentences["label"] = label_results.apply(lambda x: x.get("label", "unclear"))
df_sentences["motivation"] = label_results.apply(lambda x: x.get("motivation", ""))

df = post_process_dataframe(df_sentences)
```

## Assess Thematic Exposure

We'll look at the top 10 most exposed cryptos to our main theme. The `score_entities` helper counts labeled chunks per sub-theme and sums them into a composite thematic score:

```python theme={null}
def score_entities(df: pd.DataFrame, themes: list[str]) -> pd.DataFrame:
    rows = []
    for entity in df["Entity"].unique():
        entity_df = df[df["Entity"] == entity]
        theme_counts = {theme: int((entity_df["Theme"] == theme).sum()) for theme in themes}
        rows.append({
            "Entity": entity,
            "Total Mentions": len(entity_df),
            "Themes Covered": sum(1 for count in theme_counts.values() if count > 0),
            **theme_counts,
            "Composite Score": sum(theme_counts.values()),
        })
    return pd.DataFrame(rows).sort_values("Composite Score", ascending=False).reset_index(drop=True)

df_entity = score_entities(df, node_summaries)

display_figures(df_entity, interactive=False, n_entities=10)
```

<Frame>
  <img src="https://mintcdn.com/ravenpackinternational/5etAOPn3HgO3U0F3/images/screener-for-crypto/exposure_map.png?fit=max&auto=format&n=5etAOPn3HgO3U0F3&q=85&s=bda67a139f4383d447af4492c72b3be4" alt="thematic exposure heatmap" width="1341" height="789" data-path="images/screener-for-crypto/exposure_map.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/ravenpackinternational/5etAOPn3HgO3U0F3/images/screener-for-crypto/total_composite_score.png?fit=max&auto=format&n=5etAOPn3HgO3U0F3&q=85&s=68d21ca3a21faeb282c52b3870a9f3ab" alt="thematic exposure score" width="1489" height="789" data-path="images/screener-for-crypto/total_composite_score.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/ravenpackinternational/5etAOPn3HgO3U0F3/images/screener-for-crypto/top_3.png?fit=max&auto=format&n=5etAOPn3HgO3U0F3&q=85&s=cd291fbde594408a10059c877afaf4f0" alt="top thematics" width="1490" height="789" data-path="images/screener-for-crypto/top_3.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/ravenpackinternational/5etAOPn3HgO3U0F3/images/screener-for-crypto/total_score.png?fit=max&auto=format&n=5etAOPn3HgO3U0F3&q=85&s=eb0507995c8588a754abb5b8de8355f7" alt="thematics scores" width="1489" height="789" data-path="images/screener-for-crypto/total_score.png" />
</Frame>

## Conclusion

The Crypto Institutional Adoption Analysis provides a powerful way to identify cryptocurrencies positioned to benefit from institutional investment flows and regulatory acceptance. By leveraging our dedicated **Crypto Wire \[D6D057]** source - the 'gold-standard' for cryptocurrency intelligence - and applying LLM-based classification, you can:

1. **Identify institutional adoption leaders** - Find cryptocurrencies with the strongest regulatory compliance, institutional partnerships, and enterprise-grade infrastructure
2. **Track adoption readiness** - Assess which digital assets are implementing KYC/AML frameworks, custody solutions, and institutional-grade security measures
3. **Monitor regulatory positioning** - Evaluate how different cryptocurrencies are adapting to evolving regulatory requirements and institutional standards
4. **Discover early adoption signals** - Spot cryptocurrencies gaining institutional traction before it becomes widely recognized in the market

Whether you're building institutional-focused crypto portfolios, conducting due diligence for institutional clients, or tracking the evolution of crypto's mainstream adoption, this workflow transforms institutional development signals into structured, investment-ready intelligence.
