Skip to content

Expose filing language metric similarity in universe selection - #31

Merged
jaredbroad merged 1 commit into
QuantConnect:masterfrom
Ruuudy1:expose-language-metrics-similarity-in-universe
Jun 24, 2026
Merged

Expose filing language metric similarity in universe selection#31
jaredbroad merged 1 commit into
QuantConnect:masterfrom
Ruuudy1:expose-language-metrics-similarity-in-universe

Conversation

@Ruuudy1

@Ruuudy1 Ruuudy1 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Description

Expose the filing language metric similarity values (Similarity.All and the related fields) in BrainCompanyFilingLanguageMetrics universe selection (BrainCompanyFilingLanguageMetricsUniverseAll and Universe10K). They were already available point in time via add_data but were missing from universe selection.

Related Issue

Resolves #32

Motivation and Context

BrainCompanyFilingLanguageMetrics.Parse only attaches Similarity when given its second argument. On the universe path the similarity columns were never written to the universe file (universe.py kept only datum[3:36]) and the universe Reader used the metrics only Parse overload, so Similarity was always null. The fix writes the trailing similarity columns and parses them in the universe Reader with the same offsets as BrainCompanyFilingLanguageMetricsBase.Reader (Skip(39).Take(7), Skip(46).Take(3), Skip(49)), bringing universe selection in line with the point in time type. The universe file schema gains columns, so deployed universe data needs reprocessing.

Requires Documentation Change

N/A

How Has This Been Tested?

dotnet test passes (24 of 24). Verified that the universe column offsets line up with the point in time reader, so SIMILARITY_ALL maps to Similarity.All for the report, risk factor, and management discussion sections.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Refactor (non-breaking change which improves implementation)
  • Performance (non-breaking change which improves performance. Please add associated performance test and results)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Non-functional change (xml comments/documentation/etc)

Checklist:

  • My code follows the code style of this project.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My branch follows the naming convention bug-<issue#>-<description> or feature-<issue#>-<description>

The point-in-time BrainCompanyFilingLanguageMetrics readers populate the
ReportSentiment / RiskFactorsStatementSentiment / ManagementDiscussion...
Similarity values via the two-argument BrainCompanyFilingLanguageMetrics.Parse,
but the universe selection path did not:

- universe.py wrote only the 33 sentiment metrics (datum[3:36]) to the
  universe file, dropping the trailing similarity-difference columns.
- BrainCompanyFilingLanguageMetricsUniverse.Reader called the metrics-only
  Parse overload, so .Similarity stayed null.

As a result BrainCompanyFilingLanguageMetricsUniverseAll/10K never exposed
similarity.all (or the other similarity fields), even though the point-in-time
data type did via add_data.

Fix:
- universe.py: write datum[3:53] so the universe file carries the same
  trailing report/RF/MD similarity columns as the point-in-time file.
- BrainCompanyFilingLanguageMetricsUniverse.Reader: pass the similarity
  columns to Parse using the same offsets as BrainCompanyFilingLanguageMetricsBase.Reader
  (Skip(39).Take(7), Skip(46).Take(3), Skip(49)).

Existing metric offsets and Value/Symbol parsing are unchanged. The generic
base reader is shared by both the "all" and "10k" universes, so both are fixed.
@jaredbroad
jaredbroad merged commit ac16133 into QuantConnect:master Jun 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BrainCompanyFilingLanguageMetrics universe selection does not expose Similarity values

2 participants