Class ECB
European Central Bank reserve maintenance dates.
public sealed class ECB : IEquatable<ECB>
- Inheritance
-
ECB
- Implements
- Inherited Members
Remarks
The known dates are a value: Default holds QuantLib's, from January 2005 to December 2024, and
AddDate(Date) and RemoveDate(Date) return a new value, so two calculations can use different sets
and neither changes the other's. In QuantLib they are one static set that addDate and removeDate
change for the whole process. Two values are equal when their known dates are.
QuantLib's functions whose date defaults to Date(), read as the global evaluation date, take the context
after QuantLib's parameters without a default, and the date as a nullable after it: the context's evaluation date is
read only when the date is null.
At the start of Date's range QuantLib steps one day before the month's first day, or before the date, and so throws
on 1 January 1901 (ecb.hpp:42, :81-84; ecb.cpp:200): here a month's date is the first known
date on or after its first day, and IsECBdate(Date) is membership in the known dates up to the last one,
QuantLib's answers everywhere else; a documented divergence.
A method of this class is named Date, which hides the type inside it, so the class writes the type
NanoQL.Time.Date.
Properties
Default
Gets QuantLib's known dates, from January 2005 to December 2024.
public static ECB Default { get; }
Property Value
KnownDates
Gets the known maintenance period start dates.
public ImmutableSortedSet<Date> KnownDates { get; }
Property Value
Methods
AddDate(Date)
A copy of the value with the date added to the known dates.
public ECB AddDate(Date d)
Parameters
dDateThe date.
Returns
- ECB
The new value; the receiver is unchanged.
Exceptions
- ArgumentException
disdefault(Date).
Code(Date)
The ECB code of an ECB date (e.g. MAR10 for March xxth, 2010).
public string Code(Date ecbDate)
Parameters
ecbDateDateThe ECB date.
Returns
- string
The code, its month in capitals.
Exceptions
- ArgumentException
The date isn't an ECB date, or is
default(Date).- NanoQLException
The date is after the last known date.
Date(Month, int)
The maintenance period start date in the given month and year: the first known date from its first day.
public Date Date(Month m, int y)
Parameters
Returns
- Date
The date.
Exceptions
- ArgumentOutOfRangeException
The month or the year is outside Date's range.
- NanoQLException
No known date is on or after the month's first day.
Date(string, EvaluationContext, Date?)
The ECB date of an ECB code (e.g. March xxth, 2013 for MAR13), in the century of the reference date.
public Date Date(string ecbCode, EvaluationContext context, Date? referenceDate = null)
Parameters
ecbCodestringThe ECB code, its month in either case.
contextEvaluationContextThe evaluation context, whose evaluation date is the default reference date.
referenceDateDate?The reference date, or null for the evaluation date.
Returns
- Date
The date.
Exceptions
- ArgumentNullException
contextorecbCodeis null.- ArgumentException
The string isn't an ECB code, or
referenceDateisdefault(Date).- NanoQLException
No known date is on or after the month's first day.
Equals(ECB?)
Whether two values hold the same known dates.
public bool Equals(ECB? other)
Parameters
otherECBThe other value.
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
IsECBcode(string)
Whether the given string is an ECB code: a month's three letters, in either case, and two digits.
public static bool IsECBcode(string ecbCode)
Parameters
ecbCodestringThe string.
Returns
Exceptions
- ArgumentNullException
ecbCodeis null.
IsECBdate(Date)
Whether the given date is a maintenance period start date.
public bool IsECBdate(Date d)
Parameters
dDateThe date.
Returns
Exceptions
- ArgumentException
disdefault(Date).- NanoQLException
The date is after the last known date, which QuantLib's answer reads.
NextCode(EvaluationContext, Date?)
The ECB code of the next maintenance period start date after the given date.
public string NextCode(EvaluationContext context, Date? d = null)
Parameters
contextEvaluationContextThe evaluation context, whose evaluation date is the default date.
dDate?The date, or null for the evaluation date.
Returns
- string
The code.
Exceptions
- ArgumentNullException
contextis null.- ArgumentException
disdefault(Date).- NanoQLException
No known date is after the date.
NextCode(string)
The ECB code following the given code (e.g. FEB06 after JAN06, JAN00 after DEC99).
public static string NextCode(string ecbCode)
Parameters
ecbCodestringThe ECB code, its month in either case.
Returns
- string
The next code, its month in capitals.
Exceptions
- ArgumentNullException
ecbCodeis null.- ArgumentException
The string isn't an ECB code.
NextDate(EvaluationContext, Date?)
The next maintenance period start date after the given date.
public Date NextDate(EvaluationContext context, Date? d = null)
Parameters
contextEvaluationContextThe evaluation context, whose evaluation date is the default date.
dDate?The date, or null for the evaluation date.
Returns
- Date
The first known date after the date.
Exceptions
- ArgumentNullException
contextis null.- ArgumentException
disdefault(Date).- NanoQLException
No known date is after the date.
NextDate(string, EvaluationContext, Date?)
The next maintenance period start date after the date of an ECB code.
public Date NextDate(string ecbCode, EvaluationContext context, Date? referenceDate = null)
Parameters
ecbCodestringThe ECB code.
contextEvaluationContextThe evaluation context, whose evaluation date is the default reference date.
referenceDateDate?The code's reference date, or null for the evaluation date.
Returns
- Date
The date.
Exceptions
- ArgumentNullException
contextorecbCodeis null.- ArgumentException
The string isn't an ECB code, or
referenceDateisdefault(Date).- NanoQLException
No known date follows.
NextDates(EvaluationContext, Date?)
The maintenance period start dates after the given date.
public ImmutableArray<Date> NextDates(EvaluationContext context, Date? d = null)
Parameters
contextEvaluationContextThe evaluation context, whose evaluation date is the default date.
dDate?The date, or null for the evaluation date.
Returns
- ImmutableArray<Date>
The known dates after the date, in order.
Exceptions
- ArgumentNullException
contextis null.- ArgumentException
disdefault(Date).- NanoQLException
No known date is after the date.
NextDates(string, EvaluationContext, Date?)
The maintenance period start dates after the date of an ECB code.
public ImmutableArray<Date> NextDates(string ecbCode, EvaluationContext context, Date? referenceDate = null)
Parameters
ecbCodestringThe ECB code.
contextEvaluationContextThe evaluation context, whose evaluation date is the default reference date.
referenceDateDate?The code's reference date, or null for the evaluation date.
Returns
- ImmutableArray<Date>
The known dates after the code's date, in order.
Exceptions
- ArgumentNullException
contextorecbCodeis null.- ArgumentException
The string isn't an ECB code, or
referenceDateisdefault(Date).- NanoQLException
No known date follows.
RemoveDate(Date)
A copy of the value with the date removed from the known dates.
public ECB RemoveDate(Date d)
Parameters
dDateThe date.
Returns
- ECB
The new value; the receiver is unchanged.
Exceptions
- ArgumentException
disdefault(Date).