Skip to content

Some tools for parsing Form 13F filings with the SEC

Notifications You must be signed in to change notification settings

Hodapp87/parse_13F

Repository files navigation

parse_13F

Some tools for parsing Form 13F filings with the SEC

R code

Thus far, this is just a small R module that I wrote to parse 13F filings. These are available as XML files from EDGAR. For instance, if you want to ride Seth Klarmann's coattails, those from Baupost (CIK 0001061768) can be found here, with the latest form13fInfoTable.xml.

The R script parse_13f.R handles XML tables like the above.

example.R uses it to parse Baupost's 2017 Q1 filings (also here), dump the raw data to a CSV (see here), perform some conversions with dplyr, order by percentage relative to the whole portfolio, and then output a CSV file containing this new dataframe (see here).

example2.R parses adjacent quarterly filings and determines the likely portfolio changes between those two quarters.

example3.R is basically a copy of example.R which parses a CSV exported from Fidelity (not included), and compares this portfolio to the 13F's contents (and determines the changes made to match the same ratios).

Python code

The Python code is just a single source file at the moment, and mostly scratch work. It depends on Pandas, and uses this and some built-in libraries to parse the XML and turn it to Pandas tables.

To-do items

  • It might be nice to turn the CUSIP into a ticker symbol in order to link the tables against other data sources - for instance, the present price. The FinancialInstrument library looks like it at least knows how to query online APIs for related information, but I wasn't able to get anywhere.
  • I'd like to use the proper namespaces when finding nodes in the XML with XPath rather than just telling it to ignore them, but I have no idea what the namespaces are.

Disclaimer

I'm not affiliated with Baupost, nor with any other party mentioned here, nor should anything I wrote above be taken as investment or financial advice, nor do I warrant that the code does anything it claims to. I am not your lawyer. I am not your financial advisor. I am not responsible for what you do with money.

About

Some tools for parsing Form 13F filings with the SEC

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published