Table of Contents

Class CashFlowVectorsFunctions

Namespace
NanoQL.Coupons
Assembly
NanoQL.dll

Cash-flow vector builders: QuantLib's free functions of cashflowvectors.hpp.

public static class CashFlowVectorsFunctions
Inheritance
CashFlowVectorsFunctions
Inherited Members

Methods

FloatingDigitalLeg<TIndex, TCoupon>(Func<Date, double, Date, Date, int?, TIndex, double, double, Date, Date, DayCounter?, bool, TCoupon>, Func<TCoupon, double?, PositionType, bool, double?, double?, PositionType, bool, double?, DigitalReplication?, bool, CashFlow>, Schedule, IEnumerable<double>, TIndex, DayCounter?, BusinessDayConvention, IEnumerable<int?>, IEnumerable<double>, IEnumerable<double>, bool, IEnumerable<double?>, PositionType, bool, IEnumerable<double?>, IEnumerable<double?>, PositionType, bool, IEnumerable<double?>, DigitalReplication?, bool)

A leg of digital floating-rate coupons, one per schedule period: QuantLib's FloatingDigitalLeg template, with its coupon types given as the factories that build them. A period whose gearing is zero is a fixed-rate coupon paying the spread; any other is a digital coupon built by digitalCoupon on the floating coupon floatingCoupon builds.

public static ImmutableArray<CashFlow> FloatingDigitalLeg<TIndex, TCoupon>(Func<Date, double, Date, Date, int?, TIndex, double, double, Date, Date, DayCounter?, bool, TCoupon> floatingCoupon, Func<TCoupon, double?, PositionType, bool, double?, double?, PositionType, bool, double?, DigitalReplication?, bool, CashFlow> digitalCoupon, Schedule schedule, IEnumerable<double> nominals, TIndex index, DayCounter? paymentDayCounter, BusinessDayConvention paymentAdj, IEnumerable<int?> fixingDays, IEnumerable<double> gearings, IEnumerable<double> spreads, bool isInArrears, IEnumerable<double?> callStrikes, PositionType callPosition, bool isCallAtmIncluded, IEnumerable<double?> callDigitalPayoffs, IEnumerable<double?> putStrikes, PositionType putPosition, bool isPutAtmIncluded, IEnumerable<double?> putDigitalPayoffs, DigitalReplication? replication, bool nakedOption = false) where TIndex : InterestRateIndex where TCoupon : FloatingRateCoupon

Parameters

floatingCoupon Func<Date, double, Date, Date, int?, TIndex, double, double, Date, Date, DayCounter, bool, TCoupon>

The factory of the floating coupon, from QuantLib's constructor arguments: the payment date, nominal, accrual start and end, fixing days, index, gearing, spread, reference period start and end, payment day counter and in-arrears flag.

digitalCoupon Func<TCoupon, double?, PositionType, bool, double?, double?, PositionType, bool, double?, DigitalReplication, bool, CashFlow>

The factory of the digital coupon on it, from QuantLib's constructor arguments: the underlying, the call's strike, position, at-the-money flag and payoff, the put's, the replication and the naked option flag.

schedule Schedule

The schedule of accrual dates.

nominals IEnumerable<double>

The nominals.

index TIndex

The index.

paymentDayCounter DayCounter

The accrual day counter, or null, QuantLib's empty day counter, which leaves each floating coupon the index's; a period with a zero gearing then refuses the leg, once every period is built.

paymentAdj BusinessDayConvention

The business-day convention of the payment dates.

fixingDays IEnumerable<int?>

The fixing days, null elements taking the index's.

gearings IEnumerable<double>

The gearings.

spreads IEnumerable<double>

The spreads.

isInArrears bool

Whether the coupons fix at the end of their periods.

callStrikes IEnumerable<double?>

The call strikes, null elements for no call.

callPosition PositionType

The calls' position.

isCallAtmIncluded bool

Whether a fixed rate at a call's strike pays the call.

callDigitalPayoffs IEnumerable<double?>

The calls' cash payoffs, null elements for asset-or-nothing calls.

putStrikes IEnumerable<double?>

The put strikes, null elements for no put.

putPosition PositionType

The puts' position.

isPutAtmIncluded bool

Whether a fixed rate at a put's strike pays the put.

putDigitalPayoffs IEnumerable<double?>

The puts' cash payoffs, null elements for asset-or-nothing puts.

replication DigitalReplication

The replication, or null for the digital coupon's default.

nakedOption bool

Whether the coupons pay the options alone.

Returns

ImmutableArray<CashFlow>

The leg.

Type Parameters

TIndex

The index type.

TCoupon

The floating coupon type.

Remarks

A per-period vector gives each period its element, the last element past its end, and the default when empty: a nominal and a gearing of 1, the index's fixing days, a spread of 0, and no call or put strike or payoff. A zero-gearing period's fixed coupon pays the spread, 0 by default, where QuantLib's defaults it to 1.0 there, so that such a period of a leg without spreads pays 100% (QuantLib's FloatingLeg on the same period pays 0). The floating coupons take no ex-coupon date and fix on the preceding business day, as QuantLib's template builds them.

Exceptions

ArgumentException

