edgartools icon indicating copy to clipboard operation
edgartools copied to clipboard

BDC: a position whose identifier ends in its coupon ("(14.00%)") is typed Unknown and dropped by `PortfolioInvestments.from_xbrl`

Open mmitc opened this issue 1 month ago • 1 comments

Issue Type

  • [x] Data Quality Issue (incorrect financial values, missing data)
  • [ ] XBRL Parsing Issue (statement rendering, concept mapping)
  • [ ] Filing Access Issue (download failures, attachment problems)
  • [ ] Performance Issue (slow operations, memory problems)
  • [ ] Compatibility Issue (platform/dependency conflicts)
  • [ ] Documentation Issue (unclear instructions, missing examples)

Environment

EdgarTools Version: 5.61.1 (the same rule is in 5.60.0) Python Version: 3.14.3 Operating System: Windows 11 Pro 10.0.26300 (live check); reproduced offline on Linux, Python 3.13

Bug Description

What you expected to happen: from_xbrl returns every position the schedule prices, including PhenixFIN's delayed-draw loan ... Senior Secured Delayed Draw Term Loan (14.00%) (fair value $221,625, cost $225,132, principal $225,000).

What actually happened: With default arguments, the position is missing: 67 rows. With include_untyped=True it appears as a 68th row, typed Unknown.

parse_investment_identifier returns Unknown for any identifier matching \(\d+\.\d+%\)\s*$ (edgar/bdc/investments.py, around line 1164). That rule fits category roll-ups such as Hercules' Debt Investments Software (52.80%). PhenixFIN, however, ends a real loan's identifier with its coupon. Because from_xbrl drops Unknown rows by default, the loan leaves the portfolio and its totals with no warning. It is the filing's only identifier ending in a bracketed percent.

Error message (if any):

None. The row is dropped without a warning.

Reproduction

Company/Ticker: PFX (PhenixFIN Corp) Time Period: quarter ended 2026-06-30 Relevant Forms: 10-Q, accession 0001213900-26-085667

Minimal code to reproduce:

from edgar import set_identity, find
from edgar.bdc.investments import PortfolioInvestments, parse_investment_identifier

set_identity("Your Name [email protected]")
xbrl = find("0001213900-26-085667").xbrl()

default = PortfolioInvestments.from_xbrl(xbrl)
untyped = PortfolioInvestments.from_xbrl(xbrl, include_untyped=True)
print(len(default), len(untyped))   # 67 68
extra = [i for i in untyped if i.identifier.endswith("(14.00%)")]
print([(i.investment_type, i.fair_value, i.cost) for i in extra])
# [('Unknown', 221625, 225132)]

# The parser alone, offline:
print(parse_investment_identifier(
    "Advocates for Disabled Vets, LLC (dba Reps for Vets) - Senior Secured Delayed Draw Term Loan (14.00%)"
).investment_type)   # Unknown  (the same text without "(14.00%)" gives Unclassified)

Additional Context

A bracketed percent can't tell a roll-up from a coupon on its own. Two other signals could:

  • whether the text before the percent names a company or an instrument;
  • whether the fact carries position-level concepts (cost, principal, interest rate).

Hercules' roll-ups state fair value and percent of net assets, while PhenixFIN's row states cost and principal. A position kept this way would also want the coupon stripped from company_name. We're happy to send a PR with a regression test if that direction suits.


Generated by Claude Code

mmitc avatar Oct 11 '26 11:10 mmitc

Thanks, confirmed on main. The PhenixFIN loan drops out (67 rows vs 68), and once the (14.00%) is stripped, the existing parser types it as Senior Secured Delayed Draw Term Loan with the company name intact.

A PR would be welcome. Two notes on direction:

  • percent_of_net_assets won't separate the two cases, because this row carries one too (0.0014). Cost or principal works. So does stripping the suffix, re-parsing, and keeping Unknown only when nothing instrument-like remains.
  • No test currently pins the roll-up behaviour, so please cover both directions: the coupon-suffixed position is kept and typed, and a roll-up like Debt Investments Software (52.80%) stays excluded.

Please add a changelog.d/1504.fixed.md fragment and write Fixes #1504 in the PR body. Today is the 5.x freeze, so this will ship in 6.0.0.

dgunning avatar Oct 11 '26 12:10 dgunning