Expand description
§OpenFIGI Rust Client
A high-performance 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.
§Quick Start
§Basic Usage
use openfigi_rs::client::OpenFIGIClient;
use openfigi_rs::model::enums::IdType;
use serde_json::json;
// Create a client (uses OPENFIGI_API_KEY env var if available)
let client = OpenFIGIClient::new();
// Map an ISIN to FIGI
let mapping_results = client
.mapping(IdType::IdIsin, json!("US4592001014"))
.send()
.await?;
// Access the FIGI from the first result
if let Some(data) = mapping_results[0].data() {
println!("FIGI: {}", data[0].figi);
}
§With API Key
use openfigi_rs::client::OpenFIGIClient;
// Explicit API key configuration
let client = OpenFIGIClient::builder()
.api_key("your-api-key")
.build()?;
§Custom HTTP Configuration
use openfigi_rs::client::OpenFIGIClient;
use reqwest_middleware::ClientBuilder;
use reqwest_retry::{RetryTransientMiddleware, policies::ExponentialBackoff};
use std::time::Duration;
// Configure HTTP client with retry middleware
let http_client = reqwest::Client::builder()
.timeout(Duration::from_secs(30))
.build()?;
let retry_policy = ExponentialBackoff::builder().build_with_max_retries(3);
let middleware_client = ClientBuilder::new(http_client)
.with(RetryTransientMiddleware::new_with_policy(retry_policy))
.build();
let client = OpenFIGIClient::builder()
.middleware_client(middleware_client)
.api_key("your-api-key")
.build()?;
§Authentication & Rate Limits
- Without API key: 25 requests per minute, max 5 requests per batch
- With API key: 25 requests per 6 seconds, max 100 requests per batch
- API key: Set via
OPENFIGI_API_KEY
environment variable or explicit configuration
§API Endpoints
Endpoint | Purpose | Batch Support |
---|---|---|
/mapping | Map identifiers to FIGIs | ✓ |
/search | Search instruments by text | ✗ |
/filter | Filter instruments by criteria | ✗ |
§Features
- Type-safe API: Strongly typed request/response models with validation
- Async/await: Built on
reqwest
with full async support and connection pooling - Middleware support: Extensible HTTP middleware for retries, logging, and observability
- Comprehensive error handling: Detailed error types with OpenFIGI-specific context
- Rate limit awareness: Automatic rate limit detection and informative error messages
- Environment integration: Automatic API key detection from environment variables
- Production ready: Connection pooling, timeouts, and efficient resource management
Modules§
- client
- HTTP client for OpenFIGI API operations HTTP client for interacting with the OpenFIGI API.
- client_
builder - Client builder with fluent configuration API for custom HTTP settings Builder pattern for configuring OpenFIGI API clients.
- endpoint
- API endpoint implementations for mapping, search, and filter operations
- error
- Comprehensive error types with OpenFIGI-specific context and inspection methods Error handling types for OpenFIGI API operations.
- model
- Strongly typed request and response data models for all API operations Data models for OpenFIGI API requests and responses.
Constants§
- DEFAULT_
ENDPOINT_ FILTER - The default endpoint path for filter requests.
- DEFAULT_
ENDPOINT_ MAPPING - The default endpoint path for mapping requests.
- DEFAULT_
ENDPOINT_ SEARCH - The default endpoint path for search requests.
- VERSION
- Library version
Statics§
- DEFAULT_
BASE_ URL - The default base URL for the OpenFIGI API v3.