Skip to content

Navigation Menu

Sign in
Sign up

ParsingXBRL

Dwight Gunning edited this page Aug 12, 2024 · 4 revisions

Extracting XBRL Data

Some SEC filings include data in XBRL (eXtensible Business Reporting Language) format. Edgartools provides ways to extract and use this data.

Inline vs Attached XBRL

XBRL can either be embedded in the filing or provided as attachments to the filing. This guide focuses on extracting XBRL from filing attachments.

Inline XBRL is also being parsed using HTMLDocument.from_html(html) and the data is available but for now this parser is not completely developed.

Listing XBRL filings

To list all filings that include XBRL use index="xbrl" in the get_filings function.

List XBRL filings

filings = get_filings(index="xbrl")

XBRL Attachments

Some forms like 424B2 offerings have only the XBRL instance document as an attachment. For these filings the XBRL parser will extract only an XBRLInstance class containing the data from the instance document.

XBRLDocuments(filings[0].attachments)

XBRLInstance Attachment

Other forms like 10-K have multiple XBRL attachments. These will be parsed into an XBRLData class containing the XBRLInstance but also include information about the labels, the presentation, the calculations and other details that allow for precise analysis of the XBRL data.

XBRLDocuments(filings[2].attachments)

List XBRL Attachments

Using the XBRL Parser

The XBRL parser is integrated within edgartools so it is as simple as calling filing.xbrl()

  • If there is no attached XBRL this will return None.
  • If there is only the XBRL instance document this will return an XBRLInstance object.
  • If there are multiple XBRL attachments this will return an XBRLData object.

XBRLInstance

The XBRLInstance object contains the data extracted from the XBRL instance document in a dataframe facts. For example, see the XBRL Instance for a 424B4. This has 8 facts in the dataframe.

Instance Facts Dataframe

You can query the underlying facts using pandas syntax

instance.facts.query("concept=='ffd:FormTp'")

Alternatively you can use the convenience function

instance.query_facts(concept='ffd:FormTp')

This is useful if the facts have dimensions, which simple XBRL do not. We will look at dimensioned facts later.

XBRLData

XBRLData is the container for all the XBRL data extracted from the filing. It contains the XBRLInstance as well as the labels, presentation, calculations and other data that is extracted from the filing. Importantly, it contains all the Statement's extracted from the filing. These are shown when displaying the XBRLData object.

filing = filings[2]
xbrl_data = filing.xbrl()

XBRL Data

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /