BDC: `PortfolioInvestments.from_xbrl` with no period picks an instant after the report date (TCPC Q1 2026: 10 of 331 rows)
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.62.0, and main at 8cd5799f
Python Version: 3.12.13
Operating System: Windows 11
Bug Description
What you expected to happen:
With no period, from_xbrl reads the schedule of investments at the filing's own report date, 2026-03-31 for this 10-Q: 331 rows, $1,400,458,176, against a reported_total_fair_value of $1,388,668,517.
What actually happened:
It chose 2026-12-31 and returned 10 rows summing to $140,396,441, about a tenth of the book, with reported_total_fair_value None and no warning. The default takes max() over every instant that carries an investment-axis fair value (edgar/bdc/investments.py, period = max(periods) in from_xbrl). This filing tags its controlled-affiliates roll-forward on the fiscal-year context, so the latest instant is nine months past the report date.
Error message (if any):
None.
Reproduction
Company/Ticker: TCPC (BlackRock TCP Capital Corp., CIK 1370755) Time Period: quarter ended 2026-03-31 Relevant Forms: 10-Q, accession 0001193125-26-210632
Minimal code to reproduce:
from edgar import set_identity, find
from edgar.bdc.investments import PortfolioInvestments
set_identity("Your Name [email protected]")
filing = find("0001193125-26-210632")
xbrl = filing.xbrl()
auto = PortfolioInvestments.from_xbrl(xbrl)
print(auto.period, len(auto), sum(i.fair_value or 0 for i in auto), auto.reported_total_fair_value)
# 2026-12-31 10 140396441.0 None
dated = PortfolioInvestments.from_xbrl(xbrl, period=str(filing.period_of_report))
print(len(dated), sum(i.fair_value or 0 for i in dated), dated.reported_total_fair_value)
# 331 1400458176.0 1388668517.0
Additional Context
A proposed default: the filing's dei:DocumentPeriodEndDate when it is among the candidate instants, and the newest instant only when it is not. Over the 24 BDC filers I read, the newest instant equals the report date on 23, so this changes only filings like TCPC's. Happy to send a PR with a TCPC regression test.
Generated by Claude Code