Class IndexFixings
The stored fixings of indexes, by index name: QuantLib's IndexManager, as an immutable value that
Fixings holds.
public sealed class IndexFixings : IEquatable<IndexFixings>
- Inheritance
-
IndexFixings
- Implements
- Inherited Members
Remarks
Every change returns a new store, as .NET's immutable collections do. The writers take the index, whose name keys its history and whose IsValidFixingDate(Date) and AllowsNativeFixings QuantLib's checks read; an index reads its fixings through PastFixing(Date, EvaluationContext), HasHistoricalFixing(Date, EvaluationContext) and TimeSeries(EvaluationContext).
Names compare as QuantLib's do: ASCII letters upper-cased, every other character as it is, so "Euribor6M" and "EURIBOR6M" share a history. The first spelling stored is the one Histories() gives, in the order of that comparison.
Two stores are equal when they hold the same names, by that comparison, each with an equal history; which spelling was kept doesn't count. The hash combines one hash per history, each computed when its series was built.
Three divergences from QuantLib: a refused batch changes nothing, where QuantLib stores its valid fixings, and a
null entry at the refused date, before it throws; reading never writes, where QuantLib's reads insert null entries
and empty histories; and a fixing equal to QuantLib's null sentinel Null<Real>()
(3.4028234663852886e38) is stored as a value, where QuantLib reads it as no fixing.
Properties
Empty
Gets the store with no fixings, QuantLib's state after clearHistories().
public static IndexFixings Empty { get; }
Property Value
Methods
AddFixing(FinancialIndex, Date, double, bool)
A store with one more fixing, written on every date the index gives for it.
public IndexFixings AddFixing(FinancialIndex index, Date fixingDate, double fixing, bool forceOverwrite = false)
Parameters
indexFinancialIndexThe index the fixing is for.
fixingDateDateThe actual calendar date of the fixing, with no settlement days applied.
fixingdoubleThe fixing.
forceOverwriteboolWhether a fixing already stored on those dates is replaced.
Returns
- IndexFixings
The new store; this one is unchanged.
Remarks
The fixing is written on each date of the index's FixingDates(Date): the date alone, or
for an inflation index every day of the date's inflation period, as QuantLib's InflationIndex::addFixing
writes it. The dates are written together, through the same checks as AddFixings(FinancialIndex, IEnumerable<Date>, IEnumerable<double>, bool), all or nothing.
Exceptions
- ArgumentException
A date isn't a valid fixing date, or a different fixing is stored on one and
forceOverwriteis false.- NanoQLException
The index allows no native fixings.
AddFixings(FinancialIndex, TimeSeries<double>, bool)
A store with more fixings, taken from a series.
public IndexFixings AddFixings(FinancialIndex index, TimeSeries<double> fixings, bool forceOverwrite = false)
Parameters
indexFinancialIndexThe index the fixings are for.
fixingsTimeSeries<double>The fixings, on the actual calendar dates of the fixings.
forceOverwriteboolWhether fixings already stored on those dates are replaced.
Returns
- IndexFixings
The new store; this one is unchanged.
Exceptions
- ArgumentException
A date isn't a valid fixing date, or a different fixing is stored on it and
forceOverwriteis false. Nothing is stored then.- NanoQLException
The index allows no native fixings.
AddFixings(FinancialIndex, IEnumerable<Date>, IEnumerable<double>, bool)
A store with more fixings, taken in pairs from two sequences.
public IndexFixings AddFixings(FinancialIndex index, IEnumerable<Date> fixingDates, IEnumerable<double> fixings, bool forceOverwrite = false)
Parameters
indexFinancialIndexThe index the fixings are for.
fixingDatesIEnumerable<Date>The actual calendar dates of the fixings, with no settlement days applied.
fixingsIEnumerable<double>The fixings, one per date; values beyond the last date are ignored, as in QuantLib.
forceOverwriteboolWhether fixings already stored on those dates are replaced.
Returns
- IndexFixings
The new store; this one is unchanged. With no dates, it holds an empty history for the index, as QuantLib's does.
Exceptions
- ArgumentException
There are fewer fixings than dates; or a date isn't a valid fixing date, or a different fixing is stored on it and
forceOverwriteis false. Nothing is stored then.- NanoQLException
The index allows no native fixings.
ClearFixings(FinancialIndex)
A store without the index's fixings.
public IndexFixings ClearFixings(FinancialIndex index)
Parameters
indexFinancialIndexThe index.
Returns
- IndexFixings
The new store; this one is unchanged.
Exceptions
- NanoQLException
The index allows no native fixings.
Equals(IndexFixings?)
public bool Equals(IndexFixings? other)
Parameters
otherIndexFixings
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
Histories()
The names of the indexes whose fixings are stored, as first spelt, in QuantLib's order.
public ImmutableArray<string> Histories()
Returns
- ImmutableArray<string>
The names.