Company Fundamentals
A minimal python package to construct company fundamentals such as EPS, P/E, EBITDA, Gross Margin and more. Powers the datamule project.
Note: finqual may be a better solution for you.
Installation
pip install companyfundamentals
Usage
Takes dictionaries with taxonomy and concept, then standardizes and calculates fundamental values.
sample_simple_xbrl = [
{'taxonomy': 'us-gaap', 'name': 'NetIncomeLoss', 'value': '120000', 'period_start_date': '2024-01-01', 'period_end_date': '2024-12-31'},
{'taxonomy': 'us-gaap', 'name': 'NetIncomeLoss', 'value': '100000', 'period_start_date': '2023-01-01', 'period_end_date': '2023-12-31'},
]
fundamentals = construct_fundamentals(data=sample_simple_xbrl, taxonomy_key='taxonomy', concept_key='name, start_date_key='period_start_date', end_date_key='period_end_date', categories=None,fundamentals=None)
print(fundamentals)
Returns a dictionary of fundamentals
{'incomeStatement': {'netIncome': [{'value': '120000', 'period_start_date': '2024-01-01', 'period_end_date': '2024-12-31'}, {'value': '100000', 'period_start_date': '2023-01-01', 'period_end_date': '2023-12-31'}], 'netIncomeGrowth': [{'value': 0.2, 'period_start_date': '2024-01-01', 'period_end_date': '2024-12-31'}]}}
Use categories to subset what fundamentals you would like to construct
fundamentals = construct_fundamentals(data=sample_simple_xbrl, taxonomy_key='taxonomy', concept_key='name, start_date_key='period_start_date', end_date_key='period_end_date', categories=['incomeStatement'])
Subset by fundamental
fundamentals = construct_fundamentals(data=sample_simple_xbrl, taxonomy_key='taxonomy', concept_key='name, start_date_key='period_start_date', end_date_key='period_end_date', fundamentals=['freeCashFlow'])
Package Design
- Mappings are stored as a dictionary in mappings.py. This is used to standardize different xbrl reporting taxonomies.
- Calculations are stored as a dictionary in calculations.py. This is used to determine how fundamentals are calculated.
TODO
- Bug testing
- More Fundamentals
- Performance Improvements
Metadata
Release files for company-fundamentals 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| company_fundamentals-0.0.6.tar.gz | 20.5 kB | Without provenance | Details for company_fundamentals-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| company_fundamentals-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for company_fundamentals-0.0.6-py3-none-any.whl |
Total release size: 41.9 kB
Release files / company_fundamentals-0.0.6.tar.gz
| Download URL | company_fundamentals-0.0.6.tar.gz |
|---|---|
| Size | 20.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
77fab78e309ebb2601ed495e21c452763171ecd3bbc9d41161059847a989ec96
|
|
BLAKE2b-256 checksum How to use checksums |
85928e73667be414a06e8578176c6dc916d9dda9c1b91127c81f259c0ce37043
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.13
|
Release files / company_fundamentals-0.0.6-py3-none-any.whl
| Download URL | company_fundamentals-0.0.6-py3-none-any.whl |
|---|---|
| Size | 21.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9acb9bc185a9813fd77fa371538c448ae8c3cd33db2c88849fb912939426a260
|
|
BLAKE2b-256 checksum How to use checksums |
ae478e9b759cac9893e9b2ce72e7db798792768585cf6aa223781c91bff23332
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.13
|
Security for company-fundamentals 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.