/// <summary> /// Make a set of CDSCouponDes. /// </summary> /// <param name="leg"> the schedule of the accrual periods </param> /// <param name="accrualDCC"> the day count used for the accrual </param> /// <returns> a set of CDSCouponDes </returns> public static CdsCouponDes[] makeCoupons(IsdaPremiumLegSchedule leg, Enums.DayCount accrualDCC) { int n = leg.NumPayments; CdsCouponDes[] coupons = new CdsCouponDes[n]; for (int i = 0; i < n; i++) { coupons[i] = new CdsCouponDes(leg.getAccStartDate(i), leg.getAccEndDate(i), leg.getPaymentDate(i), accrualDCC); } return coupons; }
/// <summary> /// Make a set of CDSCoupon used by <seealso cref="CdsAnalytic"/> given a trade date and the schedule of the accrual periods. /// </summary> /// <param name="tradeDate"> The trade date </param> /// <param name="leg"> schedule of the accrual periods </param> /// <param name="protectionFromStartOfDay"> If true the protection is from the start of day and the effective accrual /// start and end dates are one day less. The exception is the accrual end date which has one day /// added (if protectionFromStartOfDay = true) in ISDAPremiumLegSchedule to compensate for this, so the /// accrual end date is just the CDS maturity. /// The effect of having protectionFromStartOfDay = true is to add an extra day of protection. </param> /// <param name="accrualDCC"> The day count used to compute accrual periods </param> /// <param name="curveDCC"> Day count used on curve (NOTE ISDA uses ACT/365 (fixed) and it is not recommended to change this) </param> /// <seealso cref= CdsAnalytic </seealso> /// <returns> A set of CDSCoupon </returns> public static CdsCoupon[] makeCoupons(DateTime tradeDate, IsdaPremiumLegSchedule leg, bool protectionFromStartOfDay, Enums.DayCount accrualDCC, Enums.DayCount curveDCC) { int n = leg.NumPayments; CdsCoupon[] res = new CdsCoupon[n]; for (int i = 0; i < n; i++) { DateTime[] dates = leg.getAccPaymentDateTriplet(i); res[i] = new CdsCoupon(tradeDate, dates[0], dates[1], dates[2], protectionFromStartOfDay, accrualDCC, curveDCC); } return(res); }
public static IsdaPremiumLegSchedule truncateSchedule(DateTime stepin, IsdaPremiumLegSchedule schedule) { return(schedule.truncateSchedule(stepin)); }
/// <summary> /// Make a set of CDSCouponDes. /// </summary> /// <param name="leg"> the schedule of the accrual periods </param> /// <returns> a set of CDSCouponDes </returns> public static CdsCouponDes[] makeCoupons(IsdaPremiumLegSchedule leg) { return makeCoupons(leg, DEFAULT_ACCURAL_DCC); }