GithubHelp home page GithubHelp logo

jamiehannaford / statement-parser Goto Github PK

View Code? Open in Web Editor NEW
15.0 3.0 0.0 222 KB

Hidden cost extractor for SEC filings.

License: MIT License

Python 99.04% Makefile 0.62% Dockerfile 0.08% Shell 0.26%
finance xbrl xbrl-parser quantitative-finance python

statement-parser's Introduction

SEC statement parser

This tool allows you to extract all of the non-operating, hidden and non-recurrings costs in a 10-K filing to get a true picture of company's Core Earnings.

Very often companies will hide these expenses in operating line items and footnotes, which ends up distorting key metrics like Net Income. This tool searches through all areas of a 10-K filing, including the footnotes, and removes these costs. To do this, the program will download the filing directly from the SEC, parse its XBRL instance and schema files, and then output a categorised list of expenses that should be excluded from Core Earnings.

Why?

There are two main reasons why analysing Core Earnings is important.

  • Value investing. Core Earnings allow investors to ascertain the profitability of the underlying business, which is one of the key factors when deciding to invest in a given security.

  • Trading strategy. According to researchers from Harvard Business School, trading strategies that exploit non-core earnings produce abnormal returns of 8% per year.

Installation

You must first generate a free API key with financialmodelingprep.com and then run:

$ export FMP_API_KEY="$KEY"
$ git clone https://github.com/jamiehannaford/statement-parser
$ cd statement-parser
$ python setup.py install

Viewing expenses

To see a table-formatted list of expenses:

$ python ./parse.py -t TSLA -y 2020

As you can see, including depreciation and amortization, Tesla has around $3.7 billion in hidden expenses for 2020.

You can also generate JSON:

$ python ./parse.py -t GOOGL -y 2020 --json
{
   "expensesRestructuring":0,
   "expensesDepreciationAndAmortization":774000000.0,
   "expensesDiscontinuedOperations":0,
   "expensesWriteDown":0,
   "expensesNonRecurringOther":0,
   "expensesInterest":-1730000000.0,
   "expensesInterestMinority":0,
   "expensesLegalRegulatoryInsurance":0,
   "expensesNonOperatingCompanyDefinedOther":1038000000.0,
   "expensesAcquisitionMerger":0,
   "expensesDerivative":-144000000.0,
   "expensesForeignCurrency":344000000.0,
   "expensesNonOperatingOther":-5708000000.0,
   "expensesNonOperatingSubsidiaryUnconsolidated":0,
   "expensesOtherFinancing":0
}

Download filing and XBRL data

To download the last 10 filings of a company:

python ./download.py -t MSFT --last 10

You can also specify a date range with --from and --to.

Opening a filing on the SEC's website

To cross-reference this tool's results, you can view it on the SEC's website with iXBRL:

python ./open.py -t GOOGL -y 2020

Note: The year is when the statement was filed, not necessarily the filing period.

Testing the data

This tool's output was tested against IEX Cloud's Fundamentals data, which includes expenses that appear in the IS, BS or CF sections of a 10-K. Because this API does not include expenses hidden in footnotes and annotations, it will diverge at times from this tool's output. Where possible I've tried to manually verify the results, but could use a second pair of eyes if anybody would like to help verify.

To dos

  • Support 10-Q filings
  • Add test suite (both unit and integration tests) and hook up CI
  • Add more documentation
  • Refactor codebase (DRY up and improve performance)

statement-parser's People

Contributors

jamiehannaford avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.