Class CashFlowVectorsFunctions
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
floatingCouponFunc<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.
digitalCouponFunc<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.
scheduleScheduleThe schedule of accrual dates.
nominalsIEnumerable<double>The nominals.
indexTIndexThe index.
paymentDayCounterDayCounterThe 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.
paymentAdjBusinessDayConventionThe business-day convention of the payment dates.
fixingDaysIEnumerable<int?>The fixing days, null elements taking the index's.
gearingsIEnumerable<double>The gearings.
spreadsIEnumerable<double>The spreads.
isInArrearsboolWhether the coupons fix at the end of their periods.
callStrikesIEnumerable<double?>The call strikes, null elements for no call.
callPositionPositionTypeThe calls' position.
isCallAtmIncludedboolWhether a fixed rate at a call's strike pays the call.
callDigitalPayoffsIEnumerable<double?>The calls' cash payoffs, null elements for asset-or-nothing calls.
putStrikesIEnumerable<double?>The put strikes, null elements for no put.
putPositionPositionTypeThe puts' position.
isPutAtmIncludedboolWhether a fixed rate at a put's strike pays the put.
putDigitalPayoffsIEnumerable<double?>The puts' cash payoffs, null elements for asset-or-nothing puts.
replicationDigitalReplicationThe replication, or null for the digital coupon's default.
nakedOptionboolWhether the coupons pay the options alone.
Returns
- ImmutableArray<CashFlow>
The leg.
Type Parameters
TIndexThe index type.
TCouponThe 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
floatingCouponFunc<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.
cappedFlooredCouponFunc<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.
scheduleScheduleThe schedule of accrual dates.
nominalsIEnumerable<double>The nominals.
indexTIndexThe index.
paymentDayCounterDayCounterThe 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.
paymentAdjBusinessDayConventionThe business-day convention of the payment dates.
fixingDaysIEnumerable<int?>The fixing days, null elements taking the index's.
gearingsIEnumerable<double>The gearings.
spreadsIEnumerable<double>The spreads.
capsIEnumerable<double?>The caps, null elements for none.
floorsIEnumerable<double?>The floors, null elements for none.
isInArrearsboolWhether the coupons fix at the end of their periods.
isZeroboolWhether every coupon is paid on the last payment date.
paymentLagintThe business days from each accrual end to its payment date.
paymentCalendarCalendarThe calendar of the payment dates; the schedule's when null.
exCouponPeriodPeriodThe ex-coupon period, counted back from each payment date; a zero-length period means no ex-coupon dates.
exCouponCalendarCalendarThe calendar the ex-coupon period is counted on; the schedule's when null.
exCouponAdjustmentBusinessDayConventionThe business-day convention of the ex-coupon dates.
exCouponEndOfMonthboolWhether the ex-coupon dates stay at month end.
fixingConventionBusinessDayConventionThe convention adjusting the fixing dates.
Returns
- ImmutableArray<CashFlow>
The leg.
Type Parameters
TIndexThe 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.