SDKs overview
OpenFIGI provides both officially supported Software Development Kits (SDKs) and community-contcontributed libraries to assist developers in integrating with its API. These tools abstract the underlying HTTP requests and JSON parsing, allowing developers to focus on the logic of mapping security identifiers to Financial Instrument Global Identifiers (FIGIs) and retrieving associated metadata. The primary function of these SDKs is to interact with the OpenFIGI API, which facilitates the identification and standardization of financial instrument data.
The availability of SDKs across multiple programming languages, including Python, Java, C#, Go, and R, aims to accommodate a broad range of development environments and preferences. These SDKs typically handle API key management, request formatting, and response parsing, streamlining the development process for applications that require programmatic access to OpenFIGI's identifier mapping capabilities. Developers can select the SDK that best aligns with their existing technology stack.
Official SDKs by language
OpenFIGI maintains official SDKs for several programming languages, designed to provide reliable and up-to-date interfaces for the OpenFIGI API. These SDKs are developed and supported by the OpenFIGI team, ensuring compatibility with the latest API versions and features. Each SDK aims to offer an idiomatic interface for its respective language, simplifying common tasks such as constructing lookup requests and processing results.
The table below summarizes the officially supported SDKs, including their typical package names, installation methods, and general maturity level. While OpenFIGI's documentation provides specific details and examples for each, this overview offers a quick reference for developers evaluating their options.
| Language | Package/Module | Installation Command | Maturity |
|---|---|---|---|
| Python | openfigi |
pip install openfigi |
Stable |
| Java | com.openfigi:openfigi-java |
Add to pom.xml (Maven) or build.gradle (Gradle) |
Stable |
| C# | OpenFigi.Client |
dotnet add package OpenFigi.Client |
Stable |
| Go | github.com/openfigi/go-openfigi |
go get github.com/openfigi/go-openfigi |
Stable |
| R | OpenFigiR |
install.packages("OpenFigiR") |
Stable |
These SDKs are designed to abstract the complexities of HTTP requests and JSON parsing, allowing developers to interact with the OpenFIGI API using native language constructs. For instance, the Python SDK might offer a client object with methods like map_identifiers(), which internally handles the API call and returns parsed results as Python data structures. Developers are encouraged to consult the official OpenFIGI documentation for the most current installation instructions and usage examples for each language.
Installation
Installing an OpenFIGI SDK typically follows the standard package management practices for the respective programming language. Each official SDK is distributed through its language's primary package repository, ensuring ease of access and version control. Below are general installation guidelines for the main supported languages:
-
Python:
The Python SDK is available on PyPI. Installation is performed using
pip, Python's package installer. Ensure you have a recent version of Python andpipinstalled.pip install openfigi -
Java:
For Java projects, the OpenFIGI client library is typically managed via Maven or Gradle. You'll need to add the dependency to your project's build file.
Maven (
pom.xml):<dependency> <groupId>com.openfigi</groupId> <artifactId>openfigi-java</artifactId> <version>[LATEST_VERSION]</version> </dependency>Gradle (
build.gradle):implementation 'com.openfigi:openfigi-java:[LATEST_VERSION]'Replace
[LATEST_VERSION]with the current stable version found in the OpenFIGI documentation or Maven Central. -
C#:
The C# SDK can be installed using the .NET CLI or NuGet Package Manager, which is integrated into Visual Studio.
.NET CLI:
dotnet add package OpenFigi.ClientNuGet Package Manager Console:
Install-Package OpenFigi.Client -
Go:
Go modules are used to manage dependencies. You can fetch the OpenFIGI Go client using the
go getcommand.go get github.com/openfigi/go-openfigiThis command will download the module and add it to your
go.modfile. -
R:
The R package for OpenFIGI can be installed directly from CRAN (Comprehensive R Archive Network) using the
install.packages()function.install.packages("OpenFigiR")
After installation, developers will typically need to obtain an API key from the OpenFIGI website, which is required for authenticating requests to the API. This key should be handled securely, ideally stored as an environment variable or in a secure configuration file rather than hardcoded in source files, following general API security best practices outlined by organizations like the OAuth documentation.
Quickstart example
This quickstart example demonstrates how to use the OpenFIGI Python SDK to map a security identifier (e.g., a ticker and exchange code) to its corresponding FIGI. This example assumes you have already installed the Python SDK and obtained an API key.
import openfigi.api as openfigi
import os
# It's recommended to store your API key as an environment variable
# For demonstration, you might set it directly, but avoid in production
# For example: export OPENFIGI_API_KEY="YOUR_API_KEY_HERE"
api_key = os.getenv('OPENFIGI_API_KEY', 'YOUR_API_KEY_HERE') # Replace with your actual key if not using env var
if api_key == 'YOUR_API_KEY_HERE':
print("Warning: Please replace 'YOUR_API_KEY_HERE' with your actual OpenFIGI API key or set the OPENFIGI_API_KEY environment variable.")
# Initialize the OpenFIGI API client with your API key
figi_client = openfigi.OpenFigiAPI(api_key=api_key)
# Define the jobs for which you want to find FIGIs
# Each job is a dictionary representing a security identifier lookup request
jobs = [
{
"idType": "TICKER",
"idValue": "IBM",
"exchCode": "US"
},
{
"idType": "ISIN",
"idValue": "US0378331005"
},
{
"idType": "BB_UNIQUE",
"idValue": "EQ0010069300001000",
"currency": "USD"
}
]
try:
# Call the OpenFIGI API to map the identifiers
results = figi_client.map_identifiers(jobs)
# Process and print the results
for i, job_result in enumerate(results):
print(f"\nJob {i+1} Request: {jobs[i]}")
if job_result and 'data' in job_result:
for item in job_result['data']:
print(f" FIGI: {item.get('figi')}, Name: {item.get('name')}, Type: {item.get('securityType')}")
elif 'error' in job_result:
print(f" Error: {job_result['error']}")
else:
print(" No data or error found.")
except openfigi.OpenFigiAPIError as e:
print(f"An OpenFIGI API error occurred: {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
This Python snippet demonstrates the core functionality: defining a list of lookup requests (jobs) and then passing them to the map_identifiers method. The results are returned as a list, where each entry corresponds to a submitted job and contains the mapped FIGIs and associated metadata, or an error message if the lookup failed. This pattern is generally consistent across other language SDKs, though the specific method names and data structures will adhere to the conventions of each language.
Community libraries
Beyond the officially supported SDKs, the OpenFIGI ecosystem benefits from various community-contributed libraries and wrappers. These libraries are developed and maintained by individual developers or organizations independent of Bloomberg L.P., offering alternative implementations or extending functionality for specific use cases or languages not officially covered. While these libraries may not carry the same level of official support or guarantees as the first-party SDKs, they can provide valuable resources for developers, especially for niche requirements or preferred development patterns.
The existence of community-driven efforts highlights the adaptability and broad applicability of the OpenFIGI API. Developers seeking solutions in languages or frameworks not covered by official SDKs, or those looking for specific features like asynchronous clients or integration with particular data analysis tools, might find these community projects useful. Resources like GitHub and other public code repositories are common places to discover such libraries. When using community-maintained tools, it is generally recommended to review their documentation, community activity, and licensing to ensure they meet project requirements and quality standards. For instance, the Python Package Index (PyPI) and similar language-specific repositories often host community-developed wrappers, alongside official packages, for APIs like OpenFIGI, as detailed in general best practices for API client development.
It is important to note that the stability, maintenance, and feature set of community libraries can vary significantly. Developers should exercise due diligence when incorporating them into production systems, verifying their source, reviewing the code if possible, and understanding their dependencies. The official OpenFIGI documentation remains the authoritative source for API specifications and best practices, regardless of the client library used.