SDKs overview
Financial Modeling Prep (FMP) provides Software Development Kits (SDKs) and client libraries designed to facilitate interaction with its financial data API. These tools aim to reduce the boilerplate code required for making HTTP requests, handling API keys, and parsing JSON or CSV responses directly into language-native objects or structures. By using an SDK, developers can integrate real-time and historical financial data—including stock market, forex, cryptocurrency, and economic indicators—more rapidly into their applications, trading bots, and analytical platforms.
The API itself is built on a RESTful architecture, allowing for direct HTTP calls. However, SDKs offer an abstraction layer that streamlines common operations, such as fetching financial statements, historical prices, or company profiles. This abstraction can accelerate development cycles for applications requiring consistent access to financial data. The Financial Modeling Prep developer documentation details the various data endpoints and parameters accessible through the API, which the SDKs are designed to wrap.
The design of these SDKs often aligns with best practices for client libraries, including support for API key authentication and error handling. For instance, many SDKs allow API keys to be configured once and then reused across multiple data requests, simplifying the authentication process for developers. This approach is consistent with the general principles of REST API design patterns, where client libraries enhance usability.
Official SDKs by language
Financial Modeling Prep maintains official SDKs and client libraries for several popular programming languages. These libraries are developed to provide a native-language experience for integrating FMP data, often following idiomatic conventions for each language. The official offerings typically focus on stability, comprehensive coverage of API endpoints, and consistent maintenance.
The following table outlines the key official SDKs provided by Financial Modeling Prep:
| Language | Package/Library Name | Install Command Example | Maturity/Status |
|---|---|---|---|
| Python | fmp |
pip install fmp |
Stable, actively maintained |
| JavaScript (Node.js/Browser) | financial-modeling-prep |
npm install financial-modeling-prep |
Stable, actively maintained |
| Ruby | financial_modeling_prep |
gem install financial_modeling_prep |
Stable |
| PHP | financial-modeling-prep/php-sdk |
composer require financial-modeling-prep/php-sdk |
Stable |
| Java | (Maven/Gradle dependency) | // Add to pom.xml or build.gradle |
Stable |
| Go | github.com/financialmodelingprep/sdk-go |
go get github.com/financialmodelingprep/sdk-go |
Stable |
Each of these SDKs is designed to provide direct access to the various data categories offered by FMP, including but not limited to company financials, real-time stock prices, historical data, and economic indicators. Developers can refer to the specific SDK documentation on Financial Modeling Prep's site for detailed usage instructions and examples.
Installation
Installation of Financial Modeling Prep SDKs typically follows standard package management practices for each programming language. The process generally involves using a command-line tool to add the library to a project's dependencies.
Python
To install the Python SDK, use pip, the Python package installer:
pip install fmp
Once installed, the library can be imported into Python scripts for use.
JavaScript (Node.js)
For Node.js environments, the SDK is available via npm:
npm install financial-modeling-prep
In browser-based applications, the SDK might be included via a CDN or bundled using tools like Webpack or Rollup.
Ruby
The Ruby SDK is published as a gem:
gem install financial_modeling_prep
After installation, require the gem in Ruby scripts.
PHP
For PHP projects, Composer is the recommended installation method:
composer require financial-modeling-prep/php-sdk
This command adds the FMP SDK to the project's composer.json and downloads the necessary files.
Java
Java SDKs are typically managed with Maven or Gradle. Developers must add the appropriate dependency entry to their pom.xml (Maven) or build.gradle (Gradle) file. An example Maven dependency entry might look like this (specific version details should be confirmed in the official documentation):
<dependency>
<groupId>com.financialmodelingprep</groupId>
<artifactId>fmp-java-sdk</artifactId>
<version>1.0.0</version> <!-- Replace with actual version -->
</dependency>
Go
Go modules are used to install the Go SDK:
go get github.com/financialmodelingprep/sdk-go
This command fetches the package and adds it to the Go module dependency list.
Quickstart example
The following Python example demonstrates how to initialize the Financial Modeling Prep SDK and retrieve basic company profile data for a specific ticker. This example assumes an API key has been obtained from the Financial Modeling Prep dashboard.
import os
from fmp import FMP
# It's recommended to store your API key as an environment variable
# For demonstration, you can replace os.environ.get with your actual key (not recommended for production)
api_key = os.environ.get("FMP_API_KEY", "YOUR_API_KEY_HERE")
if api_key == "YOUR_API_KEY_HERE":
print("Warning: Replace 'YOUR_API_KEY_HERE' with your actual FMP API key or set the FMP_API_KEY environment variable.")
fmp = FMP(api_key=api_key)
ticker = "AAPL"
try:
# Get company profile data
company_profile = fmp.get_company_profile(ticker=ticker)
if company_profile:
print(f"Company Profile for {ticker}:")
print(f" Company Name: {company_profile[0].get('companyName')}")
print(f" Industry: {company_profile[0].get('industry')}")
print(f" Sector: {company_profile[0].get('sector')}")
print(f" Website: {company_profile[0].get('website')}")
print(f" CEO: {company_profile[0].get('ceo')}")
else:
print(f"No company profile found for {ticker}.")
# Get real-time quote
quote = fmp.get_quote(ticker=ticker)
if quote:
print(f"\nReal-time Quote for {ticker}:")
print(f" Price: {quote[0].get('price')}")
print(f" Volume: {quote[0].get('volume')}")
else:
print(f"No real-time quote found for {ticker}.")
except Exception as e:
print(f"An error occurred: {e}")
This snippet initializes the FMP client with an API key and then makes requests to retrieve a company's profile and its real-time stock quote. The output is then printed to the console, demonstrating basic data access. Developers should ensure their API key is kept confidential, ideally through environment variables, as illustrated.
Community libraries
While Financial Modeling Prep provides official SDKs, the broader developer community may also contribute open-source client libraries or wrappers. These community-driven projects can offer alternative implementations, specialized functionalities, or support for languages not officially covered. Community libraries often arise from specific project needs and can sometimes feature different design philosophies or integrations with other tools.
Developers exploring community options should consider the project's activity, maintenance status, and community support. Resources like GitHub and other code hosting platforms are common places to find such contributions. It is important to verify the reliability and security of any third-party library before integrating it into a production system. The Mozilla Developer Network's guide on Web APIs provides general context on how third-party libraries often interact with API services, emphasizing the importance of documentation and community engagement.
As of late 2024, direct references to widely adopted, distinct community libraries for Financial Modeling Prep are less prominent than the official SDKs. This may indicate that the official offerings largely meet developer needs, or that community efforts are integrated into larger financial toolkits rather than standalone FMP wrappers. Developers interested in contributing or finding such libraries are advised to check platform-specific package repositories (e.g., PyPI for Python, npm for JavaScript) and GitHub for recent community projects tagged with "financial modeling prep" or "fmp api".