XBRL Zoo: Anaconda + Arelle + Pandas + Python

  • Anaconda is called a “completely free Python distribution… It includes over 195 … packages for science, math, engineering, data analysis.” Anaconda lets us make rapid and visual financial-prototypes. You write code, execute it, see and share results all in the same place.
  • Arelle is called a “a project to provide the XBRL community with an easy to use open source platform for XBRL. “ Arelle makes XBRL easy to handle.
  • Pandas is called a “an open source, BSD-licensed library providing high-performance, easy-to-use data structures and data analysis tools”. Pandas lets us manipulate data like Excel wizards.
  • Python is an open-source and free programming language, called ” easy to pick up whether you’re a first time programmer or you’re experienced with other languages.” All of the above are built on Python.

Together these animals will make XBRL easy, visual and fun.

Watch how I go from 4+ quarters of SEC XBRL filing…

to a printed line-chart in 5 lines of code.

And then I do it for more companies in just another few lines.

If you don’t know much about Python, I recommend checking out the Python webpage, Udacity, and Googling for other resources.

Prepare:

  1. Install Anaconda from Anaconda’s site. This will include Python. I recommend Python 3 installers (for Windows, Mac, or Linux); the latest version of Arelle uses Python 3.
  2. Install Pandas from Pandas’ site.  (Or try the two commands in sub-bullets inside the Anaconda3 prompt) Wes McKinney, (quant & creator or Pandas), gives a great introduction here. Daniel bought me his book; it’s good.
    • conda install pandas
    • pip install pandas
  3. Install lxml (Arelle depends on it) Will need an executable if on Windows.
  4. (Optional) Install Git; you can use in the next step
  5. Install Arelle from Arelle’s site.  Specifically clone its code from Github (using Git; or else just visit that link and download a zip) . Place/clone these files into your {Anaconda3 directory}/lib/{here}

Steps:

  1. Open the filing
  2. Create a table
    1. Columns are:
      1. Value
      2. Account
      3. Category
      4. Time
  3. Filter the table
    1. Filters include:
      1. Numeric Value
      2. Cash Accounts
      3. No Category
      4. (Sort) In chronological order
  4. Plot it

And you’re done.

The lovely thing about Anaconda’s use of IPython is that I can just share these file with you.

UPDATE

Now using an Nick Kraakman’s iEdgar Beta API (works pretty great!) I can retrieve filings for a given ticker automatically. Before that, I manually searched and copy-pasted links from the SEC’s website.

And I can also ‘execute’ Markup (like HTML) so I did my best to document my code throughout

I will enhance this blog post with some screenshots and maybe a video.

Advertisements
Tagged , , , , ,

3 thoughts on “XBRL Zoo: Anaconda + Arelle + Pandas + Python

  1. Paul Sutherland says:

    Would love the screenshots/video if you get a minute — Thanks for the post!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: