Table of Contents

RateAggregationOptions Class

Definition

Namespace
Bodu.Financial.ExchangeRates.Caching
Assembly
Bodu.Financial.ExchangeRates.Caching.dll
Package
Bodu.Financial.ExchangeRates.Caching 1.0.0
Source
RateAggregationOptions.cs

Configures an AggregatingRateProvider: the default combination strategy, the default child order, and per-currency-pair routing overrides.

public sealed class RateAggregationOptions
Inheritance
RateAggregationOptions
Inherited Members
Extension Methods

Examples

var options = new RateAggregationOptions();
options.Routes[new CurrencyPair(CurrencyCode.AUD, CurrencyCode.USD)] = new CurrencyPairRoute(new[] { "RBA", "ECB" });
options.Routes[new CurrencyPair(CurrencyCode.USD, CurrencyCode.GBP)] = new CurrencyPairRoute(new[] { "ECB", "RBA" });
options.Routes[new CurrencyPair(CurrencyCode.EUR, CurrencyCode.USD)] = new CurrencyPairRoute(new[] { "ECB", "RBA" }, new AverageStrategy());

Remarks

Every member carries a working default, so the options bind cleanly through Microsoft.Extensions.Options. Referenced child names are validated against the aggregator's actual children when the aggregator is constructed.

Constructors

RateAggregationOptions()

public RateAggregationOptions()

Properties

DefaultLookupOptions

Gets or sets the lookup options applied by the timeless GetRate(string, string) surface, which resolves the rate for the current UTC date.

public RateLookupOptions DefaultLookupOptions { get; set; }

Property Value

RateLookupOptions

The lookup options used for timeless lookups; defaults to Exact.

DefaultProviderOrder

Gets or sets the default order of child names consulted for pairs without a route.

public IReadOnlyList<string>? DefaultProviderOrder { get; set; }

Property Value

IReadOnlyList<string>

The ordered child names, or null to consult every child in the order supplied to the aggregator.

DefaultStrategy

Gets or sets the strategy used when a pair has no route-specific strategy.

public IRateAggregationStrategy DefaultStrategy { get; set; }

Property Value

IRateAggregationStrategy

The default strategy; defaults to Instance.

ResolvedLogLevel

Gets or sets the level at which a successfully aggregated lookup is logged.

public LogLevel ResolvedLogLevel { get; set; }

Property Value

LogLevel

The log level; defaults to Information.

RespectHistoryAvailability

Gets or sets a value indicating whether the aggregator consults each child's advertised RateHistoryAvailability and drops candidates that have declared they cannot serve any part of the requested date or window, before the strategy runs.

public bool RespectHistoryAvailability { get; set; }

Property Value

bool

true to respect the advertised history; defaults to true.

Remarks

The filter applies only to children that implement IHistoricalRateProvider; a non-aware child is treated as unbounded and always kept. A range keeps any child whose advertised history overlaps the window at all, since strategies already tolerate partial data. When every candidate is filtered out, the lookup reports the same miss it reports when every candidate fails. Disable this to offer every routed candidate to the strategy unchanged.

RouteSelectedLogLevel

Gets or sets the level at which the selected route is logged.

public LogLevel RouteSelectedLogLevel { get; set; }

Property Value

LogLevel

The log level; defaults to Information.

Routes

Gets the per-currency-pair routing overrides.

public IDictionary<CurrencyPair, CurrencyPairRoute> Routes { get; }

Property Value

IDictionary<CurrencyPair, CurrencyPairRoute>

A map from currency pair to the route that resolves it.

UnresolvedLogLevel

Gets or sets the level at which a lookup that no candidate could satisfy is logged.

public LogLevel UnresolvedLogLevel { get; set; }

Property Value

LogLevel

The log level; defaults to Debug.

Methods

Validate()

Validates the structural option values, throwing when a rule is violated.

public void Validate()

Exceptions

ArgumentNullException

Thrown when DefaultStrategy is null.

ArgumentException

Thrown when a route is keyed by an invalid currency pair, a route value is null, or a name in DefaultProviderOrder is blank.

Applies to

ProductVersions
.NET8, 10