Table of Contents

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

Rate ExchangeRate

The resolved exchange rate, including its source provider and inversion flag.

RequestedDate DateOnly

The calendar date the caller originally requested.

Resolution RateDateResolution

The fallback policy that was applied during the lookup.

OffsetDays int

The absolute distance, in days, between RequestedDate and the date carried by Rate.

Provenance RateProvenance

The 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

int

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

RateProvenance

Rate

The resolved exchange rate, including its source provider and inversion flag.

public ExchangeRate Rate { get; init; }

Property Value

ExchangeRate

RequestedDate

The calendar date the caller originally requested.

public DateOnly RequestedDate { get; init; }

Property Value

DateOnly

Resolution

The fallback policy that was applied during the lookup.

public RateDateResolution Resolution { get; init; }

Property Value

RateDateResolution

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

Rate ExchangeRate
RequestedDate DateOnly
Resolution RateDateResolution
OffsetDays int
Provenance RateProvenance

Equals(RateLookupResult)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(RateLookupResult other)

Parameters

other RateLookupResult

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

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

left RateLookupResult
right RateLookupResult

Returns

bool

operator !=(RateLookupResult, RateLookupResult)

public static bool operator !=(RateLookupResult left, RateLookupResult right)

Parameters

left RateLookupResult
right RateLookupResult

Returns

bool

Applies to

ProductVersions
.NET8, 10