A Guide to Tracking Keyword Trends in SEC Filings with SEC API
Maciej Józefowicz

Maciej Józefowicz @maciej_jozefowicz

About: FinFeedAPI, CoinAPI

Joined:
Jun 12, 2025

A Guide to Tracking Keyword Trends in SEC Filings with SEC API

Publish Date: Aug 7
0 0

Monitoring how often certain keywords appear in SEC filings can show what topics are gaining importance for public companies. By tracking terms like "artificial intelligence," "inflation," or "cybersecurity," your application can surface emerging trends and shifts in market focus.

This guide presents a method for using the FinFeedAPI's /v1/full-textsearch endpoint to perform this kind of analysis. You will see how to search for filings containing specific keywords over monthly periods, get an accurate count of those filings, and then plot the results to visualize the trends.

This guide covers:

  • How to set up a list of keywords for tracking.
  • A method to search filings by month and get a full count of keyword mentions.
  • How to plot the frequency of these mentions over time.

What you need:

  • Python 3.x with pandas and matplotlib.
  • The api-bricks-sec-api-restlibrary.
  • Your personal FinFeedAPI key.

1. Environment Setup
First, you need to install the FinFeedAPI client library if it is not already on your system.

pip install api-bricks-sec-api-rest
Enter fullscreen mode Exit fullscreen mode

Next, prepare your Python script by importing the necessary libraries and configuring the API client with your key.

# Import necessary libraries
import pandas as pd
import matplotlib.pyplot as plt
from datetime import datetime, timedelta
import time
import api_bricks_sec_api_rest

# --- API Configuration ---
# IMPORTANT: Replace "YOUR_API_KEY_HERE" with your actual key.
API_KEY = "YOUR_API_KEY_HERE"
api_client_config = api_bricks_sec_api_rest.Configuration()
api_client_config.api_key['Authorization'] = API_KEY
api_client = api_bricks_sec_api_rest.ApiClient(configuration=api_client_config)

# --- Plotting Configuration ---
plt.style.use('seaborn-v0_8-darkgrid')
plt.rcParams['figure.figsize'] = (15, 8)
Enter fullscreen mode Exit fullscreen mode

2. Searching Filings for Keywords Over Time
The main part of this process is a loop that queries the /v1/full-textendpoint for each keyword over a series of months. To get an accurate count, the code must handle pagination by repeatedly calling the API for the same period until all pages of results have been retrieved.

This method can be intensive in its use of the API, so a small delay is added between page requests to manage the rate of calls.

# --- Analysis Parameters ---
# Keywords/phrases to track
KEYWORDS_TO_TRACK = [
    "artificial intelligence",
    "inflation",
    "supply chain",
    "cybersecurity",
    "ESG" # Environmental, Social, Governance
]

# Time range for analysis
START_YEAR = 2025
END_YEAR = 2025

# Filing type to search within (e.g., '10-K')
TARGET_FORM_TYPE = "10-K"

# --- Data Collection ---
keyword_trends_monthly = {}
page_size = 200
delay_between_pages_seconds = 0.5

# Initialize the FullTextSearchApi
full_text_api = api_bricks_sec_api_rest.FullTextSearchApi(api_client)

for keyword in KEYWORDS_TO_TRACK:
    print(f"\nTracking keyword: '{keyword}'")
    keyword_trends_monthly[keyword] = {}
    for year in range(START_YEAR, END_YEAR + 1):
        for month in range(1, 13):
            start_date_str = f"{year}-{month:02d}-01"
            if month == 12:
                end_date_str = f"{year}-12-31"
            else:
                next_month_date = datetime(year, month + 1, 1)
                end_date_str = (next_month_date - timedelta(days=1)).strftime(f"{year}-%m-%d")

            print(f"  Searching in period: {start_date_str} to {end_date_str}")

            total_count_for_period = 0
            page_number = 1

            while True: # Loop to fetch all pages
                try:
                    results = full_text_api.v1_full_text_get(
                        form_type=TARGET_FORM_TYPE,
                        filling_date_start=start_date_str,
                        filling_date_end=end_date_str,
                        text_contains=keyword,
                        page_size=page_size,
                        page_number=page_number
                    )

                    if results and isinstance(results, list) and len(results) > 0:
                        total_count_for_period += len(results)
                        page_number += 1
                        time.sleep(delay_between_pages_seconds)
                    else:
                        break # No more results, exit the page loop

                except Exception as e:
                    print(f"    An error occurred while fetching page {page_number}: {e}")
                    break

            date_key = f"{year}-{month:02d}"
            keyword_trends_monthly[keyword][date_key] = total_count_for_period
            print(f"  Total count for '{keyword}' in {date_key}: {total_count_for_period}")

# Convert the results dictionary to a DataFrame
trends_df_monthly = pd.DataFrame(keyword_trends_monthly)
trends_df_monthly.index = pd.to_datetime(trends_df_monthly.index)
trends_df_monthly = trends_df_monthly.sort_index()

print("\nKeyword Trend Data (Full Count, by Month):")
print(trends_df_monthly)
Enter fullscreen mode Exit fullscreen mode

3. Visualizing Keyword Trends
After collecting the data, you can plot it to see how the discussion of each topic has changed over time. A line chart is a good way to compare the trends for different keywords.

if not trends_df_monthly.empty:
    plt.figure(figsize=(15, 8))

    for keyword in trends_df_monthly.columns:
        plt.plot(trends_df_monthly.index, trends_df_monthly[keyword], marker='o', linestyle='-', label=keyword)

    plt.title(f'Keyword Mentions in {TARGET_FORM_TYPE or "All"} Filings Over Time (Monthly)')
    plt.xlabel('Month')
    plt.ylabel(f'Number of Filings Found')
    plt.legend(title="Keywords")
    plt.grid(True, linestyle='--', alpha=0.7)
    plt.xticks(rotation=45, ha='right')
    plt.ylim(bottom=0)
    plt.tight_layout()
    plt.show()
else:
    print("No monthly trend data collected to visualize.")
Enter fullscreen mode Exit fullscreen mode

A line chart titled

Final Thoughts
This guide presented a method for using the FinFeedAPI's full-text search to quantify and track keyword trends in SEC filings. The key to getting accurate counts is to handle the API's pagination correctly by fetching all pages of results for each search.

A few points to keep in mind for your own applications:

  • API Usage: This method makes many API calls, especially with a long list of keywords or a wide date range. Be aware of any rate limits or costs associated with your API subscription.
  • Execution Time: The process can take a while to complete because of the number of calls and the added delay between them.
  • Keyword Choice: The quality of the results depends on selecting good keywords. You might want to include variations or related terms in your searches.

This approach gives you a way to analyze the changing themes and priorities discussed in corporate disclosures.

Comments 0 total

    Add comment