No nominal is given; a nominal, gearing, spread or strike vector has more elements than the schedule has periods; the schedule is empty; or a period has a zero gearing and no payment day counter is given.

ArgumentOutOfRangeException

A fixing-days element is negative, or a convention isn't a member of its type.

FloatingLeg<TIndex>(Func<Date, double, Date, Date, int?, TIndex, double, double, Date, Date, DayCounter?, bool, Date?, BusinessDayConvention, CashFlow>, Func<Date, double, Date, Date, int?, TIndex, double, double, double?, double?, Date, Date, DayCounter?, bool, Date?, BusinessDayConvention, CashFlow>, Schedule, IEnumerable<double>, TIndex, DayCounter?, BusinessDayConvention, IEnumerable<int?>, IEnumerable<double>, IEnumerable<double>, IEnumerable<double?>, IEnumerable<double?>, bool, bool, int, Calendar?, Period, Calendar?, BusinessDayConvention, bool, BusinessDayConvention)

A leg of floating-rate coupons, one per schedule period: QuantLib's FloatingLeg template, with its two coupon types given as the factories that build them. A period whose gearing is zero is a fixed-rate coupon paying the spread, floored and capped; a period with a cap or a floor is built by cappedFlooredCoupon, any other by floatingCoupon.

public static ImmutableArray<CashFlow> FloatingLeg<TIndex>(Func<Date, double, Date, Date, int?, TIndex, double, double, Date, Date, DayCounter?, bool, Date?, BusinessDayConvention, CashFlow> floatingCoupon, Func<Date, double, Date, Date, int?, TIndex, double, double, double?, double?, Date, Date, DayCounter?, bool, Date?, BusinessDayConvention, CashFlow> cappedFlooredCoupon, Schedule schedule, IEnumerable<double> nominals, TIndex index, DayCounter? paymentDayCounter, BusinessDayConvention paymentAdj, IEnumerable<int?> fixingDays, IEnumerable<double> gearings, IEnumerable<double> spreads, IEnumerable<double?> caps, IEnumerable<double?> floors, bool isInArrears, bool isZero, int paymentLag = 0, Calendar? paymentCalendar = null, Period exCouponPeriod = default, Calendar? exCouponCalendar = null, BusinessDayConvention exCouponAdjustment = BusinessDayConvention.Unadjusted, bool exCouponEndOfMonth = false, BusinessDayConvention fixingConvention = BusinessDayConvention.Preceding) where TIndex : InterestRateIndex

Parameters

floatingCoupon Func<Date, double, Date, Date, int?, TIndex, double, double, Date, Date, DayCounter, bool, Date?, BusinessDayConvention, CashFlow>

The factory of a coupon with neither cap nor floor.

cappedFlooredCoupon Func<Date, double, Date, Date, int?, TIndex, double, double, double?, double?, Date, Date, DayCounter, bool, Date?, BusinessDayConvention, CashFlow>

The factory of a capped or floored coupon.

schedule Schedule

The schedule of accrual dates.

nominals IEnumerable<double>

The nominals.

index TIndex

The index.

paymentDayCounter DayCounter

The accrual day counter, or null, QuantLib's empty day counter, which leaves each floating coupon the index's; a period with a zero gearing then refuses the leg, once every period is built.

paymentAdj BusinessDayConvention

The business-day convention of the payment dates.

fixingDays IEnumerable<int?>

The fixing days, null elements taking the index's.

gearings IEnumerable<double>

The gearings.

spreads IEnumerable<double>

The spreads.

caps IEnumerable<double?>

The caps, null elements for none.

floors IEnumerable<double?>

The floors, null elements for none.

isInArrears bool

Whether the coupons fix at the end of their periods.

isZero bool

Whether every coupon is paid on the last payment date.

paymentLag int

The business days from each accrual end to its payment date.

paymentCalendar Calendar

The calendar of the payment dates; the schedule's when null.

exCouponPeriod Period

The ex-coupon period, counted back from each payment date; a zero-length period means no ex-coupon dates.

exCouponCalendar Calendar

The calendar the ex-coupon period is counted on; the schedule's when null.

exCouponAdjustment BusinessDayConvention

The business-day convention of the ex-coupon dates.

exCouponEndOfMonth bool

Whether the ex-coupon dates stay at month end.

fixingConvention BusinessDayConvention

The convention adjusting the fixing dates.

Returns

ImmutableArray<CashFlow>

The leg.

Type Parameters

TIndex

The index type.

Remarks

A per-period vector (nominals, fixing days, gearings, spreads, caps, floors) gives each period its element, the last element past its end, and the default when empty: a nominal and a gearing of 1, the index's fixing days, a spread of 0, and no cap or floor (null, QuantLib's Null<Rate>()). Each factory receives QuantLib's constructor arguments: the payment date, nominal, accrual start and end, fixing days, index, gearing, spread (then the cap and the floor), reference period start and end, payment day counter, in-arrears flag, ex-coupon date and fixing convention.

Exceptions

ArgumentException

No nominal is given; a vector has more elements than the schedule has periods; the leg is both in arrears and zero; the schedule is empty; or a period has a zero gearing and no payment day counter is given.

ArgumentOutOfRangeException

A fixing-days element is negative, or a convention isn't a member of its type.