RateHistoryAvailability Struct
Definition
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
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
Methods
Equals(RateHistoryAvailability)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(RateHistoryAvailability other)
Parameters
otherRateHistoryAvailabilityAn 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
GetEarliestAvailable(DateOnly)
Resolves the earliest date the provider can serve, evaluated against a reference date.
public DateOnly? GetEarliestAvailable(DateOnly asOf)
Parameters
asOfDateOnlyThe reference date from which a rolling window is measured.
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.
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
dateDateOnlyThe date to test.
asOfDateOnlyThe reference date from which a rolling window is measured.
Returns
RollingDays(int)
Creates an availability describing a rolling window of the most recent days days.
public static RateHistoryAvailability RollingDays(int days)
Parameters
daysintThe window length in days.
Returns
- RateHistoryAvailability
A rolling availability spanning the last
daysdays.
Exceptions
- ArgumentOutOfRangeException
daysis 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
earliestDateOnlyThe 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
leftRateHistoryAvailabilityrightRateHistoryAvailability
Returns
operator !=(RateHistoryAvailability, RateHistoryAvailability)
public static bool operator !=(RateHistoryAvailability left, RateHistoryAvailability right)
Parameters
leftRateHistoryAvailabilityrightRateHistoryAvailability
Returns
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |