book
Checkout our new book! Hands on AI Trading with Python, QuantConnect, and AWS Learn More arrow

Securities and Exchange Commission

US SEC Filings

Introduction

The US SEC Filings dataset provides the quarterly financial earning reports that the United States Securities and Exchange Commission (SEC) requires from publicly traded companies in the US. The data covers 15,000 US Equities, starts in January 1998, and is delivered on a daily frequency. The data is sourced from the SEC's Electronic Data Gathering, Analysis, and Retrieval (EDGAR) system. QuantConnect downloads and formats the Quarterly Financial Reports (10-Q) and Annual Financial Report (8-K) filings of companies into a format for easy consumption by LEAN.

For more information about the US SEC Filings dataset, including CLI commands and pricing, see the dataset listing.

About the Provider

The mission of the U.S. Securities and Exchange Commission is to protect investors, maintain fair, orderly, and efficient markets, and facilitate capital formation. The SEC oversees the key participants in the securities world, including securities exchanges, securities brokers and dealers, investment advisors, and mutual funds. The SEC is concerned primarily with promoting the disclosure of important market-related information, maintaining fair dealing, and protecting against fraud.

Getting Started

The following snippet demonstrates how to request data from the US SEC Filings dataset:

Select Language:
from QuantConnect.DataSource import *

self.aapl = self.add_equity("AAPL", Resolution.MINUTE).symbol
self.report_8k_symbol = self.add_data(SECReport8K, self.aapl).symbol
self.report_10k_symbol = self.add_data(SECReport10K, self.aapl).symbol
self.report_10q_symbol = self.add_data(SECReport10Q, self.aapl).symbol

Data Summary

The following table describes the dataset properties:

PropertyValue
Start DateJanuary 1998
Asset Coverage15,000 US Equities
Data DensitySparse
ResolutionDaily
TimezoneUTC

Example Applications

The US SEC Filings dataset enables you to create strategies using information from SEC reports. Examples include the following strategies:

  • Extracting information about corporate earnings from the documents for further analysis
  • Applying sentiment analysis to the text content of the documents (for example, keyword scoring and ranking)

For more example algorithms, see Examples.

Data Point Attributes

The US SEC Filings dataset provides SECReport8K, SECReport10K, and SECReport10Q objects.

Report 8K Attributes

SECReport8K objects have the following attributes:

Report 10K Attributes

SECReport10K objects have the following attributes:

Report 10Q Attributes

SECReport10Q objects have the following attributes:

Requesting Data

To add US SEC Filings data to your algorithm, call the add_data method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

Select Language:
class SECReportAlgorithm(QCAlgorithm):
    def initialize(self) -> None:
        self.set_start_date(2019, 1, 1)
        self.set_end_date(2019, 8, 21)
        self.set_cash(100000)

        self.aapl = self.add_equity("AAPL", Resolution.MINUTE).symbol
        self.report_8k_symbol = self.add_data(SECReport8K, self.aapl).symbol
        self.report_10k_symbol = self.add_data(SECReport10K, self.aapl).symbol
        self.report_10q_symbol = self.add_data(SECReport10Q, self.aapl).symbol

Accessing Data

To get the current US SEC Filings data, index the current Slice with the dataset Symbol. Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

Select Language:
def on_data(self, slice: Slice) -> None:
    if slice.contains_key(self.report_8k_symbol):
        data_point = slice[self.report_8k_symbol]
        self.log(f"{self.report_8k_symbol} report count at {slice.time}: {len(data_point.report.documents)}")

    if slice.contains_key(self.report_10k_symbol):
        data_point = slice[self.report_10k_symbol]
        self.log(f"{self.report_10k_symbol} report count at {slice.time}: {len(data_point.report.documents)}")

    if slice.ContainsKey(self.report_10q_symbol):
        data_point = slice[self.report_10q_symbol]
        self.log(f"{self.report_10q_symbol} report count at {slice.Time}: {len(data_point.report.documents)}")

To iterate through all of the dataset objects in the current Slice, call the get method.

Select Language:
def on_data(self, slice: Slice) -> None:
    for dataset_symbol, data_point in slice.get(SECReport8K).items():
        self.log(f"{dataset_symbol} report count at {slice.time}: {len(data_point.report.documents)}")

    for dataset_symbol, data_point in slice.get(SECReport10K).items():
        self.log(f"{dataset_symbol} report count at {slice.time}: {len(data_point.report.documents)}")

    for dataset_symbol, data_point in slice.get(SECReport10Q).items():
        self.log(f"{dataset_symbol} report count at {slice.time}: {len(data_point.report.documents)}")

Historical Data

To get historical US SEC Filings data, call the history method with the dataset Symbol. If there is no data in the period you request, the history result is empty.

Select Language:
# DataFrames
report_8k_history_df = self.history(self.report_8k_symbol, 100, Resolution.DAILY)
report_10k_history_df = self.history(self.report_10k_symbol, 100, Resolution.DAILY)
report_10q_history_df = self.history(self.report_10q_symbol, 100, Resolution.DAILY)
history_df = self.history([self.report_8k_symbol, 
                           self.report_10k_symbol,
                           self.report_10q_symbol], 100, Resolution.DAILY)

# Dataset objects
report_8k_history_bars = self.history[SECReport8K](self.report_8k_symbol, 100, Resolution.DAILY)
report_10k_history_bars = self.history[SECReport10K](self.report_10k_symbol, 100, Resolution.DAILY)
report_10q_history_bars = self.history[SECReport10Q](self.report_10q_symbol, 100, Resolution.DAILY)

For more information about historical data, see History Requests.

Remove Subscriptions

To remove a subscription, call the remove_security method.

Select Language:
self.remove_security(self.report_8k_symbol)
self.remove_security(self.report_10k_symbol)
self.remove_security(self.report_10q_symbol)

If you subscribe to US SEC Filings data for assets in a dynamic universe, remove the dataset subscription when the asset leaves your universe. To view a common design pattern, see Track Security Changes.

Example Applications

The US SEC Filings dataset enables you to create strategies using information from SEC reports. Examples include the following strategies:

  • Extracting information about corporate earnings from the documents for further analysis
  • Applying sentiment analysis to the text content of the documents (for example, keyword scoring and ranking)

For more example algorithms, see Examples.

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: