Table of Contents

XeRateProviderOptions Class

Definition

Namespace
Bodu.Financial.ExchangeRates
Assembly
Bodu.Financial.ExchangeRates.Xe.dll
Package
Bodu.Financial.ExchangeRates.Xe 0.7.1 (not published on nuget.org)
Source
XeRateProviderOptions.cs

Configures how the XeRateProvider addresses and interprets the XE.com charting-rates JSON service, and how it acquires the authorization token that endpoint requires.

public sealed class XeRateProviderOptions : WebRateProviderOptions
Inheritance
XeRateProviderOptions
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 XE-specific: the ChartingRatesPath queried for a pair, and the two URLs (AuthBootstrapUrl and AuthScriptBaseUrl) used to discover the Authorization: Basic token by scanning the script chunks the XE website publishes. XE serves a server-determined window per request rather than honouring an explicit date range, so the response is range-filtered to the requested dates.

Every member carries a working default, so the options bind cleanly through Microsoft.Extensions.Options and require no configuration for the common case. The dependency-injection package binds this type from configuration and a configure delegate.

Constructors

XeRateProviderOptions()

Initializes a new instance of the XeRateProviderOptions class with the XE.com host as its base address and an estimated ten-year rolling history window.

public XeRateProviderOptions()

Remarks

The charting endpoint accepts no date bounds - XE returns a server-determined window - so the advertised HistoryAvailability is an estimate of that window (Bodu.Financial.ExchangeRates.XeRateProviderOptions.EstimatedChartingWindowDays days, matching the deepest range the XE currency charts expose) rather than a published contract. Adjust the property if the observed window differs.

Properties

AuthBootstrapUrl

Gets or sets the page URL whose referenced script chunks are scanned to discover the authorization token. The chunk references it carries are resolved against this URL's origin.

public Uri AuthBootstrapUrl { get; set; }

Property Value

Uri

The bootstrap page URL; defaults to https://www.xe.com/currencycharts.

AuthScriptBaseUrl

Gets or sets the base URL against which lazily-loaded script chunk names, reconstructed from the webpack runtime chunk's identifier-to-hash map, are resolved when no bootstrap-referenced chunk yields the token. Must end with a trailing slash so relative static/chunks/… names resolve under it.

public Uri AuthScriptBaseUrl { get; set; }

Property Value

Uri

The script base URL; defaults to https://www.xe.com/_next/.

ChartingRatesPath

Gets or sets the relative charting-rates endpoint path. The source-currency and destination-currency codes are supplied as the fromCurrency and toCurrency query parameters when the request is issued.

public string ChartingRatesPath { get; set; }

Property Value

string

The charting-rates path; defaults to api/protected/charting-rates/.

Methods

TryValidateCore(out string?)

Validates the XE-specific options, ensuring the charting-rates path and the two token-acquisition URLs are specified.

protected override bool TryValidateCore(out string? error)

Parameters

error string

When this method returns false, a message describing the violated invariant; otherwise null.

Returns

bool

true when every XE-specific invariant holds; otherwise false.

Applies to

ProductVersions
.NET8, 10