Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tiesdekok/fast_xbrl_parser

An XBRL parser built in Rust that provides a fast, easy, and lightweight way to convert XBRL XML files into JSON or CSV.
https://github.com/tiesdekok/fast_xbrl_parser

csv json rust xbrl xml

Last synced: 4 days ago
JSON representation

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

Awesome Lists containing this project

README

        


Fast XBRL Parser


Fast XBRL Parser








:warning: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](#introduction)
* [Design philosophy](#philosophy)
* [Caveats](#caveats)
* [Installation](#installation)
* [Python](#python-install)
* [Command Line Tool](#cli-install)
* [How to use](#howtouse)
* [Python](#python)
* [Command line](#commandline)
* [Questions?](#questions)
* [License](#license)

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+

```bash
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](https://github.com/TiesdeKok/fast_xbrl_parser/blob/master/examples/example.ipynb)

As a Python package

```python
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

```bash
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](LICENSE) - Ties de Kok - 2022