manusimidt / py-xbrl

Python-based parser for parsing XBRL and iXBRL files
https://py-xbrl.readthedocs.io/en/latest/
GNU General Public License v3.0
100 stars 37 forks source link

"Explicit Member"s missing #72

Closed mrx23dot closed 2 years ago

mrx23dot commented 2 years ago

Given filling: https://www.sec.gov/ix?doc=/Archives/edgar/data/0001751143/000121390021027034/f10q0321_atlastechnical.htm or xml: https://www.sec.gov/Archives/edgar/data/1751143/000121390021027034/f10q0321_atlastechnical_htm.xml

I would like to extract number of shares, now there are ClassA and ClassB ones under the same tag name: dei:EntityCommonStockSharesOutstanding

But they are have unique names under Explicit Member in web view:

us-gaap:CommonClassAMember
us-gaap:CommonClassBMember

which the lib doesn't see.

In xml I only see the common tag, so they might inherit the unique ones: <dei:EntityCommonStockSharesOutstanding contextRef="c2" decimals="INF" unitRef="shares">4284023</dei:EntityCommonStockSharesOutstanding>

This might be another nested case.

mrx23dot commented 2 years ago

Any ideas before I do a big run? Cheers

manusimidt commented 2 years ago

Hello @mrx23dot ,

i have looked into the filing you provided and was able to successfully extract the two facts tagged with "dei:EntityCommonStockSharesOutstanding". One concept has the member "CommonClassAMember" the other "CommonClassBMember".

This was the code i used:

cache: HttpCache = HttpCache('./cache')
xbrlParser = XbrlParser(cache)

inst: XbrlInstance = xbrlParser.parse_instance(
    'https://www.sec.gov/Archives/edgar/data/0001751143/000121390021027034/f10q0321_atlastechnical.htm')
print(inst)
facts: list = []

for fact in inst.facts:
    if fact.concept.name == 'EntityCommonStockSharesOutstanding':
        facts.append(fact)
print(facts)

In this screenshot you can see how the parsed facts correspond with the iXBRL Viewer of the SEC.

image

You can use this code to print out the facts with their corresponding dimensions/members

for fact in facts:
    print(f"{fact.concept.name}: {fact.value} ({fact.context.segments[0].member if len(fact.context.segments) > 0 else ''})")

Please let me know if that works for you :) Greetings, Manu

mrx23dot commented 2 years ago

Works great it was hidden away :D Thanks!

The structural filtering (like cover/balance/cashflow section) would be a great addition. Currently I query for number of shares and it gives me back 4+ different results all over the doc and no way telling which one is front cover and which one is from textblob or subsidiary.