FredRateProviderOptions Class
Definition
- Namespace
- Bodu.Financial.ExchangeRates
- Assembly
- Bodu.Financial.ExchangeRates.Fred.dll
- Package
- Bodu.Financial.ExchangeRates.Fred 0.7.1
Configures how the FredRateProvider addresses and interprets the FRED (Federal Reserve Bank of St. Louis) foreign-exchange REST service.
public sealed class FredRateProviderOptions : WebRateProviderOptions
- Inheritance
-
FredRateProviderOptions
- Inherited Members
- Extension Methods
Remarks
This type derives from WebRateProviderOptions, which supplies the endpoint base address, the HTTP
contract, the synchronous-access and look-back behaviour, the currency-alias map, and the per-concern log levels.
The members declared here are FRED-specific: the required ApiKey presented as the api_key
query parameter, the ObservationsPath template, and the SeriesMap that maps each
currency pair to a single FRED series identifier.
FRED publishes each foreign-exchange rate as an independent time series quoted in a fixed direction (for example
DEXUSEU quotes US dollars per euro, that is EUR/USD). SeriesMap is keyed FROM/TO
in the exact direction the FRED series is quoted, so no inversion is required; the reverse direction is served by
the base class's inverse-lookup fallback. A pair with no mapped series yields no data rather than a fetch. Every
member other than ApiKey carries a working default, so the options bind cleanly through
Microsoft.Extensions.Options; the dependency-injection package binds this type from configuration and a
configure delegate.
Constructors
FredRateProviderOptions()
Initializes a new instance of the FredRateProviderOptions class with the FRED host as its base address, an unbounded history window, and the built-in currency-pair series map seeded.
public FredRateProviderOptions()
Properties
ApiKey
Gets or sets the FRED API key presented as the api_key query parameter on every request.
public string ApiKey { get; set; }
Property Value
- string
The API key. There is no default; a value is required.
ObservationsPath
Gets or sets the relative series-observations endpoint path used to fetch a series' observations.
public string ObservationsPath { get; set; }
Property Value
- string
The observations path; defaults to
series/observations.
SeriesMap
Gets or sets the map from currency pair to FRED series identifier.
public IDictionary<string, string> SeriesMap { get; set; }
Property Value
- IDictionary<string, string>
A dictionary keyed
FROM/TOin the direction the FRED series is quoted, seeded with the built-in defaults.
Remarks
Add or replace entries to support additional pairs. Each key is the pair's FROM/TO ISO codes in the exact
direction the FRED series is quoted; the reverse direction is served by the base class's inverse-lookup
fallback.
Methods
TryValidateCore(out string?)
Validates the FRED-specific options, ensuring the API key, observations path, and series map are usable.
protected override bool TryValidateCore(out string? error)
Parameters
errorstringWhen this method returns false, a message describing the violated invariant; otherwise null.
Returns
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |