ImfRateProviderOptions Class
Definition
- Namespace
- Bodu.Financial.ExchangeRates
- Assembly
- Bodu.Financial.ExchangeRates.Imf.dll
- Package
- Bodu.Financial.ExchangeRates.Imf 0.7.2
Configures how the ImfRateProvider addresses, caches, and interprets the IMF Representative Exchange Rates monthly report.
public sealed class ImfRateProviderOptions : WebRateProviderOptions
- Inheritance
-
ImfRateProviderOptions
- Inherited Members
- Extension Methods
Remarks
This type derives from WebRateProviderOptions, which supplies the endpoint base address, the HTTP contract, the synchronous-access, look-back and refresh behavior, and the per-concern log levels. The members declared here are report-specific: the ReportPath and ReportType that address the monthly report, the on-disk cache settings, and the CurrencyNames map that resolves an IMF currency label to its ISO 4217 code. The report is keyless, so no API key is required.
Refresh. The inherited RefreshInterval governs both the in-memory months and the on-disk cache. A report cached after its month closed is immutable and is served from cache regardless of age; a report cached while its month was still growing is subject to the interval, even once the month has closed. In memory, a loaded month serves for good a request that ends before the day it was downloaded, or on a day it returned rates for; a request that reaches a later day of the month downloads the month again once the interval has passed.
USD-anchored, bulk. The report quotes every reported currency against the US dollar for each
business day of the month, so a single download warms the store for all currencies and all business days at once.
Only USD/X and X/USD pairs are serviceable; the reverse direction is served by the base inverse-lookup
fallback. Every member carries a working default, so the options bind cleanly through
Microsoft.Extensions.Options.
Constructors
ImfRateProviderOptions()
Initializes a new instance of the ImfRateProviderOptions class with the IMF report host as its base address, an unbounded history depth, and the default currency-name map.
public ImfRateProviderOptions()
Properties
CacheDirectory
Gets or sets the directory used by the on-disk cache.
public string? CacheDirectory { get; set; }
Property Value
CurrencyNames
Gets or sets the map from an IMF currency label (footnote-stripped and trimmed) to its ISO 4217 code, applied while normalizing a report row.
public IDictionary<string, string> CurrencyNames { get; set; }
Property Value
- IDictionary<string, string>
The currency-name map; seeded in the constructor with the currencies the report commonly quotes.
Remarks
A label absent from this map is resolved directly against the ISO 4217 catalog, and a label that resolves neither way is skipped. Extend the map to add labels the IMF publishes that are not seeded here.
EnableDiskCache
Gets or sets a value indicating whether downloaded report files are persisted to an on-disk cache.
public bool EnableDiskCache { get; set; }
Property Value
ReportPath
Gets or sets the relative report resource path appended to the base address.
public string ReportPath { get; set; }
Property Value
- string
The report path; defaults to
rms_mth.aspx.
ReportType
Gets or sets the report-type selector supplied to the endpoint.
public string ReportType { get; set; }
Property Value
- string
The report type; defaults to
REP(representative rates).
Methods
TryValidateCore(out string?)
Validates the report-specific options, ensuring the report path, report type, and currency-name 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 |