OfxRateProviderOptions Class
Definition
- Namespace
- Bodu.Financial.ExchangeRates
- Assembly
- Bodu.Financial.ExchangeRates.Ofx.dll
- Package
- Bodu.Financial.ExchangeRates.Ofx 0.7.1
Configures how the OfxRateProvider addresses and interprets the OFX public spot-rate-history REST service.
public sealed class OfxRateProviderOptions : WebRateProviderOptions
- Inheritance
-
OfxRateProviderOptions
- 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 OFX-specific: the HistoryPath template into which the currency codes
and the requested inclusive date range (as Unix-millisecond bounds) are substituted, the requested decimal
precision, and the reporting interval sent as the ReportingInterval query parameter. The response is
additionally range-filtered to the requested dates as a defensive measure.
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
OfxRateProviderOptions()
Initializes a new instance of the OfxRateProviderOptions class with the OFX API host as its base address and a deliberately unbounded history declaration.
public OfxRateProviderOptions()
Remarks
OFX publishes multi-decade spot-rate history ("20+ years") but no fixed inception date, so the advertised HistoryAvailability is deliberately Unbounded - there is no known floor worth pre-empting a request for. Set the property when a concrete floor matters for the pairs in use.
Properties
DecimalPlaces
Gets or sets the number of decimal places requested from the OFX endpoint.
public int DecimalPlaces { get; set; }
Property Value
- int
The requested decimal precision; defaults to 6.
FutureClampSkew
Gets or sets the safety margin subtracted from the current instant when capping a request's end bound, guarding against an endpoint clock that trails UTC.
public TimeSpan FutureClampSkew { get; set; }
Property Value
Remarks
The OFX endpoint rejects a ToDate that lies in its future, so the provider never requests beyond the
present. The end bound is capped at the current instant less this margin; the default of
Zero keeps maximum recency, and a small positive value compensates for an endpoint clock
observed to sit behind UTC.
HistoryPath
Gets or sets the relative spot-rate-history path template. The {from}, {to}, {start}, and
{end} placeholders are replaced by the currency codes and the inclusive request range (as
Unix-millisecond bounds) before the request is issued.
public string HistoryPath { get; set; }
Property Value
- string
The history path template; defaults to
PublicSite.ApiService/SpotRateHistory/{from}/{to}/{start}/{end}.
ReportingInterval
Gets or sets the reporting interval requested from the OFX endpoint, substituted into HistoryPath
and sent as the ReportingInterval query parameter.
public string ReportingInterval { get; set; }
Property Value
- string
The reporting interval; defaults to
daily.
Methods
TryValidateCore(out string?)
Validates the OFX-specific options, ensuring the history path carries its placeholders, the decimal precision is in range, the reporting interval is specified, and the future-clamp margin is non-negative.
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 |