Brain

Brain Language Metrics on Company Filings

Introduction

The Brain Language Metrics on Company Filings dataset provides the results of an NLP system that monitors several language metrics on 10-K and 10-Q company reports for US Equities. The data covers 5,000 US Equities, starts in January 2010, and is delivered on a daily frequency. The dataset is made of two parts; the first one includes the language metrics of the most recent 10-K or 10-Q report for each firm, namely:

  1. Financial sentiment
  2. Percentage of words belonging to financial domain classified by language types (e.g. “litigious” or “constraining” language)
  3. Readability score
  4. Lexical metrics such as lexical density and richness
  5. Text statistics such as the report length and the average sentence length

The second part includes the differences between the two most recent 10-Ks or 10-Qs reports of the same period for each company, namely:

  1. Difference of the various language metrics (e.g. delta sentiment, delta readability score, delta percentage of a specific language type etc.)
  2. Similarity metrics between documents, also with respect to a specific language type (for example similarity with respect to “litigious” language or “uncertainty” language)

The analysis is available for the whole report and for specific sections of the report (e.g. Risk Factors and MD&A).

For more information, refer to Brain's summary paper.

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the Brain Language Metrics on Company Filings dataset, including CLI commands and pricing, see the dataset listing.

About the Provider

Brain is a Research Company that creates proprietary datasets and algorithms for investment strategies, combining experience in financial markets with strong competencies in Statistics, Machine Learning, and Natural Language Processing. The founders share a common academic background of research in Physics as well as extensive experience in Financial markets.

Getting Started

The following snippet demonstrates how to request data from the Brain Language Metrics on Company Filings dataset:

self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
self.dataset_10k_symbol = self.AddData(BrainCompanyFilingLanguageMetrics10K , self.symbol).Symbol
self.dataset_all_symbol = self.AddData(BrainCompanyFilingLanguageMetricsAll, self.symbol).Symbol

self.AddUniverse(BrainCompanyFilingLanguageMetricsUniverse10K, "BrainCompanyFilingLanguageMetricsUniverse10K", Resolution.Daily, self.UniverseSelection)
self.AddUniverse(BrainCompanyFilingLanguageMetricsUniverseAll, "BrainCompanyFilingLanguageMetricsUniverseAll", Resolution.Daily, self.UniverseSelection)
_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_dataset10KSymbol = AddData<BrainCompanyFilingLanguageMetrics10K>(_symbol).Symbol;
_datasetAllSymbol = AddData<BrainCompanyFilingLanguageMetricsAll>(_symbol).Symbol;

AddUniverse<BrainCompanyFilingLanguageMetricsUniverse10K>("BrainCompanyFilingLanguageMetricsUniverse10K", Resolution.Daily, UniverseSelection);
AddUniverse<BrainCompanyFilingLanguageMetricsUniverseAll>("BrainCompanyFilingLanguageMetricsUniverseAll", Resolution.Daily, UniverseSelection);

Data Summary

The following table describes the dataset properties:

PropertyValue
Start DateJanuary 2010
Asset Coverage5,000 US Equities
Data DensitySparse
ResolutionDaily
TimezoneUTC

Data Point Attributes

The Brain Language Metrics on Company Filings dataset provides BrainCompanyFilingLanguageMetrics and BrainCompanyFilingLanguageMetricsUniverse objects.

BrainCompanyFilingLanguageMetrics Attributes

BrainCompanyFilingLanguageMetrics objects have the following attributes:

BrainCompanyFilingLanguageMetricsUniverse Attributes

BrainCompanyFilingLanguageMetricsUniverse objects have the following attributes:

Requesting Data

To add Brain Language Metrics on Company Filings data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class BrainCompanyFilingNLPDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2010, 1, 1)
        self.SetEndDate(2021, 7, 8)
        self.SetCash(100000) 
        
        self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
        self.dataset_10k_symbol = self.AddData(BrainCompanyFilingLanguageMetrics10K, self.symbol).Symbol
        self.dataset_all_symbol = self.AddData(BrainCompanyFilingLanguageMetricsAll, self.symbol).Symbol
namespace QuantConnect
{
    public class BrainCompanyFilingNLPDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol, _dataset10KSymbol, _datasetAllSymbol;
    	
        public override void Initialize()
        {
            SetStartDate(2010, 1, 1);
            SetEndDate(2021, 7, 8);
            SetCash(100000);
            
            _symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
            _dataset10KSymbol= AddData<BrainCompanyFilingLanguageMetrics10K>(_symbol).Symbol;
            _datasetAllSymbol= AddData<BrainCompanyFilingLanguageMetricsAll>(_symbol).Symbol;
        }
    }
}

Accessing Data

To get the current Brain Language Metrics on Company 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.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_10k_symbol):
        data_point = slice[self.dataset_10k_symbol]
        self.Log(f"{self.dataset_10k_symbol} report sentiment at {slice.Time}: {data_point.ReportSentiment.Sentiment}")

    if slice.ContainsKey(self.dataset_all_symbol):
        data_point = slice[self.dataset_all_symbol]
        self.Log(f"{self.dataset_all_symbol} report sentiment at {slice.Time}: {data_point.ReportSentiment.Sentiment}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_dataset10KSymbol))
    {
        var dataPoint = slice[_dataset10KSymbol];
        Log($"{_dataset10KSymbol} report sentiment at {slice.Time}: {dataPoint.ReportSentiment.Sentiment}");
    }

    if (slice.ContainsKey(_datasetAllSymbol))
    {
        var dataPoint = slice[_datasetAllSymbol];
        Log($"{_datasetAllSymbol} report sentiment at {slice.Time}: {dataPoint.ReportSentiment.Sentiment}");
    }
}

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

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_point in slice.Get(BrainCompanyFilingLanguageMetrics10K).items():
        self.Log(f"{dataset_symbol} report sentiment at {slice.Time}: {data_point.ReportSentiment.Sentiment}")

    for dataset_symbol, data_point in slice.Get(BrainCompanyFilingLanguageMetricsAll).items():
        self.Log(f"{dataset_symbol} report sentiment at {slice.Time}: {data_point.ReportSentiment.Sentiment}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<BrainCompanyFilingLanguageMetrics10K>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} report sentiment at {slice.Time}: {dataPoint.ReportSentiment.Sentiment}");
    }

    foreach (var kvp in slice.Get<BrainCompanyFilingLanguageMetricsAll>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} report sentiment at {slice.Time}: {dataPoint.ReportSentiment.Sentiment}");
    }
}

Historical Data

To get historical Brain Language Metrics on Company 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.

# DataFrames
ten_k_history_df = self.History(self.dataset_10k_symbol, 100, Resolution.Daily)
all_history_df = self.History(self.dataset_all_symbol, 100, Resolution.Daily)
history_df = self.History([self.dataset_10k_symbol, self.dataset_all_symbol], 100, Resolution.Daily)

# Dataset objects
ten_k_history_bars = self.History[BrainCompanyFilingLanguageMetrics10K](self.dataset_10k_symbol, 100, Resolution.Daily)
all_history_bars = self.History[BrainCompanyFilingLanguageMetricsAll](self.dataset_all_symbol, 100, Resolution.Daily)
// Dataset objects
var tenKHistory = History<BrainCompanyFilingLanguageMetrics10K>(_dataset10KSymbol, 100, Resolution.Daily);
var allHistory = History<BrainCompanyFilingLanguageMetricsAll>(_datasetAllSymbol, 100, Resolution.Daily);

// Slice objects
var history = History(new[] {_dataset10KSymbol, _datasetAllSymbol}, 100, Resolution.Daily);

For more information about historical data, see History Requests.

Universe Selection

To select a dynamic universe of US Equities based on Brain Language Metrics on Company Filings data, call the AddUniverse method with the BrainCompanyFilingLanguageMetricsUniverseAll class or the BrainCompanyFilingLanguageMetricsUniverse10K class and a selection function.

def Initialize(self) -> None:
    self.AddUniverse(BrainCompanyFilingLanguageMetricsUniverseAll, "BrainCompanyFilingLanguageMetricsUniverseAll", Resolution.Daily, self.UniverseSelection)

def UniverseSelection(self, alt_coarse: List[BrainCompanyFilingLanguageMetricsUniverseAll]) -> List[Symbol]:
    return [d.Symbol for d in alt_coarse \
                if d.ReportSentiment.Sentiment > 0 \
                and d.ManagementDiscussionAnalyasisOfFinancialConditionAndResultsOfOperations.Sentiment > 0]
AddUniverse<BrainCompanyFilingLanguageMetricsUniverseAll>("BrainCompanyFilingLanguageMetricsUniverseAll", Resolution.Daily, altCoarse =>
{
    return from d in altCoarse 
        where d.ReportSentiment.Sentiment > 0m && d.ManagementDiscussionAnalyasisOfFinancialConditionAndResultsOfOperations.Sentiment > 0m
        select d.Symbol;
});

For more information about dynamic universes, see Universes.

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_10k_symbol)
self.RemoveSecurity(self.dataset_all_symbol)
RemoveSecurity(_dataset10KSymbol);
RemoveSecurity(_datasetAllSymbol);

If you subscribe to Brain Language Metrics on Company 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 Brain Language Metrics on Company Filings dataset enables you to test strategies using language metrics and their differences gathered from 10K and 10Q reports. Examples include the following strategies:

Disclaimer: The dataset is provided by the data provider for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor do they constitute an offer to provide investment advisory or other services by the data provider.

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: