Skip to content

aktagon/fred-api-rs

Repository files navigation

fred-api-rs

Rust client for the FRED API — economic time series from the Federal Reserve. Async, typed, JSON only.

About FRED

FRED is a database of economic time series maintained by the Federal Reserve Bank of St. Louis. Thousands of series from national, international, public, and private sources.

Official API documentation

What it covers

Categories, series, observations, releases, sources, tags, search, and GeoFRED (regional data).

Install

Add this to your Cargo.toml:

[dependencies]
fred-api-client = "1.0.0"

Or install using cargo:

cargo add fred-api-client

Quick Start

Get a FRED API key, then:

use fred_api_client::{apis::default_api, apis::configuration::Configuration};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config = Configuration {
        base_path: "https://api.stlouisfed.org".to_string(),
        ..Default::default()
    };

    // Get GDP series data
    let response = default_api::fred_series_get(
        &config,
        "your_api_key_here",
        "GDP",
        Some("json"),
        None,
        None,
    ).await?;

    println!("GDP Series Info: {}", response);
    Ok(())
}

API coverage

Endpoint What you get
Categories Browse and search category trees, list series in a category
Series Observations, metadata, vintage dates, text/tag search
Releases Release schedules, sources, related series
Sources Data source metadata and their releases
Tags Filter and browse by tag, find related tags
GeoFRED Regional economic data and shape files

Documentation

Examples

Check out the examples/ directory for more usage examples:

cargo run --example basic_usage
cargo run --example series_observations
cargo run --example category_search

Support

License

MIT. This is an unofficial client. FRED is a registered trademark of the Federal Reserve Bank of St. Louis.

About

Rust client for the FRED API — economic time series from the Federal Reserve

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages