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.

Installation

pip install companyfundamentals

Usage

Takes dictionaries with taxonomy and concept, then standardizes and calculates fundamental values. Powers the datamule project.


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.5.tar.gz (20.3 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.5-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for company_fundamentals-0.0.5.tar.gz
Algorithm Hash digest
SHA256 532ba98397f8ab3678e691af5d78c0b03adeb64baf8bead872dafa12957bf961
MD5 7c50bdf0824c322410e53edb2e6f624c
BLAKE2b-256 95f67697d40ae0f743ceadfb1d40607653a7499da3af63afcd0d975ed63ab354

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for company_fundamentals-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 0ea0be5e16a7164d5a96187d759f000bc1d3b3947db7bc42eb62dfc36783fc85
MD5 8b8d98cd57a1608a89a8fa1277feb8cf
BLAKE2b-256 a09af10e0116c4cdca5113417a286a55e2d402dc9640e9a4ba862cdbbd747f80

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