Coder Social home page Coder Social logo

xbrlj's Introduction

xbrlj

Core Java library that implements XBRL parsing and analysis. To get started,

  1. Construct a new XbrlReader as follows

     XbrlReader reader = new XbrlReader();
    
  2. Get XbrlInstance from the reader

     //
     // url can be a http url to the root .xml document, 
     //     e.g. https://www.sec.gov/Archives/edgar/data/773840/000093041315000621/hon-20141231.xml for Honeywell, FY 2014
     // It can also be a file url, a zip url to the entire xbrl instance or a zip url to an iXBRL instance
     // There are other variations of this basic method. Look at the class for more details or XbrlTest in src/test
     //
     XbrlInstance instance = reader.getInstance(url)
    
  3. Introspect the instance. The simplest introspection is printing the instance to a text file as follows

     PrintWriter writer = new PrintWriter(new FileWriter(path));
     PrettyPrinter printer = new PrettyPrinter(writer, true, true, false);
     PresentationNetwork fileWriter = new PresentationNetwork(instance, printer);
    
     DiscoverableTaxonomySet dts = instance.getTaxonomy();
     Collection<RoleType> roles = dts.getReportableRoleTypes();
     for (RoleType roleType : roles) {
         fileWriter.process(roleType);
     }
    

    Here is a sample output in json (https://datanapis.io/JPM_20210930_ZIP.json), text (https://datanapis.io/JPM_20210930_ZIP.txt) and text with labels (https://datanapis.io/JPM_20210930_ZIP_with_labels.txt)

  4. You can do many more things such as exploring the concepts and facts used by the XbrlInstance, exploring the DefinitionNetwork, the CalculationNetwork, validating calculations, exploring the Discoverable Taxonomy Set, etc.

I have run this on 305,676 XBRL instances submitted to Edgar starting from 2012 with 99.59% success rate. You can download these statistics from here - https://datanapis.io/xbrl_results.csv

The software for downloading from Edgar and processing all those instances is not part of this repository.

Before you can start to download XBRL instances from Edgar, you may need to set the property user.agent to a valid email. See the Edgar documentation for more details.

xbrlj's People

Contributors

ammasjk avatar gmconte avatar macnjk avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

gmconte

xbrlj's Issues

Error reading concept in Tesla Q10 2023 July 24th

Hi, I just found a bug with this document:
https://www.sec.gov/Archives/edgar/data/1318605/000095017023033872/0000950170-23-033872-xbrl.zip

The system finds all kind of HREF and the keyConceptMap contains ~20k of them.

But if you put a breakpoint with the condition concept == null in DiscoverableTaxonomySet:462 you will see which href makes it fail.
Maybe it could be enough to just ignore with a try-catch and log the href causing the error, not sure.

EarningsPerShareDiluted is not rendered as decimal

I'm looking at the Earnings per share value, which is not like all the others (its "decimal" value is actually positive), and the value in the resulting JSON doesn't have any decimals.

For example:

  • doc value = (4.15)
  • json value = -4

I'm trying to understand what could be wrong and I can see that this piece of code could be the problem:

from PresentationSerializer.makeFact()

if (fact.getLongValue() != null) {
long value = fact.getLongValue();
if (node.isNegated()) {
value = -value;
}
object.addProperty(VALUE, value);
} else if (fact.getDoubleValue() != null) {
double value = fact.getDoubleValue();
if (node.isNegated()) {
value = -value;
}
object.addProperty(VALUE, value);
} else {
object.addProperty(VALUE, fact.getValue());
}

In the debugger, I can see that the getLongValue return the integer number, while double value is null.

Possible Solution

I'm not sure of the reason for this specific order in selecting the value, but if that cannot be changed, we could have the longValue skipped in case decimals is a positive value.

What do you think?

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.