Closed mrx23dot closed 3 years ago
Unfortunately I am not entirely sure what you mean.
The XbrlInstance object instance has a dictionary called unit_map which stores all units with the corresponding id in the dictionary.
The parser also automatically links the units to the facts:
The code I used:
cache: HttpCache = HttpCache('./cache')
xbrlParser = XbrlParser(cache)
xbrl_url = 'https://www.sec.gov/Archives/edgar/data/0000320193/000032019321000056/aapl-20210327.htm'
inst: XbrlInstance = xbrlParser.parse_instance(xbrl_url)
print(inst.unit_map)
print([str(fact.unit) for fact in inst.facts if fact.concept.name == 'Assets'])
Works great, thanks!
Any chance we could extract the reportedCurrency e.g: "USD", it's in the high level xbrli header.
<xbrli:measure>iso4217:USD</xbrli:measure>
in https://www.sec.gov/ix?doc=/Archives/edgar/data/0000320193/000032019321000056/aapl-20210327.htm
It's also in xml:
https://www.sec.gov/Archives/edgar/data/1403570/000149315221006582/qtmm-20190630.xml