Table of Contents

RateHistoryAvailability Struct

Definition

Namespace
Bodu.Financial.ExchangeRates
Assembly
Bodu.Financial.dll
Package
Bodu.Financial 1.0.0
Source
RateHistoryAvailability.cs

Declares how far back in time a provider can serve exchange rates, as one of three shapes: an unbounded archive, a rolling window of the most recent days, or a fixed earliest calendar date.

public readonly struct RateHistoryAvailability : IEquatable<RateHistoryAvailability>
Implements
Inherited Members
Extension Methods

Remarks

A provider advertises its history depth through this value so a caller can know, before requesting an old date, whether the provider can satisfy it. A feed that publishes only the recent past (for example, an anonymous endpoint capped to roughly the last six months) declares a Rolling window; a feed with a fixed inception date declares Since; a feed with no known floor declares Unbounded.

The value is advisory: it describes the provider's published coverage, not a guarantee that every day in range carries an observation (weekends and holidays may still be absent). It bounds only the earliest date worth requesting.

Properties

EarliestDate

Gets the fixed earliest date on or after which the provider serves rates.

public DateOnly EarliestDate { get; }

Property Value

DateOnly

The earliest date when Kind is Since; otherwise the default date.

Kind

Gets the shape of the availability bound.

public RateHistoryAvailabilityKind Kind { get; }

Property Value

RateHistoryAvailabilityKind

The availability kind.

Unbounded

Gets an availability that advertises no known lower bound on the dates the provider can serve.

public static RateHistoryAvailability Unbounded { get; }

Property Value

RateHistoryAvailability

An unbounded availability.

WindowDays

Gets the rolling window length, in days, measured back from the current date.

public int WindowDays { get; }

Property Value

int

The window length in days when Kind is Rolling; otherwise zero.

Methods

Equals(RateHistoryAvailability)

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

public bool Equals(RateHistoryAvailability other)

Parameters

other RateHistoryAvailability

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.

GetEarliestAvailable(DateOnly)

Resolves the earliest date the provider can serve, evaluated against a reference date.

public DateOnly? GetEarliestAvailable(DateOnly asOf)

Parameters

asOf DateOnly

The reference date from which a rolling window is measured.

Returns

DateOnly?

The earliest available date, or null when the availability is Unbounded.

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.

IsAvailable(DateOnly, DateOnly)

Reports whether date falls within the provider's advertised history, evaluated against a reference date.

public bool IsAvailable(DateOnly date, DateOnly asOf)

Parameters

date DateOnly

The date to test.

asOf DateOnly

The reference date from which a rolling window is measured.

Returns

bool

true when date is on or after the earliest available date, or when the availability is unbounded; otherwise false.

RollingDays(int)

Creates an availability describing a rolling window of the most recent days days.

public static RateHistoryAvailability RollingDays(int days)

Parameters

days int

The window length in days.

Returns

RateHistoryAvailability

A rolling availability spanning the last days days.

Exceptions

ArgumentOutOfRangeException

days is less than or equal to zero.

Since(DateOnly)

Creates an availability describing a fixed earliest date on or after which the provider serves rates.

public static RateHistoryAvailability Since(DateOnly earliest)

Parameters

earliest DateOnly

The earliest available date.

Returns

RateHistoryAvailability

A fixed-floor availability starting at earliest.

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Operators

operator ==(RateHistoryAvailability, RateHistoryAvailability)

public static bool operator ==(RateHistoryAvailability left, RateHistoryAvailability right)

Parameters

left RateHistoryAvailability
right RateHistoryAvailability

Returns

bool

operator !=(RateHistoryAvailability, RateHistoryAvailability)

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

Parameters

left RateHistoryAvailability
right RateHistoryAvailability

Returns

bool

Applies to

ProductVersions
.NET8, 10