Table of Contents

DatedRateProviderAdapter Class

Definition

Namespace
Bodu.Financial.ExchangeRates
Assembly
Bodu.Financial.dll
Package
Bodu.Financial 1.0.0
Source
DatedRateProviderAdapter.cs

Adapts an IDatedRateProvider to the simpler timeless IRateProvider surface by pinning a fixed valuation date and lookup options.

public sealed class DatedRateProviderAdapter : IRateProvider
Inheritance
DatedRateProviderAdapter
Implements
Inherited Members
Extension Methods

Remarks

Use this adapter when an existing consumer already accepts IRateProvider but the rates should nevertheless come from a date-aware source - for example, a fixed reporting-period end-date used to convert many amounts consistently throughout a single accounting workflow.

Constructors

DatedRateProviderAdapter(IDatedRateProvider, DateOnly, RateLookupOptions?)

Initializes a new instance of the DatedRateProviderAdapter class.

public DatedRateProviderAdapter(IDatedRateProvider inner, DateOnly date, RateLookupOptions? options = null)

Parameters

inner IDatedRateProvider

The underlying dated provider to delegate to.

date DateOnly

The valuation date pinned to every lookup.

options RateLookupOptions

The lookup options pinned to every lookup. null is treated as Exact.

Exceptions

ArgumentNullException

Thrown if inner is null.

ArgumentOutOfRangeException

Thrown if options contains an undefined enum value or a negative tolerance.

ArgumentException

Thrown if options specifies Exact with a non-zero tolerance.

Methods

GetRate(string, string)

Returns the exchange rate that converts one unit of fromIsoCode to units of toIsoCode.

public decimal GetRate(string fromIsoCode, string toIsoCode)

Parameters

fromIsoCode string

The source currency's ISO 4217 code.

toIsoCode string

The destination currency's ISO 4217 code.

Returns

decimal

The rate.

Exceptions

KeyNotFoundException

No rate is available for the requested pair.

Applies to

ProductVersions
.NET8, 10