Expand description
ferric-fred — a strongly-typed async Rust client for the FRED API
(Federal Reserve Economic Data, from the Federal Reserve Bank of St. Louis).
The client covers all of FRED’s read endpoints — series, observations,
search, categories, releases, sources, tags, and the release table tree —
behind ergonomic async builders, with newtype identifiers, typed enums for
FRED’s closed value sets, and a typed Error taxonomy that never panics on
a network or parse failure. Paginated endpoints can be walked to exhaustion
with Paginate::send_all or streamed lazily with Paginate::stream. See
the design ADRs under docs/adr/ for the decisions that shape the API.
§Feature flags
schemars(off by default) — deriveschemars::JsonSchemaon the public return types, so a consumer (the bundled MCP server, say) can advertise the exact shape an endpoint returns. Additive; plain consumers pay nothing. See ADR-0023.
use ferric_fred::{Client, Paginate, SeriesId};
let client = Client::from_env()?; // reads FRED_API_KEY
// One series' observations:
let observations = client.observations(&SeriesId::new("GNPCA")).send().await?;
println!("{} observations", observations.len());
// Search, paged to exhaustion (or `.stream()` for lazy iteration):
let matches = client.search("unemployment rate").send_all().await?;
println!("{} matching series", matches.len());Structs§
- Category
- A node in the FRED category tree (the
fred/categoryandfred/category/childrenendpoints). - Category
Id - A FRED category identifier — a numeric node in the category tree (the root is
CategoryId::ROOT, id0). - Client
- An async client for the FRED API.
- Observation
- A single observation in a FRED series: a calendar date, its value, and the real-time period that value was current for (ALFRED — ADR-0024).
- Observations
Request - A builder for an observations request, returned by
Client::observations. - Release
- A FRED data release — a publication such as “Gross Domestic Product”, from
the
fred/releaseandfred/releasesendpoints. - Release
Date - A single scheduled or historical release date, from the
fred/releases/datesandfred/release/datesendpoints — the date a release was (or is scheduled to be) published. - Release
Dates Request - A builder for the release-date endpoints, returned by
Client::releases_dates(fred/releases/dates, the publication dates of every release) andClient::release_dates(fred/release/dates, the dates of one release). Both share optional sort, paging, and the “include dates with no data” toggle and returnReleaseDatesResults;release_datesadditionally carries therelease_id. Finish withsend. - Release
Dates Results - A page of release dates with pagination metadata, shared by the
fred/releases/datesandfred/release/datesendpoints. - Release
Element Id - A FRED release-table element identifier — the numeric id of a node in a
release’s table tree (a section, table, or series row; see
fred/release/tables). - Release
Id - A FRED release identifier — the numeric id of a data release (a publication such as “Gross Domestic Product”).
- Release
Table - A release’s table tree, from the
fred/release/tablesendpoint — the layout a release uses to present its series (sections and tables, with series rows nested beneath them). - Release
Table Element - A node in a release’s table tree: a section, a table, or a series row. Nodes
nest via
childrento arbitrary depth. - Release
Tables Request - A builder for a
release/tablesrequest, returned byClient::release_tables. Fetches a release’s table tree — the whole tree by default, or the subtree rooted at one element viaelement. Finish withsend. - Releases
Request - A builder for the release-listing endpoints, returned by
Client::releases(fred/releases, all data releases) andClient::source_releases(fred/source/releases, the releases of one source). Both share optional sort and paging and returnReleasesResults;source_releasesadditionally carries thesource_id. Finish withsend. - Releases
Results - A page of releases with pagination metadata, from the
fred/releasesendpoint. - Series
- Metadata describing a FRED series (the
fred/seriesendpoint). - Series
Id - A FRED series identifier, e.g.
GNPCAorUNRATE. - Series
List Request - A builder for the FRED endpoints that return a page of series filtered by a
single facet:
category/series,release/series, andtags/series. They share the same optional ordering and paging and all returnSeriesSearchResults; they differ only in the endpoint path and the one facet parameter (category_id/release_id/tag_names). - Series
Search Request - A builder for a
series/searchrequest, returned byClient::search. - Series
Search Results - A page of
series/searchresults: the matching series plus FRED’s pagination metadata.countis the total number of matches across all pages, not just this one — use it withoffset/limitto page. - Series
Updates Request - A builder for a
series/updatesrequest, returned byClient::series_updates. Lists the series updated most recently (ordered by last-updated time), optionally narrowed to a class of series. Finish withsend. - Source
- A FRED data source — the organization that produces releases (e.g. the
Bureau of Economic Analysis), from the
fred/sourceandfred/sourcesendpoints. - Source
Id - A FRED source identifier — the numeric id of a data source (the organization that produces a release, e.g. the Bureau of Economic Analysis).
- Sources
Request - A builder for a
sourcesrequest, returned byClient::sources. Lists all FRED data sources, with optional sort and paging. Finish withsend. - Sources
Results - A page of sources with pagination metadata, from the
fred/sourcesendpoint. - Tag
- A FRED tag — a keyword used to classify series (e.g.
gdp,quarterly,nsa), from thefred/tags,fred/series/tags, and related endpoints. - Tags
Request - A builder for the tag-listing endpoints — the whole-vocabulary pair
Client::tags(fred/tags) /Client::related_tags(fred/related_tags), and the scoped variants that list the tags of one category, release, or series search:Client::category_tags,Client::category_related_tags,Client::release_tags,Client::release_related_tags,Client::series_search_tags, andClient::series_search_related_tags. - Tags
Results - A page of tags with pagination metadata, from the
fred/tagsandfred/series/tagsendpoints. - Vintage
Dates - The vintage dates of a series with pagination metadata, from the
fred/series/vintagedatesendpoint. - Vintage
Dates Request - A builder for a
series/vintagedatesrequest, returned byClient::series_vintagedates. Lists the dates on which a series was revised or newly released, with optional sort and paging. Finish withsend.
Enums§
- Aggregation
Method - How observations are aggregated when down-sampling to a lower
frequency(theaggregation_methodrequest parameter). Only meaningful alongsideObservationsRequest::frequency. - Error
- Errors returned by the
ferric-fredclient. - Frequency
- The native reporting frequency of a FRED series.
- OrderBy
- Field to order
series/searchresults by (theorder_byrequest parameter). Request-only, so it carriesquery_codeand is#[non_exhaustive]but has noOthervariant. - Search
Type - How
series/searchinterprets the search text (thesearch_typerequest parameter). - Seasonal
Adjustment - Whether, and how, a FRED series is seasonally adjusted.
- Sort
Order - Sort order for returned observations, by observation date (the
sort_orderrequest parameter). - Units
- A units transformation FRED applies to a series’ observations before
returning them (the
unitsrequest parameter). - Updates
Filter - Which series
series/updatesreturns, by FRED’sfilter_valueparameter.
Traits§
- Page
- One page of results from a paginated FRED endpoint.
- Paginate
- A request builder for a paginated FRED endpoint.