RateLookupResult Struct
Definition
- Namespace
- Bodu.Financial.ExchangeRates
- Assembly
- Bodu.Financial.dll
- Package
- Bodu.Financial 1.0.0
- Source
- RateLookupResult.cs
Represents the outcome of a successful exchange-rate lookup, carrying both the resolved rate and the metadata that describes how it was selected.
public readonly struct RateLookupResult : IEquatable<RateLookupResult>
- Implements
- Inherited Members
- Extension Methods
Remarks
Returning this metadata alongside the rate gives the caller everything required to explain which observed value was selected (provider, date, inversion direction, distance from the requested date, and policy applied) without having to re-query the underlying table.
Provenance is always populated. A rate resolved directly by a provider carries Live with a null Backend, CachedAtUtc, and Age. A rate served from a cache carries Cache with the serving backend, the instant the served data was cached, and the age it had at the lookup instant.
Constructors
RateLookupResult(ExchangeRate, DateOnly, RateDateResolution, int, RateProvenance)
Represents the outcome of a successful exchange-rate lookup, carrying both the resolved rate and the metadata that describes how it was selected.
public RateLookupResult(ExchangeRate Rate, DateOnly RequestedDate, RateDateResolution Resolution, int OffsetDays, RateProvenance Provenance)
Parameters
RateExchangeRateThe resolved exchange rate, including its source provider and inversion flag.
RequestedDateDateOnlyThe calendar date the caller originally requested.
ResolutionRateDateResolutionThe fallback policy that was applied during the lookup.
OffsetDaysintThe absolute distance, in days, between RequestedDate and the date carried by Rate.
ProvenanceRateProvenanceThe lineage of the resolved rate: where it came from and, for a cache serve, how old it is.
Remarks
Returning this metadata alongside the rate gives the caller everything required to explain which observed value was selected (provider, date, inversion direction, distance from the requested date, and policy applied) without having to re-query the underlying table.
Provenance is always populated. A rate resolved directly by a provider carries Live with a null Backend, CachedAtUtc, and Age. A rate served from a cache carries Cache with the serving backend, the instant the served data was cached, and the age it had at the lookup instant.
Properties
OffsetDays
The absolute distance, in days, between RequestedDate and the date carried by Rate.
public int OffsetDays { get; init; }
Property Value
Provenance
The lineage of the resolved rate: where it came from and, for a cache serve, how old it is.
public RateProvenance Provenance { get; init; }
Property Value
Rate
The resolved exchange rate, including its source provider and inversion flag.
public ExchangeRate Rate { get; init; }
Property Value
RequestedDate
The calendar date the caller originally requested.
public DateOnly RequestedDate { get; init; }
Property Value
Resolution
The fallback policy that was applied during the lookup.
public RateDateResolution Resolution { get; init; }
Property Value
Methods
Deconstruct(out ExchangeRate, out DateOnly, out RateDateResolution, out int, out RateProvenance)
public void Deconstruct(out ExchangeRate Rate, out DateOnly RequestedDate, out RateDateResolution Resolution, out int OffsetDays, out RateProvenance Provenance)
Parameters
RateExchangeRateRequestedDateDateOnlyResolutionRateDateResolutionOffsetDaysintProvenanceRateProvenance
Equals(RateLookupResult)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(RateLookupResult other)
Parameters
otherRateLookupResultAn object to compare with this object.
Returns
Equals(object)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Operators
operator ==(RateLookupResult, RateLookupResult)
public static bool operator ==(RateLookupResult left, RateLookupResult right)
Parameters
leftRateLookupResultrightRateLookupResult
Returns
operator !=(RateLookupResult, RateLookupResult)
public static bool operator !=(RateLookupResult left, RateLookupResult right)
Parameters
leftRateLookupResultrightRateLookupResult
Returns
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |