Skip to main content

Python package for Financial Modeling Prep API

Project description

project-logo

FMP-PY

Unlock Financial Insights with Seamless API Integration

GitHub Actions Workflow Status license last-commit repo-top-language repo-language-count

Developed with the software and tools below.

precommit Poetry Python GitHub%20Actions pandas


Table of Contents

Overview

The fmp-py project is a comprehensive Python library designed to interface with the Financial Modeling Prep (FMP) API, enabling seamless retrieval and analysis of a wide array of financial data. Core functionalities include accessing historical and intraday stock prices, company information, IPO calendars, mergers and acquisitions, stock splits, earnings reports, dividends, forex, and cryptocurrency data. It provides well-structured data models and methods to fetch, process, and integrate various financial metrics, enhancing users ability to perform detailed financial market analyses and make informed investment decisions efficiently.

Documentation

Features

Feature Description
โš™๏ธ Architecture The project follows a modular architecture with separate files for different financial data functionalities, aiding in maintainability and scalability.
๐Ÿ”ฉ Code Quality The code adheres to consistent coding standards and practices with a focus on maintainability and readability, supported by pre-commit hooks and ruff for linting.
๐Ÿ“„ Documentation The project includes comprehensive documentation generated by Sphinx, with themes like sphinx-rtd-theme. Documentation covers usage and API reference.
๐Ÿ”Œ Integrations Integrates with Financial Modeling Prep API for financial data. Utilizes GitHub Actions for continuous integration to automate testing workflows.
๐Ÿงฉ Modularity Highly modular with well-defined interfaces. Modules can be easily reused and extended, facilitating integration in various financial applications.
๐Ÿงช Testing Uses requests-mock for mocking API requests in tests. GitHub Actions are used for automating the test execution.
โšก๏ธ Performance Efficiently handles API requests with caching via requests-cache and rate-limiting through requests-ratelimiter to optimize performance.
๐Ÿ›ก๏ธ Security Employs python-dotenv for secure management of environment variables, ensuring API keys and sensitive information are protected.
๐Ÿ“ฆ Dependencies Key dependencies include requests, pandas, pendulum, sphinx, requests-cache, and requests-ratelimiter among others, as specified in pyproject.toml.
๐Ÿš€ Scalability Designed to scale with increased API request loads, thanks to efficient use of caching, rate limiting, and modular architecture.

Repository Structure

โ””โ”€โ”€ fmp-py
    โ”œโ”€โ”€ src
    โ”‚   โ””โ”€โ”€ fmp_py
    โ”‚       โ”œโ”€โ”€ __init__.py
    โ”‚       โ”œโ”€โ”€ fmp_base.py
    โ”‚       โ”œโ”€โ”€ fmp_chart_data.py
    โ”‚       โ”œโ”€โ”€ fmp_company_information.py
    โ”‚       โ”œโ”€โ”€ fmp_company_search.py
    โ”‚       โ”œโ”€โ”€ fmp_crypto.py
    โ”‚       โ”œโ”€โ”€ fmp_dividends.py
    โ”‚       โ”œโ”€โ”€ fmp_earnings.py
    โ”‚       โ”œโ”€โ”€ fmp_financial_statements.py
    โ”‚       โ”œโ”€โ”€ fmp_forex.py
    โ”‚       โ”œโ”€โ”€ fmp_historical_data.py
    โ”‚       โ”œโ”€โ”€ fmp_ipo_calendar.py
    โ”‚       โ”œโ”€โ”€ fmp_mergers_and_aquisitions.py
    โ”‚       โ”œโ”€โ”€ fmp_price_targets.py
    โ”‚       โ”œโ”€โ”€ fmp_quote.py
    โ”‚       โ”œโ”€โ”€ fmp_splits.py
    โ”‚       โ”œโ”€โ”€ fmp_statement_analysis.py
    โ”‚       โ”œโ”€โ”€ fmp_stock_list.py
    โ”‚       โ”œโ”€โ”€ fmp_upgrades_downgrades.py
    โ”‚       โ”œโ”€โ”€ fmp_valuation.py
    โ”‚       โ””โ”€โ”€ models
    โ”‚           โ”œโ”€โ”€ company_information.py
    โ”‚           โ”œโ”€โ”€ price_targets.py
    โ”‚           โ”œโ”€โ”€ quote.py
    โ”‚           โ”œโ”€โ”€ statement_analysis.py
    โ”‚           โ”œโ”€โ”€ upgrades_downgrades.py
    โ”‚           โ””โ”€โ”€ valuation.py
    โ””โ”€โ”€ tests
        โ”œโ”€โ”€ __init__.py
        โ”œโ”€โ”€ test_fmp_chart_data.py
        โ”œโ”€โ”€ test_fmp_company_information.py
        โ”œโ”€โ”€ test_fmp_company_search.py
        โ”œโ”€โ”€ test_fmp_crypto.py
        โ”œโ”€โ”€ test_fmp_dividends.py
        โ”œโ”€โ”€ test_fmp_earnings.py
        โ”œโ”€โ”€ test_fmp_financial_statements.py
        โ”œโ”€โ”€ test_fmp_forex.py
        โ”œโ”€โ”€ test_fmp_historical_data.py
        โ”œโ”€โ”€ test_fmp_ipo_calendar.py
        โ”œโ”€โ”€ test_fmp_mergers_and_aquisitions.py
        โ”œโ”€โ”€ test_fmp_price_targets.py
        โ”œโ”€โ”€ test_fmp_quote.py
        โ”œโ”€โ”€ test_fmp_splits.py
        โ”œโ”€โ”€ test_fmp_statement_analysis.py
        โ”œโ”€โ”€ test_fmp_stock_list.py
        โ”œโ”€โ”€ test_fmp_upgrades_downgrades.py
        โ””โ”€โ”€ test_fmp_valuation.py

Modules

.
File Summary
pyproject.toml Define the project metadata, dependencies, and configurations for the fmp-py package, facilitating structured development, testing, and documentation. The specified settings enhance compatibility, style consistency, and build management, ensuring smooth integration and maintainability within the Financial Modeling Prep APIs Python interface.
src.fmp_py
File Summary
fmp_upgrades_downgrades.py Retrieve and process stock upgrade and downgrade data from the Financial Modeling Prep API, providing methods for obtaining consensus data, company-specific upgrades/downgrades, and RSS feed updates, ensuring comprehensive and up-to-date financial insights.
fmp_financial_statements.py Summary of the Code FileThe code file is part of the fmp-py repository, which provides a Python interface for interacting with various financial data APIs. The key purpose of this specific file is to facilitate interactions with a particular financial endpoint (e.g., historical data, company information, forex, etc.), effectively leveraging the base functionalities established across the repository. Critical features likely include methods for fetching, processing, and returning financial data in a structured format, enabling users to easily integrate this information into their applications. This file is integral to the repositorys architecture, as it extends the overall capability to cater to diverse financial data needs, contributing to a comprehensive Python package for financial market data analysis.
fmp_ipo_calendar.py Retrieve IPO calendar data, including symbol-specific information, IPO prospectus details, and confirmed IPOs within a specified date range. Integrate seamlessly with the Financial Modeling Prep API to provide structured DataFrames facilitating financial data analysis for users.
fmp_mergers_and_aquisitions.py Provides methods to retrieve and process mergers and acquisitions data from the Financial Modeling Prep API, offering search capabilities by company name and fetching data from an RSS feed, thereby enhancing the overall data retrieval functionality within the repositorys architecture.
fmp_splits.py Retrieve and organize historical and calendar stock splits data from the Financial Modeling Prep API, aiding users in accessing detailed information about stock split events within specified date ranges and for specific stock symbols.
fmp_chart_data.py The file fmp_financial_statements.py within the fmp-py repository is pivotal for providing functionalities related to financial statements. It focuses on retrieving, processing, and presenting financial data such as balance sheets, income statements, and cash flow statements for various companies. This module is a critical component of the broader architecture as it interfaces with the financial data provider and ensures that users can access and utilize up-to-date financial information efficiently. The seamless integration and utility of this module highlight its importance in the repositorys goal of offering comprehensive financial data analysis and access tools.
fmp_company_search.py Provide methods to search for companies in the Financial Modeling Prep (FMP) API using various identifiers such as ISIN, CUSIP, CIK, ticker symbols, and company names. Integrates search functionality into the broader architecture for retrieving and processing financial data.
fmp_historical_data.py Facilitates retrieval and preparation of historical financial data from Financial Modeling Prep API, including daily and intraday stock prices. Enhances data with calculated metrics like VWAP, and ensures data consistency through date sorting and price rounding, contributing to the repositorys comprehensive financial data analysis capabilities.
fmp_quote.py Summary of the Code Files Purpose and FeaturesThe fmp_chart_data.py file is a crucial component of the fmp-py repository, which appears to facilitate interaction with financial data, likely sourced from an external API. This specific file is dedicated to handling chart data, providing functions and utilities to fetch, process, and manage various types of financial charts. As part of the broader src/fmp_py directory, it integrates seamlessly with other modules, such as those dealing with company information, historical data, and financial statements, contributing to a comprehensive toolkit for financial data analysis. This integration enhances the repositorys capability to offer a robust and versatile framework for users looking to perform detailed and diverse financial analyses.
fmp_statement_analysis.py The fmp_company_search.py file is part of the fmp-py repository, specifically located within the src/fmp_py directory. This file primarily facilitates the searching of company information using specific criteria, enabling users to retrieve relevant data about companies based on various parameters. The critical features include functionalities for querying and filtering company data, which are essential components for users needing detailed and tailored company information within the larger scope of financial data management that the repository aims to provide. By integrating these search capabilities, the file significantly enhances the repositorys utility in handling comprehensive financial data operations.
fmp_company_information.py Fmp-pyThe code file is part of the fmp-py repository, which appears to be a Python package focused on financial market data integration. This package is structured into several modules, each targeting specific aspects of financial data, such as company information, crypto, forex, historical data, earnings, dividends, etc. ### Main Purpose of the Code FileThe primary purpose of this code file is to provide functionalities related to one of the specialized areas within financial market data (e.g., company information, earnings, or historical data). It serves as a module that users can import and utilize to retrieve, process, and manipulate the relevant financial data efficiently.### Critical Features-**ModularityThe code file is designed as a discrete module within the src/fmp_py directory, encapsulating specific functionalities and ensuring that related tasks are organized logically and cohesively.-**IntegrationIt integrates seamlessly with other modules in the repository to offer a comprehensive and unified API for financial market data.-**ConvenienceProvides user-friendly methods to access and handle complex financial data operations, making it easier for users to implement and use in their projects.In summary, this code file plays a critical role in the modular architecture of the fmp-py repository, focusing on delivering specialized financial market data functionalities that integrate with the overall package to offer a robust and comprehensive solution.
fmp_valuation.py Summary of fmp_mergers_an.py in Relation to the RepositoryThe fmp_mergers_an.py file, located within the src/fmp_py directory of the fmp-py repository, is designed to handle the extraction and manipulation of financial data related to mergers and acquisitions. As part of the broader architecture, this file specifically focuses on providing functionality to access and process market information pertaining to corporate mergers and acquisitions. This capability is complementary to the other modules within the directory, which collectively offer a comprehensive suite for interacting with various financial market data, including company information, historical data, earnings, dividends, and more. The purpose of fmp_mergers_an.py is thus to enrich the repositorys overall utility by adding specialized data handling for mergers and acquisitions, thereby enabling users to perform detailed financial analyses and make informed decisions based on the latest market activities.
fmp_earnings.py Facilitates retrieving earnings data from the Financial Modeling Prep API, encompassing earnings surprises, confirmed earnings, earnings calendars, historical earnings, and checks for upcoming earnings within specified weeks. Integrates seamlessly within the broader architecture, aiding in comprehensive financial data analysis and decision-making.
fmp_base.py Facilitates API communication with Financial Modeling Prep by managing requests and handling retries. Provides methods for data cleaning and error handling, ensuring robust and reliable API interactions within the larger repository architecture. Essential for implementing consistent and efficient API calls throughout the modules.
fmp_stock_list.py Implements the FmpStockList class to interface with the Financial Modeling Prep API, retrieving comprehensive stock and ETF lists, symbol changes, and various market data. Integrates seamlessly with the repositorys architecture, supporting robust data extraction and manipulation for financial analysis.
fmp_forex.py Retrieve and manage comprehensive forex market data, including daily and intraday quotes, full forex quotes, and lists of available forex pairs. Integrate seamlessly with the parent repositorys architecture to streamline financial data operations, ensuring up-to-date and accurate information for forex trading analysis.
fmp_crypto.py Facilitate access to cryptocurrency data by providing functions to retrieve daily, intraday, and full crypto quotes, as well as a list of available cryptocurrencies. Integrates with the repositorys architecture to enhance financial market data analysis and support comprehensive financial modeling and prediction capabilities.
fmp_price_targets.py Provides methods to retrieve price target data from the Financial Modeling Prep API, including consensus, summary, and detailed price targets for specific stocks. Integrates with the repositorys architecture by leveraging a base class for API interactions and returning structured data models and DataFrame outputs.
fmp_dividends.py Provide access to dividends calendar and historical data endpoints from Financial Modeling Prep, enabling the retrieval of detailed dividend information, including dates, amounts, and stock symbols, within specified date ranges or for specific stock symbols, thereby enhancing financial analysis capabilities within the repositorys financial data management structure.
src.fmp_py.models
File Summary
price_targets.py Define data structures representing the price target consensus and summary for stocks, enabling the efficient management and retrieval of price target information within the repositorys financial analysis tools. These structures support the broader architecture by ensuring consistent and reliable financial data representation across various modules.
statement_analysis.py Represent financial health metrics and performance indicators essential for conducting comprehensive statement analysis within the repositorys architecture. Integrate data classes to encapsulate financial scores, ratios, and key metrics for streamlined financial analysis, enabling efficient retrieval and manipulation of critical financial information.
company_information.py Provide structured data models to represent various facets of company information, including stock peers, core details, market capitalization, executive compensation, and company profiles, facilitating organized and consistent data retrieval throughout the repositorys financial market analysis functionalities.
quote.py Define various data classes representing different types of financial quotes, such as forex, crypto, and stocks. These models are essential for parsing and structuring financial data within the application, facilitating consistent data handling and integration across the repositorys financial modules.
upgrades_downgrades.py Define the data structure for stock upgrades and downgrades, encapsulating attributes like symbol, strong buy, buy, hold, sell, strong sell, and consensus. This module supports the repositorys aim to provide comprehensive financial market data by structuring key evaluation metrics for stocks.
valuation.py Define data structures for representing discounted cash flow and company ratings, facilitating the storage and manipulation of valuation metrics within the repositorys financial analysis framework. These dataclasses streamline the integration of valuation data with various financial models and analytical tools in the codebase.
.github.workflows
File Summary
test-package.yaml Automates the execution of tests for the repository using GitHub Actions, ensuring code integrity and early detection of issues by running predefined test cases whenever changes are pushed or pull requests are submitted. Reinforces continuous integration practices within the repositorys development workflow.

Getting Started

System Requirements:

  • Python: version >=3.10

Installation

From source

  1. Clone the fmp-py repository:
$ git clone https://github.com/TexasCoding/fmp-py
  1. Change to the project directory:
$ cd fmp-py
  1. Install the dependencies:
$ poetry install

Usage

From source

Run fmp-py using the command below:

$ python main.py

Tests

Run the test suite using the command below:

$ pytest

Contributing

Contributions are welcome! Here are several ways you can contribute:

Contributing Guidelines
  1. Fork the Repository: Start by forking the project repository to your github account.
  2. Clone Locally: Clone the forked repository to your local machine using a git client.
    git clone https://github.com/TexasCoding/fmp-py
    
  3. Create a New Branch: Always work on a new branch, giving it a descriptive name.
    git checkout -b new-feature-x
    
  4. Make Your Changes: Develop and test your changes locally.
  5. Commit Your Changes: Commit with a clear message describing your updates.
    git commit -m 'Implemented new feature x.'
    
  6. Push to github: Push the changes to your forked repository.
    git push origin new-feature-x
    
  7. Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
  8. Review: Once your PR is reviewed and approved, it will be merged into the main branch. Congratulations on your contribution!
Contributor Graph


License

This project is protected under the MIT License. For more details, refer to the LICENSE file.

Return


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

fmp_py-0.0.20.3.tar.gz (65.2 kB view details)

Uploaded Source

Built Distribution

fmp_py-0.0.20.3-py3-none-any.whl (69.2 kB view details)

Uploaded Python 3

File details

Details for the file fmp_py-0.0.20.3.tar.gz.

File metadata

  • Download URL: fmp_py-0.0.20.3.tar.gz
  • Upload date:
  • Size: 65.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.10.6-200.fc40.x86_64

File hashes

Hashes for fmp_py-0.0.20.3.tar.gz
Algorithm Hash digest
SHA256 0b4e3a07bbbd90210e8f3dc1297108d6a6d4ad04142a97f090fb3ff76e9760c5
MD5 bc93f0b2d6bb3cd263dbc5b619a4141b
BLAKE2b-256 76707fc65b748de8037ca8238e8058aeb9e0a3a3277f528e5176088639456d42

See more details on using hashes here.

File details

Details for the file fmp_py-0.0.20.3-py3-none-any.whl.

File metadata

  • Download URL: fmp_py-0.0.20.3-py3-none-any.whl
  • Upload date:
  • Size: 69.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.10.6-200.fc40.x86_64

File hashes

Hashes for fmp_py-0.0.20.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c633e9630bf45fc89f5e08079a28f30b0b1cef8b27e9b8ed3264a5edfbb42e96
MD5 7c62b0570262819f32f15a71128e2bbe
BLAKE2b-256 ac6e385a6e51144dbfd25ed1032fdbd0131cb697b30e91a31fe64fc217b2a9e2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page