How to Fetch and Parse 13F Reports

This article outlines the steps performed by formthirteen.com when fetching and parsing 13F reports.

If you have any questions regarding this process or want to share your tips and tricks you can contact us at [email protected].

Step One: Find the CIK Number

The SEC (United States Securities and Exchange Commission) requires all institutional investors to file a quarterly 13F report when their ownership of securities on the official list of 13F securities exceeds 100 million USD.

Each company is assigned a CIK number that is associated with each report filed by the company. To find a company's CIK number (Central Index Key), we use the CIK Lookup tool provided by the SEC. For example, by searching for Punch Card Capital we can find that the company's CIK number is 0001631664.

Step Two: Fetch the 13F Reports

Next, we use the CIK number to look up all reports that have been filed by Punch Card Capital. We perform the search by opening the Fast Search page in our browser. Type in the CIK number, for example, 0001631664 and click Search.

The search results include reports that we are not interested in. To get a list of just the 13F reports, specify 13F-HR in the Report Type field and click the Search button again. The search results now list all 13F reports that Punch Card Capital has reported to the SEC.

To make it easier to fetch the reports we can to output the search results in XML format. This format can be parsed programmatically. Click on the RSS Feed link to get the list of 13F reports as an XML document.

Next, we need to find the ID and URL of each 13F report. These are enclosed by an XML element named entry:

<entry>
    <accession-number>0001398344-14-005931</accession-number>
    <filing-href>http://www.sec.gov/Archives/edgar/data/1419050/000139834414005931/0001398344-14-005931-index.htm</filing-href>
</entry>

In this example, the 13F report's accession number is 0001398344-14-005931. This number is the unique identifier for Punch Card Capital's 13F report for the third quarter of 2014. The contents of the 13F report can be viewed by accessing the URL listed in the "filing-href" element:

In the next steps, we will explain how we download and parse these two documents.

Step Three: Download XML Data

An XML version of the 13F report, containing both the primary document and the information table, can be found by modifying the URL we found in step two of this guide.

Before modification, the URL looks like this: http://www.sec.gov/Archives/edgar/data/1419050/000139834414005931/0001398344-14-005931-index.htm

The URL of the XML version uses the same format. We only need to replace "-index.htm" with ".txt": http://www.sec.gov/Archives/edgar/data/1419050/000139834414005931/0001398344-14-005931.txt

After downloading the document we can proceed with extracting information from it, in other words, parsing the document.

Step Four: Parse the 13F Report

The downloaded file contains the whole 13F report and three top-level elements that we need to extract and parse separately:

  • Header
  • Primary document
  • Information table

The 13F Header

The header contains information about when the report was filed and who filed the report. The content is not valid XML. However, we can parse and extract information by using regular expressions.

<SEC-HEADER>0001398344-14-005931.hdr.sgml : 20141114
  <ACCEPTANCE-DATETIME>20141114160526
  ACCESSION NUMBER:     0001398344-14-005931
  CONFORMED SUBMISSION TYPE:    13F-HR
  PUBLIC DOCUMENT COUNT:        2
  CONFORMED PERIOD OF REPORT:   20140930
  FILED AS OF DATE:     20141114
  DATE AS OF CHANGE:        20141114
  EFFECTIVENESS DATE:       20141114
  ...
</SEC-HEADER>

The 13F Primary Document

The primary document enclosed by the edgarSubmission element contains basic information about the report, including which quarter it was filed and information about whether this is a new report or an amendment to a previously filed 13F report.

<reportCalendarOrQuarter>06-30-2015</reportCalendarOrQuarter>
<isAmendment>true</isAmendment>
<amendmentNo>1</amendmentNo>
<amendmentInfo>
  <amendmentType>NEW HOLDINGS</amendmentType>
</amendmentInfo>

An amendment type of NEW HOLDINGS means the holdings are added to the holdings reported in the 13F report that was reported before this one.

An amendment type of RESTATEMENT means all the previously reported holdings for this quarter are invalid and this report contains the restated holdings.

The 13F Information Table

We can find the holdings by searching for all elements named infoTable. These are enclosed by the informationTable element:

<informationTable...>
  <infoTable>
    <nameOfIssuer>BERKSHIRE HATHAWAY INC DEL</nameOfIssuer>
    <titleOfClass>CL A</titleOfClass>
    <cusip>084670108</cusip>
    <value>77174</value>
    <shrsOrPrnAmt>
      <sshPrnamt>373</sshPrnamt>
      <sshPrnamtType>SH</sshPrnamtType>
    </shrsOrPrnAmt>
    <investmentDiscretion>SOLE</investmentDiscretion>
    <votingAuthority>
      <Sole>373</Sole>
      <Shared>0</Shared>
      <None>0</None>
    </votingAuthority>
  </infoTable>
  <infoTable>
    <nameOfIssuer>WELLS FARGO &amp; CO NEW</nameOfIssuer>
    <titleOfClass>*W EXP 10/28/201</titleOfClass>
    <cusip>949746119</cusip>
    <value>29409</value>
    <shrsOrPrnAmt>
      <sshPrnamt>1459516</sshPrnamt>
      <sshPrnamtType>SH</sshPrnamtType>
    </shrsOrPrnAmt>
    <investmentDiscretion>SOLE</investmentDiscretion>
    <votingAuthority>
      <Sole>1459516</Sole>
      <Shared>0</Shared>
      <None>0</None>
    </votingAuthority>
  </infoTable>
</informationTable>

Each infoTable element consists of the following subelements of which some are optional:

XML element Description
nameOfIssuer Name of security
titleOfClass Type of security, e.g., class A shares
cusip The security's CUSIP number
value The market value of the holding in thousands
sshPrnamt Total number of shares of the specified security
sshPrnamtType SH = shares, PRN = principal amount
investmentDiscretion SOLE, DFND (shared defined), or OTR (shared other)
putCall Empty, PUT, or CALL
otherManager Other managers on whose behalf these holdings are being reported
votingAuthority Number of shares for which the manager exercises shared, sole, or no voting authority

Summary

In summary, these are the steps we follow here at [email protected] to download and parse 13F reports:

  • Step one: Find the company's CIK number
  • Step two: Fetch a list of the company's 13F reports
  • Step three: Download an XML version of the 13F report
  • Step four: Parse the 13F reports

Send us an email at [email protected] if you have any questions or want to discuss how to download and parse 13F reports

In the next article, How to Analyze 13F Reports, we outline the steps we follow when analyzing a 13F report.