edgartools icon indicating copy to clipboard operation
edgartools copied to clipboard

[DATA] PortfolioInvestment.company_name returns the instrument (First Lien, Ordinary Shares) when the filer tags the company as a member (PSEC, CSWC, TPVG, BBDC)

Open mmitc opened this issue 2 months ago • 0 comments

Data Quality Issue Details

Issue Type:

  • [x] Incorrect financial values (wrong numbers)
  • [ ] Missing financial data (expected data not present)
  • [ ] Calculation errors (formulas producing wrong results)
  • [x] Data inconsistency (different values for same metric)
  • [ ] Historical data problems (changes over time)

Environment

EdgarTools Version: 5.59.1 Python Version: 3.14.3 Operating System: Windows 11

Financial Data Details

Company/Ticker:

  • PSEC (Prospect Capital Corp, 10-K 0001287032-26-000269)
  • CSWC (Capital Southwest Corp, 10-Q 0000017313-26-000095)
  • TPVG (TriplePoint Venture Growth BDC, 10-Q 0001580345-26-000025)
  • BBDC (Barings BDC, 10-Q 0001379785-26-000030)

Statement Type: Schedule of Investments (PortfolioInvestments.from_xbrl)

Specific Metric/Concept:

  • Financial line item: PortfolioInvestment.company_name, and parse_investment_identifier(..., member_candidates=...)
  • XBRL concept name: us-gaap:InvestmentIdentifierAxis members

Data Issue

Some identifiers lead with the company: <Company> | <Industry> | <Instrument>, or <Company> | <Instrument>. When the filer also tags that company as a member, it lands in the candidate set, and the parser drops the company and returns the instrument. With no candidates, the same call returns the company. One candidate is enough: the company's own label.

identifier (verbatim) no candidates candidates = the company's own label
First Tower Finance Company LLC | Consumer Finance | First Lien Term Loan to First Tower, LLC First Tower Finance Company LLC First Lien
CLUTCH, INC. | First Lien - Term Loan B CLUTCH, INC. First Lien
Revolut Ltd | Ordinary Shares | Equity Investments Revolut Ltd Ordinary Shares
Jocassee Partners LLC | 9.1% Member Interest Jocassee Partners LLC 9.1%

from_xbrl builds its candidates from the same catalog, so company_name carries the instrument too. A position was counted wrong when its company_name is not the company its identifier names; each row was read by hand:

  • PSEC: 187 of 300 positions
  • TPVG: 113 of 310
  • CSWC: 155 of 579

Code to reproduce (offline, no network):

from decimal import Decimal
from types import SimpleNamespace
from edgar.bdc.investments import PortfolioInvestments, parse_investment_identifier

IDENTIFIER = ("First Tower Finance Company LLC | Consumer Finance | "
              "First Lien Term Loan to First Tower, LLC")

def member(label):
    return SimpleNamespace(labels={"http://www.xbrl.org/2003/role/label": f"{label} [Member]"})

fact = {"concept": "us-gaap:InvestmentOwnedAtFairValue", "value": Decimal("466000000"),
        "numeric_value": 466000000.0, "period_instant": "2026-06-30",
        "period_type": "instant", "unit_ref": "usd",
        "dim_us-gaap_InvestmentIdentifierAxis": IDENTIFIER}
# The filer tags the company and the industry as members, as PSEC's element catalog does.
for catalog in ({}, {"psec_FirstTowerFinanceCompanyLLCMember": member("First Tower Finance Company LLC"),
                     "psec_ConsumerFinanceMember": member("Consumer Finance")}):
    xbrl = SimpleNamespace(facts=SimpleNamespace(get_facts=lambda: [fact]), element_catalog=catalog)
    print("members tagged:", bool(catalog), "->", repr(PortfolioInvestments.from_xbrl(xbrl)[0].company_name))

print("parse, no candidates   ->", repr(parse_investment_identifier(IDENTIFIER).company_name))
print("parse, with candidates ->", repr(parse_investment_identifier(
    IDENTIFIER, member_candidates=("first tower finance company llc", "consumer finance")).company_name))

Output at 5.59.1:

members tagged: False -> 'First Tower Finance Company LLC'
members tagged: True -> 'First Lien'
parse, no candidates   -> 'First Tower Finance Company LLC'
parse, with candidates -> 'First Lien'

Cause (read from 5.59.1's source). _match_company_candidate's prefix loop (edgar/bdc/investments.py:683, prefixes = [candidate for candidate in member_candidates if normalized_cleaned.startswith(f'{candidate} ') ...]) treats any candidate at the front of the window as a strippable category prefix. Here that candidate is the company itself. The loop strips it, then strips the industry, and returns what is left before the instrument-type cut. That residue is First Lien, Ordinary Shares or 9.1%, and it is never a candidate itself.

A workaround measured on real filings. Parse twice, once with candidates and once without. Keep the no-candidate name only when (a) its normalised form is in the candidate set, (b) the with-candidate name's is not, and (c) it contains no INVESTMENT_TYPES phrase as a whole-token run. Check (c) is needed because a category can also be a member: SLRC tags Senior Secured Loans and Common Equity/Equity Interests/Warrants.

Over 51 BDC filings at 5.59.1, 25,894 positions, this moves 401 names, and every one goes from an instrument to the company:

  • CSWC 155
  • PSEC 142
  • TPVG 58
  • ARCC 24 (Class C to RD Holdco Inc.)
  • BBDC 14
  • OCSL 4
  • NMFC 3
  • OTF 1

The other 42 filings are unchanged. A fix inside the prefix loop may be simpler: a candidate that spans the whole first delimited segment is the company, not a prefix. That version has not been measured.

Related: #1324 (the High range member, fixed in 5.59.0) was also a member label leaking into the name. #1372 covers category-led identifiers (CGBD, SLRC, PFX), where no candidate set gives the company.

mmitc avatar Sep 27 '26 18:09 mmitc