Bodu.Financial.ExchangeRates.Fred 0.7.1

dotnet add package Bodu.Financial.ExchangeRates.Fred --version 0.7.1
                    
NuGet\Install-Package Bodu.Financial.ExchangeRates.Fred -Version 0.7.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bodu.Financial.ExchangeRates.Fred" Version="0.7.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bodu.Financial.ExchangeRates.Fred" Version="0.7.1" />
                    
Directory.Packages.props
<PackageReference Include="Bodu.Financial.ExchangeRates.Fred" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Bodu.Financial.ExchangeRates.Fred --version 0.7.1
                    
#r "nuget: Bodu.Financial.ExchangeRates.Fred, 0.7.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Bodu.Financial.ExchangeRates.Fred@0.7.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Bodu.Financial.ExchangeRates.Fred&version=0.7.1
                    
Install as a Cake Addin
#tool nuget:?package=Bodu.Financial.ExchangeRates.Fred&version=0.7.1
                    
Install as a Cake Tool

Bodu.Financial.ExchangeRates.Fred

API stability — Preview. The public API surface is largely settled but is still being finalized ahead of the 1.0 release and may change; breaking changes can land in a minor version until then.

A Bodu.Financial exchange-rate provider backed by FRED (Federal Reserve Bank of St. Louis), served through its foreign-exchange REST series.

It resolves each currency pair to a single FRED series identifier, fetches that series' observations, parses the JSON response, and serves the results as Bodu.Financial.ExchangeRates.ExchangeRate values through the standard IDatedRateProvider and IRateProvider contracts — so it composes with Money.ConvertTo, the caching and aggregating providers, and the rest of the Bodu.Financial FX stack. The same interfaces and DI shape as every other provider, a different data source.

using Bodu.Financial.ExchangeRates;

// The provider builds and owns its HttpClient from the options; dispose it to release the client.
using var provider = new FredRateProvider(new FredRateProviderOptions { ApiKey = "…" });

// Warm a pair for a range (recommended), then look rates up synchronously.
await provider.LoadPairAsync("EUR", "USD", new DateOnly(2023, 1, 1), new DateOnly(2023, 6, 30));

RateLookupResult usd = provider.GetRate("EUR", "USD", new DateOnly(2023, 1, 3));

Behaviour

  • Per-series mapping. FRED publishes each foreign-exchange rate as an independent time series quoted in a fixed direction — for example DEXUSEU quotes US dollars per euro (EUR/USD). The SeriesMap on the options maps each currency pair to its FRED series id, keyed FROM/TO in the exact direction the series is quoted, so no inversion is required.
  • Unmapped pairs. A pair with no entry in SeriesMap returns no data — without issuing a request. The reverse direction of a mapped pair is served by the base class's inverse-lookup fallback. To support additional pairs, add mappings via SeriesMap.
  • Built-in defaults. The options seed a table of common USD pairs (EUR/USD, GBP/USD, AUD/USD, NZD/USD, USD/CAD, USD/JPY, USD/CHF, USD/CNY, USD/MXN, USD/INR, USD/SEK, USD/NOK, USD/DKK, USD/ZAR, USD/BRL, USD/KRW, USD/HKD, USD/SGD, USD/TWD).
  • Missing observations. FRED encodes a day with no published value as the string "."; those observations are skipped.
  • API key required. Set ApiKey; it is presented as the api_key query parameter.
  • No provider-local disk cache. For durable caching, compose with AddCachedRateProvider<…> from the Bodu.Financial.ExchangeRates.Caching package.

Endpoint configuration

Option Default Purpose
ApiKey (required) The FRED API key, sent as api_key.
BaseAddress https://api.stlouisfed.org/fred/ The API host.
ObservationsPath series/observations The series-observations endpoint.
SeriesMap built-in USD pairs Maps each FROM/TO pair to a FRED series id.
HttpTimeout 30 s Applied to the HttpClient the provider creates, or by the DI registration.
AllowSynchronousNetworkAccess false Opt in to blocking on-demand fetches from synchronous lookups.
DefaultLookback 7 days The window fetched around a date for on-demand and latest-rate lookups.
CurrencyAliases empty Maps ISO codes to symbol components where they differ.

Dependency injection

The package ships its own AddFredExchangeRates registration in the Bodu.Financial.ExchangeRates namespace — there is no separate *.DependencyInjection package.

services
    .AddFinancialService(configuration)
    .AddFredExchangeRates(configuration, configure: o => o.ApiKey = "…");

Part of the Bodu utility library.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.7.1 87 9/24/2026
0.7.0 406 9/24/2026