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)
Metadata
Release files for secxbrl 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| secxbrl-0.1.5.tar.gz | 4.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| secxbrl-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.4 kB
Release files / secxbrl-0.1.5.tar.gz
| Download URL | secxbrl-0.1.5.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e0f462975a7524539562613395913a462c89bb4c5efc5d035b9eb7122097b05
|
|
BLAKE2b-256 checksum How to use checksums |
798ffd974916985e282c3ce606e9852352d19a0071e621f1b7a8465adec96e62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / secxbrl-0.1.5-py3-none-any.whl
| Download URL | secxbrl-0.1.5-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
68338183b45c3cf0d252019b251ae6123d6ddf982204822651e7739960b156f2
|
|
BLAKE2b-256 checksum How to use checksums |
23ff61f726191024077f4e2ac28033aed3a99c15d29267096fac2adf8c41ae7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|