Table of Contents

Class ECB

Namespace
NanoQL.Time
Assembly
NanoQL.dll

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

ECB

KnownDates

Gets the known maintenance period start dates.

public ImmutableSortedSet<Date> KnownDates { get; }

Property Value

ImmutableSortedSet<Date>

Methods

AddDate(Date)

A copy of the value with the date added to the known dates.

public ECB AddDate(Date d)

Parameters

d Date

The date.

Returns

ECB

The new value; the receiver is unchanged.

Exceptions

ArgumentException

d is default(Date).

Code(Date)

The ECB code of an ECB date (e.g. MAR10 for March xxth, 2010).

public string Code(Date ecbDate)

Parameters

ecbDate Date

The 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

m Month

The month.

y int

The year.

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

ecbCode string

The ECB code, its month in either case.

context EvaluationContext

The evaluation context, whose evaluation date is the default reference date.

referenceDate Date?

The reference date, or null for the evaluation date.

Returns

Date

The date.

Exceptions

ArgumentNullException

context or ecbCode is null.

ArgumentException

The string isn't an ECB code, or referenceDate is default(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

other ECB

The other value.

Returns

bool

true when equal.

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

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

ecbCode string

The string.

Returns

bool

true for an ECB code.

Exceptions

ArgumentNullException

ecbCode is null.

IsECBdate(Date)

Whether the given date is a maintenance period start date.

public bool IsECBdate(Date d)

Parameters

d Date

The date.

Returns

bool

true for a known date.

Exceptions

ArgumentException

d is default(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

context EvaluationContext

The evaluation context, whose evaluation date is the default date.

d Date?

The date, or null for the evaluation date.

Returns

string

The code.

Exceptions

ArgumentNullException

context is null.

ArgumentException

d is default(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

ecbCode string

The ECB code, its month in either case.

Returns

string

The next code, its month in capitals.

Exceptions

ArgumentNullException

ecbCode is 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

context EvaluationContext

The evaluation context, whose evaluation date is the default date.

d Date?

The date, or null for the evaluation date.

Returns

Date

The first known date after the date.

Exceptions

ArgumentNullException

context is null.

ArgumentException

d is default(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

ecbCode string

The ECB code.

context EvaluationContext

The evaluation context, whose evaluation date is the default reference date.

referenceDate Date?

The code's reference date, or null for the evaluation date.

Returns

Date

The date.

Exceptions

ArgumentNullException

context or ecbCode is null.

ArgumentException

The string isn't an ECB code, or referenceDate is default(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

context EvaluationContext

The evaluation context, whose evaluation date is the default date.

d Date?

The date, or null for the evaluation date.

Returns

ImmutableArray<Date>

The known dates after the date, in order.

Exceptions

ArgumentNullException

context is null.

ArgumentException

d is default(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

ecbCode string

The ECB code.

context EvaluationContext

The evaluation context, whose evaluation date is the default reference date.

referenceDate Date?

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

context or ecbCode is null.

ArgumentException

The string isn't an ECB code, or referenceDate is default(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

d Date

The date.

Returns

ECB

The new value; the receiver is unchanged.

Exceptions

ArgumentException

d is default(Date).