1

I am trying to programmatically parse through XBRl files and retrieve certain facts such as this year's revenue or asset accounts. I'm running into trouble when trying to have my program determine which context is associated with current year permanent accounts (balance sheet accounts). The issue is that these contexts are defined in the XBRL instance file not in a schema. For example, the context I'm looking for in JP Morgan's most recent filing is:

<xbrli:context id="FI2017Q4">
        <xbrli:entity>
            <xbrli:identifier scheme="http://www.sec.gov/CIK">0000019617</xbrli:identifier>
        </xbrli:entity>
        <xbrli:period>
            <xbrli:instant>2017-12-31</xbrli:instant>
        </xbrli:period>
    </xbrli:context>

I can tell this is the context I'm looking for by intrepreting the ID and looking throughout the rest of the document and seeing which facts refer to it but it is impractical to have my program do that.

Mbando
  • 19
  • 4
  • This is not easy to do it by hand. I recommend using an XBRL processor, as well as looking at a generic how-to-find-specific-values at https://stackoverflow.com/questions/44356106/get-specific-value-from-xbrl-document – Ghislain Fourny Apr 28 '20 at 09:27

1 Answers1

0

It looks like you're working with SEC filings, in which case you can determine the reporting period from certain required concepts. An SEC filing will contain a single occurrence of dei:DocumentType and dei:DocumentPeriodEndDate. The context with which these are associated will give you the current reporting period for the report.

See sections 6.5.19 and 6.5.20 of the Edgar Filing Manual for more information.

You can then look for facts with the concepts that you're interested in, reported with the same start and end dates. Note that the facts will not necessarily have exactly the same context; some reports will include a breakdown of a fact, but not the total. This will be indicated using dimensions in the context. For example, if you look at the consolidated balance sheet in this 10-K, you'll see that the total value for Cash and Cash Equivalents is not reported on the consolidated balance sheet.

I would strongly recommend using an existing XBRL Processor to assist with this.

pdw
  • 884
  • 4
  • 5