Skip to main content

A package to standardize XBRL into fundamentals data

Project description

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

  1. Mappings are stored as a dictionary in mappings.py. This is used to standardize different xbrl reporting taxonomies.
  2. Calculations are stored as a dictionary in calculations.py. This is used to determine how fundamentals are calculated.

TODO

  1. Bug testing
  2. More Fundamentals
  3. Performance Improvements

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

company_fundamentals-0.0.6.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

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

company_fundamentals-0.0.6-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file company_fundamentals-0.0.6.tar.gz.

File metadata

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

File hashes

Hashes for company_fundamentals-0.0.6.tar.gz
Algorithm Hash digest
SHA256 77fab78e309ebb2601ed495e21c452763171ecd3bbc9d41161059847a989ec96
MD5 3cd7a16007dc3d99cc9bcfc9701b09d4
BLAKE2b-256 85928e73667be414a06e8578176c6dc916d9dda9c1b91127c81f259c0ce37043

See more details on using hashes here.

File details

Details for the file company_fundamentals-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for company_fundamentals-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 9acb9bc185a9813fd77fa371538c448ae8c3cd33db2c88849fb912939426a260
MD5 b2b7e5011059298ddd0b340beb3488f1
BLAKE2b-256 ae478e9b759cac9893e9b2ce72e7db798792768585cf6aa223781c91bff23332

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