Skip to main content

A package to parse SEC XBRL

Project description

SEC XBRL

A python package to parse sec xbrl. Supports the datamule project.

Intended to be fast & lightweight for SEC inline XBRL.

Other XBRL Packages may be better for your use-case:

Installation

pip install secxbrl

parse_inline_xbrl

parse_inline_xbrl(content=None,filepath=None,encoding='utf-8',file_type='inline')

Takes content or filepath, and returns parsed xbrl. File type can be 'inline', e.g. from an inline xbrl html or htm document, or 'extracted_inline' from the xbrl file extracted from the html or htm document. This is usually named something like: tsla-20211231_htm.xml.

Example

from secxbrl import parse_inline_xbrl

# load data
path = '../samples/000095017022000796/tsla-20211231.htm'
with open(path,'rb') as f:
    content = f.read()

# parse data
ix = parse_inline_xbrl(content)
with open('test.txt','w', encoding='utf-8') as f:
    f.writelines([str(item)+'\n\n' for item in ix])

# get all EarningsPerShareBasic
basic = [{'val':item['_val'],'date':item['_context']['context_period_enddate']} for item in ix if item['_attributes']['name']=='us-gaap:EarningsPerShareBasic']
print(basic)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

secxbrl-0.1.4.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

secxbrl-0.1.4-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file secxbrl-0.1.4.tar.gz.

File metadata

  • Download URL: secxbrl-0.1.4.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for secxbrl-0.1.4.tar.gz
Algorithm Hash digest
SHA256 13b5c7e243e6cf72c130703ef2a7ef1cfee26ac044ee3e3282fa7dbba4779423
MD5 d328ed04af188a0d18545fea70d30de7
BLAKE2b-256 3a6ad72cbf13ae94319182a7e69874153f99300b2bf27dbc6c08888a720a3ee7

See more details on using hashes here.

File details

Details for the file secxbrl-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: secxbrl-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for secxbrl-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0cf7e2941e918b0ecb49941eb7bb97a9b959c3a5446e5db54507013cc82ff987
MD5 66bf829cf4a8a728eab4d852acfddcfc
BLAKE2b-256 10f1f5d576d4ceda2a21ea33f159bf92bd02bfb3100b5afe39b4c2d6b9e7d58e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page