This project has been archived by its maintainers, and is no longer receiving any updates.
Fetch Fundamental Data
A Python package for fetching and analyzing fundamental financial data using the EODHD API in the background. This package allows you to process Excel files containing stock tickers to generate financial analysis reports.
Features
- Concurrent Data Fetching: Efficiently fetches financial data for multiple stocks simultaneously
- Comprehensive Analysis: Calculate key financial metrics not avaibale in EODHD including:
- Greenblatt Magic Formula rankings
- Conservative investment scores
- Quality scores
- P/E ratios, ROCE, revenue growth, EPS growth
- Free cash flow metrics, buyback data, insider ownership
- Technical indicators and moving averages
- Excel Integration: Read ticker lists from Excel and output results to Excel
Installation
From PyPI (when published)
pip install fetch-fundamental-data
Development Installation
git clone https://github.com/username/fetch-fundamental-data.git
cd fetch-fundamental-data
pip install -r requirements.txt
pip install -e .
Prerequisites
- EODHD API Key: You need an API key from EODHD to fetch financial data
Start
1. Prepare Excel File
Create an Excel file (.xlsx) with the following format:
Important Notes:
- First Column: Company names
- Second Column: Ticker symbols
- Note! Make sure to use proper ticker formats (e.g.,
DANSKE.COfor Copenhagen exchange) that are compatible with EODHD.
2. Run the Analysis
fetch-fundamentals --api-key YOUR_EODHD_API_KEY --input tickers.xlsx --output results.xlsx
3. View Results
The output Excel file will contain comprehensive financial data and analysis for all tickers.
The following is an example of an excel-file generated by the tickers above:
Command Line Usage
Basic Usage
fetch-fundamentals --api-key YOUR_API_KEY --input input.xlsx --output output.xlsx
Advanced Usage
# Custom number of concurrent workers (default: 10)
fetch-fundamentals --api-key YOUR_API_KEY --input tickers.xlsx --output results.xlsx --workers 5
# Short form arguments
fetch-fundamentals --api-key YOUR_API_KEY -i tickers.xlsx -o results.xlsx -w 5
Command Line Arguments
| Argument | Short | Required | Description |
|---|---|---|---|
--api-key |
Yes | Your EODHD API key | |
--input |
-i |
Yes | Path to input Excel file |
--output |
-o |
YEs | Path to output Excel file |
--workers |
-w |
Number of concurrent workers (1-50, default: 10) | |
--version |
Show version information | ||
--help |
-h |
Show help message |
Python API Usage
from fetch_fundamental_data import FundamentalDataFetcher
# Initialize with your API key
fetcher = FundamentalDataFetcher(api_key="YOUR_EODHD_API_KEY")
# Process an Excel file
fetcher.process_excel_file(
input_file="path/to/tickers.xlsx",
output_file="path/to/results.xlsx",
max_workers=10
)
# Or work with data directly
company_list, ticker_list = fetcher.extract_tickers_from_excel("tickers.xlsx")
df, separate_data = fetcher.fetch_all_data(company_list, ticker_list)
analyzed_df = fetcher.analyze_data(df, separate_data)
Output Data
The output Excel file contains the following types of data:
Financial Metrics
- Price Information: Current price, currency, sector
- Valuation Ratios: P/E ratios (current and 5-year average), ROCE
- Growth Metrics: Revenue growth, EPS growth, asset growth
- Profitability: Gross profitability, free cash flow metrics
- Balance Sheet: Accruals, total yield, insider ownership percentage
Analysis Scores
- Greenblatt Formula: Magic Formula ranking based on P/E and ROCE
- Conservative Formula: Risk-adjusted scoring based on volatility, NPY, and momentum
- Quality Score: Overall quality assessment
Technical Data
- Moving Averages: Various period moving averages
- Volatility Metrics: Historical volatility measures
- Price Momentum: Momentum indicators
Examples
Example Input File (tickers.xlsx)
| Company | Ticker |
|---|---|
| Apple | AAPL |
| Microsoft | MSFT |
| Alphabet | GOOGL |
| Amazon | AMZN |
| Tesla | TSLA |
Example Usage
# Basic analysis
fetch-fundamentals --api-key abc123xyz --input tickers.xlsx --output analysis.xlsx
# High-speed processing (more workers)
fetch-fundamentals --api-key abc123xyz --input large_portfolio.xlsx --output results.xlsx --workers 20
# Conservative processing (fewer workers, good for rate limits)
fetch-fundamentals --api-key abc123xyz --input tickers.xlsx --output results.xlsx --workers 3
Testing
Before pushing changes, run the test script to validate functionality:
python test_package.py
Contributing
Contributions are welcome!
Author
Carl Viggo Gravenhorst-Lövenstierne
Metadata
Release files for fetch-fundamental-data 0.1.0
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 | |
|---|---|---|---|---|
| fetch_fundamental_data-0.1.0.tar.gz | 23.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fetch_fundamental_data-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.7 kB
Release files / fetch_fundamental_data-0.1.0.tar.gz
| Download URL | fetch_fundamental_data-0.1.0.tar.gz |
|---|---|
| Size | 23.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5509e906433533e539f5f7b0c736a6be41d00f6699c00e1d59d2a0126fe726f0
|
|
BLAKE2b-256 checksum How to use checksums |
513ca2d601c7ee58f2cff2bcea7157361a41b6949ef2edfb7b7244a6ad11ba3e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.12
|
Release files / fetch_fundamental_data-0.1.0-py3-none-any.whl
| Download URL | fetch_fundamental_data-0.1.0-py3-none-any.whl |
|---|---|
| Size | 17.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
60652200e27326a5bc0b26b7f1cc23f5434ea886344f52d4492d2b5b8bc9ffd0
|
|
BLAKE2b-256 checksum How to use checksums |
b795b38f46f191fc13ab6b8a545822a534febbdeeda17c885cf6df1c36d609c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.12
|
Security for fetch-fundamental-data 0.1.0
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.