DEV Community

Onizuka
Onizuka

Posted on

Building an AI Stock Pool: Enriching Tickers with Unified Company Profiles

ai #stocks #fintech #api #rapidapi #companydata #python #datascience

AI industry-chain investing is one of the hottest themes right now. Whether you are tracking US chipmakers, Chinese A-share compute suppliers, or policy-driven deployment waves, a “stock pool” is usually just a list of tickers. That list tells you what to watch, but not who the company is, what it does, or how big it is.

To turn a ticker list into an actionable AI stock pool, you need unified company context: description, industry, headquarters, employee count, revenue, website, and founding year. That is exactly what the Company Info API delivers by merging data from Wikipedia and Wikidata into a single, easy-to-consume JSON response.

In this article, I will show you how to enrich an AI stock pool—covering both US and A-share tickers—with company profiles using Python, pandas, and the Company Info API.


Why raw ticker pools are not enough

A typical AI industry-chain pool looks like this:

ticker
NVDA
AMD
TSM
002230.SZ
300308.SZ
603019.SS

You can price these symbols easily, but answering strategic questions is harder:

  • Is 300308.SZ a data-center optics supplier or a consumer brand?
  • Does NVDA compete directly with AMD in the same segment?
  • Which pool members have the largest revenue and headcount?

By enriching each ticker with a unified company profile, you can:

  • Cluster holdings by industry and sub-sector.
  • Filter out companies that do not fit your AI-chain thesis.
  • Benchmark competitors by revenue and employees.
  • Map policy pressure and active-discovery narratives to real business fundamentals.

What the Company Info API returns

The API merges public knowledge from Wikipedia and Wikidata into a normalized profile. A typical response includes:

{
  "ticker": "NVDA",
  "name": "NVIDIA Corporation",
  "description": "NVIDIA is an American multinational technology company ...",
  "industry": "Semiconductors, Artificial intelligence",
  "founded": "1993",
  "headquarters": "Santa Clara, California, United States",
  "website": "https://www.nvidia.com",
  "employees": 29600,
  "revenue": "26.97 billion USD"
}
Enter fullscreen mode Exit fullscreen mode

Because the same structure applies across US and international companies, it is ideal for building a cross-market AI stock pool.


Building the enrichment pipeline

Let us build a small Python tool that reads a CSV of tickers, calls the API for each one, and writes an enriched CSV.

1. Prepare your ticker list

Create ai_stock_pool.csv:

ticker
NVDA
AMD
TSM
002230.SZ
300308.SZ
603019.SS
Enter fullscreen mode Exit fullscreen mode

For A-shares, keep the exchange suffix (.SZ, .SS) or use the exact symbol format supported by the API docs.

2. Enrich with Python

import os
import time
import requests
import pandas as pd
from pathlib import Path

# Load your RapidAPI credentials from environment variables
RAPIDAPI_KEY = os.getenv("RAPIDAPI_KEY")
RAPIDAPI_HOST = "company-info1.p.rapidapi.com"
# Replace with the exact endpoint shown in the RapidAPI dashboard
RAPIDAPI_ENDPOINT = "https://company-info1.p.rapidapi.com/get-company-info"

def enrich_ticker(ticker: str) -> dict:
    headers = {
        "X-RapidAPI-Key": RAPIDAPI_KEY,
        "X-RapidAPI-Host": RAPIDAPI_HOST,
    }
    params = {"company": ticker}

    try:
        response = requests.get(
            RAPIDAPI_ENDPOINT,
            headers=headers,
            params=params,
            timeout=15,
        )
        response.raise_for_status()
        return response.json()
    except Exception as e:
        print(f"Failed to enrich {ticker}: {e}")
        return {"ticker": ticker, "error": str(e)}

def build_enriched_pool(input_csv: str, output_csv: str):
    df = pd.read_csv(input_csv)
    enriched = []

    for ticker in df["ticker"]:
        print(f"Enriching {ticker} ...")
        profile = enrich_ticker(ticker)
        enriched.append(profile)
        time.sleep(0.5)  # be polite to the API

    enriched_df = pd.json_normalize(enriched)
    enriched_df.to_csv(output_csv, index=False)
    print(f"Saved enriched pool to {output_csv}")

if __name__ == "__main__":
    build_enriched_pool("ai_stock_pool.csv", "ai_stock_pool_enriched.csv")
Enter fullscreen mode Exit fullscreen mode

Run it:

export RAPIDAPI_KEY="your-rapidapi-key"
python enrich_pool.py
Enter fullscreen mode Exit fullscreen mode

The result is a single CSV you can load into a screener, dashboard, or CRM.

3. Add a simple screener

Once enriched, filtering is trivial:

df = pd.read_csv("ai_stock_pool_enriched.csv")

# Keep only semiconductor / AI hardware names
ai_chain = df[df["industry"].str.contains("Semiconductor|Artificial", na=False)]

# Sort by revenue proxy if the API returned a numeric field
top_by_employees = df.sort_values("employees", ascending=False).head(10)
Enter fullscreen mode Exit fullscreen mode

How to use the Company Info API

You can subscribe and test the API directly from the RapidAPI hub:

🔗 Company Info API on RapidAPI

cURL example

curl --request GET \
  --url 'https://company-info1.p.rapidapi.com/get-company-info?company=NVDA' \
  --header 'X-RapidAPI-Host: company-info1.p.rapidapi.com' \
  --header 'X-RapidAPI-Key: your-rapidapi-key'
Enter fullscreen mode Exit fullscreen mode

Python example

import requests

url = "https://company-info1.p.rapidapi.com/get-company-info"
querystring = {"company": "NVDA"}
headers = {
    "X-RapidAPI-Key": "your-rapidapi-key",
    "X-RapidAPI-Host": "company-info1.p.rapidapi.com"
}

response = requests.get(url, headers=headers, params=querystring)
print(response.json())
Enter fullscreen mode Exit fullscreen mode

Replace get-company-info with the exact path shown in the RapidAPI endpoints page.

For more sample code and integration patterns, check the project repository:

🔗 Company Info API on GitHub


Use cases beyond stock pools

The same enrichment pattern works for:

  • CRM records – auto-fill company descriptions, HQ locations, and employee counts from a ticker or domain.
  • Sales intelligence – prioritize prospects by industry and revenue.
  • Market research – compare competitors across sectors.
  • B2B lead enrichment – turn a raw company name or ticker into a complete profile.

Conclusion

A ticker-only AI stock pool is a starting point, not a strategy. By integrating the Company Info API, you can convert raw symbols into unified company profiles with descriptions, industries, revenue, and headcount. Whether you are mapping US and A-share AI names, screening for policy-driven deployment themes, or building a one-click deployment pipeline, structured company data makes your application significantly smarter.

Grab your RapidAPI key, try the curl and Python examples, and explore the source on GitHub. Happy building!

Top comments (0)