Skip to content

An XBRL parser built in Rust that provides a fast, easy, and lightweight way to convert XBRL XML files into JSON or CSV.

Notifications You must be signed in to change notification settings

TiesdeKok/fast_xbrl_parser

Repository files navigation

Fast XBRL Parser
Fast XBRL Parser

⚠️Unfortunately, I am unable to maintain this repository in my new role. Issues are not monitored.

An XBRL parser built in Rust that provides a fast, easy, and lightweight way to convert XBRL XML files into JSON or CSV. Available as a Python library or a standalone command line utility.



Author: Ties de Kok (Personal Page)

Table of contents

Introduction

Design philosophy

The objective of fast-xbrl-parser is to provide a fast, easy, and lightweight way to parse XBRL XML files into JSON or CSV. It is built with the following objectives in mind:

  • An easy to use interface
  • Very fast
  • Lightweight and easy to install
  • Cross-platform support (Windows, Linux, and Mac OS are supported)

Caveats

  • Only tested on US XBRL files from SEC EDGAR
  • Opinionated conversion to CSV
  • Not validated against the XBRL specification

Use at your own discretetion and always verify the results yourself.

Installation

Python package

Note: fast-xbrl-parser requires Python 3.6+

pip install fast-xbrl-parser

CLI tool

Download the executable file from:

https://github.com/TiesdeKok/fast_xbrl_parser/releases/

Basic use

For full examples and documentation see: notebook

As a Python package

import fast_xbrl_parser as fxp

input = "https://www.sec.gov/Archives/edgar/data/1326380/000132638021000129/gme-20211030_htm.xml" ## Edgar URL
#input = "gme-20211030_htm.xml" ## Local XML file


xbrl_dict = fxp.parse(
    input, 
    output=['json', 'facts', 'dimensions'],   ### You can adjust this to only return certain outputs. 
    email = "[email protected]"       ### Adjust this to reflect your email address. This is required by the SEC Edgar system when passing a URL.  
) 

json_valid_dict = xbrl_dict['json']
facts_list = xbrl_dict['facts']
facts_df = pd.DataFrame(facts_list)

Standalone using the command line

fast_xbrl_parser.exe
--input "https://www.sec.gov/Archives/edgar/data/1589526/000158952621000140/blbd-20211002_htm.xml" 
--json --facts --dimensions 
--save-dir "D:\xbrl_storage" --email "[email protected]"

## This will save the JSON / CSV files in the `save-dir`

Questions?

If you have questions or experience problems please use the issues tab of this repository.

License

MIT - Ties de Kok - 2022

About

An XBRL parser built in Rust that provides a fast, easy, and lightweight way to convert XBRL XML files into JSON or CSV.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published