Class EquityIndex
Base class for equity indexes.
public class EquityIndex : FinancialIndex
- Inheritance
-
EquityIndex
- Inherited Members
Remarks
The equity index object allows to retrieve past fixings, as well as project future fixings using either both the risk free interest rate term structure and the dividend term structure, or just the interest rate term structure in which case one can provide a term structure of equity forwards implied from, e.g. option prices.
In case of the first method, the forward is calculated as I(t, T) = I(t, t) P_D(t, T) / P_R(t, T), where I(t, t) is today's value of the index, P_D(t, T) is a discount factor of the dividend curve at future time T, and P_R(t, T) is a discount factor of the risk free curve at future time T. In case of the latter method, the forward is calculated as I(t, T) = I(t, t) / P_F(t, T), where P_F(t, T) is a discount factor of the equity forward term structure.
To forecast future fixings, the user can provide the current index spot. If the spot is null, today's fixing will be used instead.
Each discount factor is read from the evaluation date t: P(t, T) is the curve's discount at T over its discount at
t, nothing accruing before the curve's own reference date. QuantLib reads each curve's discount at T from its own
reference date (equityindex.cpp:84-88), which is the formula's only where the curve is dated on or after
the evaluation date; on such a curve the forecast is QuantLib's bit for bit, and on a curve dated before it a
documented divergence.
Constructors
EquityIndex(string, Calendar, Currency?, YieldTermStructure?, YieldTermStructure?, double?)
Initializes a new instance of the EquityIndex class.
public EquityIndex(string name, Calendar fixingCalendar, Currency? currency, YieldTermStructure? interest = null, YieldTermStructure? dividend = null, double? spot = null)
Parameters
namestringThe index's name.
fixingCalendarCalendarThe calendar defining valid fixing dates.
currencyCurrencyThe index currency, or null, QuantLib's empty currency.
interestYieldTermStructureThe interest rate curve used to forecast fixings, or null for none.
dividendYieldTermStructureThe dividend curve used to forecast fixings, or null for none.
spotdouble?The index spot value, or null for none.
Exceptions
- ArgumentNullException
nameorfixingCalendaris null.
Properties
Currency
Gets the index currency, or null for QuantLib's empty currency.
public Currency? Currency { get; }
Property Value
EquityDividendCurve
Gets the dividend curve used to forecast fixings, or null for none.
public YieldTermStructure? EquityDividendCurve { get; }
Property Value
EquityInterestRateCurve
Gets the rate curve used to forecast fixings, or null for none.
public YieldTermStructure? EquityInterestRateCurve { get; }
Property Value
FixingCalendar
Gets the calendar defining valid fixing dates.
public override Calendar FixingCalendar { get; }
Property Value
Name
Gets the index's name, which keys its stored fixings. It is meant for output and comparison, not for code that switches on the index's type.
public override string Name { get; }
Property Value
Spot
Gets the index spot value, or null for none.
public double? Spot { get; }
Property Value
Methods
Clone(YieldTermStructure?, YieldTermStructure?, double?)
A copy of the index on other interest and dividend curves and spot.
public virtual EquityIndex Clone(YieldTermStructure? interest, YieldTermStructure? dividend, double? spot)
Parameters
interestYieldTermStructureThe interest rate curve, or null for none.
dividendYieldTermStructureThe dividend curve, or null for none.
spotdouble?The spot value, or null for none.
Returns
- EquityIndex
The copy.
Fixing(Date, EvaluationContext, bool)
The fixing on a date. A date after the evaluation date, or on it with forecastTodaysFixing,
is forecast; otherwise the stored fixing is used, or on the evaluation date the spot when no fixing is stored.
public override double Fixing(Date fixingDate, EvaluationContext context, bool forecastTodaysFixing = false)
Parameters
fixingDateDateThe actual calendar date of the fixing.
contextEvaluationContextThe evaluation context.
forecastTodaysFixingboolWhether a fixing on the evaluation date is forecast even when one is stored.
Returns
- double
The fixing.
Exceptions
- ArgumentException
fixingDateis not a valid fixing date.- NanoQLException
A fixing that must be stored is missing.
ForecastFixing(Date, EvaluationContext)
The forecast fixing on a date: the forward of today's value on the curves.
public virtual double ForecastFixing(Date fixingDate, EvaluationContext context)
Parameters
fixingDateDateThe fixing date.
contextEvaluationContextThe evaluation context, whose evaluation date and fixings are read.
Returns
- double
The forecast fixing.
Remarks
An extension point: it can be overridden to implement particular conventions.
Exceptions
- NanoQLException
No interest rate curve is set, or neither a spot nor a fixing on the last fixing date is available.
IsValidFixingDate(Date)
Whether a date is a valid fixing date.
public override bool IsValidFixingDate(Date fixingDate)
Parameters
fixingDateDateThe date.