libfmp 0.1.1

Async, typed Rust client for the Financial Modeling Prep API
Documentation

libfmp

libfmp is an async, typed Rust client for the Financial Modeling Prep (FMP) data API.

Version 0.1 is deliberately a small walking skeleton. It supports only the documented GET /stable/quote-short?symbol=... endpoint and does not claim broad endpoint coverage.

use std::env;

use libfmp::{Client, config::Authentication, types::Ticker};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::builder()
        .authentication(Authentication::fmp_header(env::var("FMP_API_KEY")?))
        .build()?;
    let rows = client.quote_short(Ticker::new("AAPL")?).await?;
    println!("{rows:#?}");
    Ok(())
}

The documented bare JSON array remains a Vec<QuoteShort>; empty and multi-row responses keep their original shape.

Custom router or proxy

Transport choices do not change endpoint code. A caller can select a custom base URL and path prefix, no auth, FMP header or query auth, bearer auth, custom secret header or query auth, and arbitrary default headers.

use std::env;

use libfmp::{Client, config::Authentication, types::Ticker};

# async fn example() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::builder()
    .base_url(env::var("FMP_PROXY_BASE_URL")?)
    .path_prefix("router/stable")
    .authentication(Authentication::custom_header(
        "X-Proxy-Token",
        Some("Bearer ".to_owned()),
        env::var("FMP_PROXY_TOKEN")?,
    ))
    .default_header("X-Tenant", env::var("FMP_TENANT")?)
    .build()?;
let rows = client.quote_short(Ticker::new("AAPL")?).await?;
# let _ = rows;
# Ok(())
# }

Rust 1.96 or newer is supported. The repository pins Rust 1.96.0 for development and release validation. This project is available under the MIT License.