OpenFIGI Rust Client
A high-performance asynchronous Rust client library for the OpenFIGI API, providing type-safe access to financial instrument identification and mapping services.
OpenFIGI is Bloomberg's open symbology initiative that provides standardized identification for financial instruments across asset classes and markets worldwide.
📖 Table of Contents
- Features
- Getting Started
- Configuration
- API Usage Examples
- Error Handling
- Documentation
- Contributing
- License
- Acknowledgments
- Support
✨ Features
This library is designed with a focus on ergonomics, correctness, and production readiness.
- ⚖️ Ergonomic: Provide a simple, intuitive, and fluent builder API.
- 🔒 Type-safe API: Strongly-typed request and response models prevent invalid data.
- ⚡ Fully Asynchronous: Built on
tokioandreqwestfor high-concurrency applications. - 🔧 Extensible via Middleware: Integrates with
reqwest-middlewarefor custom logic like retries, logging, and tracing. - 📊 Ergonomic Error Handling: Provides distinct error types for network issues, API errors, and invalid requests.
- 🔑 Environment integration: Automatically detects API keys from environment variables.
- 📈 Built-in Rate Limit Handling: The client is aware of API rate limits and provides informative errors when they are exceeded.
- 🔄 Batch operations: First-class support for bulk operations to minimize network round-trips (up to 100 with API key, 5 without).
🚀 Getting Started
First, add the crate to your project's dependencies:
Basic Usage
use OpenFIGIClient;
use IdType;
async
🔧 Configuration
API Key
The client can be configured with an API key to access higher rate limits.
1. Environment Variable (Recommended)
The client automatically detects the OPENFIGI_API_KEY environment variable.
2. Manual Configuration
You can also provide the key explicitly using the builder pattern.
# use OpenFIGIClient;
#
# async
Custom HTTP Client & Middleware
For production environments, you'll want to configure timeouts and retry policies. This library is built on reqwest and reqwest-middleware, making customization easy.
use OpenFIGIClient;
use ClientBuilder;
use ;
use Duration;
async
Rate Limits
| Limitation | Without API Key | With API Key |
|---|---|---|
| Request Rate | 25 per minute | 250 per minute (25 per 6s) |
| Jobs per Request | 10 jobs | 100 jobs |
📚 API Usage Examples
The client supports all three OpenFIGI API v3 endpoints.
| Endpoint | Purpose | Batch Support |
|---|---|---|
| /mapping | Map third-party identifiers to FIGIs. | ✓ |
| /search | Perform a text-based search for instruments. | ✗ |
| /filter | Search for instruments using specific criteria. | ✗ |
Mapping Endpoint
Convert third-party identifiers to FIGIs:
use OpenFIGIClient;
use ;
use MappingRequest;
async
Search Endpoint
Text-based instrument search:
use OpenFIGIClient;
use Currency;
async
Filter Endpoint
Filter instruments by criteria:
use OpenFIGIClient;
use SecurityType;
async
🚨 Error Handling
The library provides a comprehensive OpenFIGIError enum. A common task is handling responses in a bulk request where some jobs may succeed and others may fail.
The API returns a 200 OK with a body containing either a data array or an error message for each job.
use OpenFIGIClient;
use OpenFIGIError;
use ;
async
📖 Documentation
- API Documentation - Complete technical documentation for this crate.
- OpenFIGI API Documentation - The upstream API documentation from OpenFIGI.
🤝 Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines on how to submit patches, report issues, and suggest features.
📄 License
This project is licensed under the MIT License. See the LICENSE file for details.
🙏 Acknowledgments
- OpenFIGI for providing the public API.
- Bloomberg for the OpenFIGI initiative.
- OMG for providing documentation.
- The Rust community for creating amazing libraries like
reqwest,reqwest-middleware,serde, andtokio.
📞 Support
For help with this library, please use the following resources:
- 📚 Documentation: Check the API reference for detailed information.
- 🐛 Issues: For bugs and feature requests, please use the GitHub Issue Tracker.
- 💬 Discussions: For questions and general discussion, please use the GitHub Discussions.
Disclaimer: This library is an independent project and is not officially affiliated with, endorsed by, or sponsored by Bloomberg L.P. or the OpenFIGI project.