/** * Make a set of CDSs with a common trade date and maturities dates the given periods after the * next IMM date (after the trade-date). * * @param tradeDate the trade date * @param accStartDate this is when the CDS nominally starts in terms of premium payments. For a * standard CDS this is the previous IMM date, and for a `legacy' CDS it is T+1 * @param tenors the tenors (lengths) of the CDSs * @return an array of CDS analytic descriptions */ public CdsAnalytic[] makeImmCds(LocalDate tradeDate, LocalDate accStartDate, Period[] tenors) { ArgChecker.notNull(tradeDate, "tradeDate"); ArgChecker.notNull(accStartDate, "effectiveDate"); ArgChecker.noNulls(tenors, "tenors"); LocalDate nextIMM = ImmDateLogic.getNextIMMDate(tradeDate); LocalDate[] maturities = ImmDateLogic.getIMMDateSet(nextIMM, tenors); return makeCds(tradeDate, accStartDate, maturities); }
/** * Make a set of CDSs with a common trade date and maturities dates the given periods after the * next IMM date (after the trade-date). The accrual start date will be the previous IMM date * (before the trade date). <b>Note</b> it payment interval is changed from the default of 3M, * this will produce a (possibly incorrect) non-standard first coupon. * * @param tradeDate the trade date * @param tenors the tenors (lengths) of the CDSs * @param makeEffBusDay is the accrual start day business-day adjusted. * @return an array of CDS analytic descriptions */ public CdsAnalytic[] makeImmCds(LocalDate tradeDate, Period[] tenors, boolean makeEffBusDay) { LocalDate effectiveDate = makeEffBusDay ? _businessdayAdjustmentConvention.adjust( ImmDateLogic.getPrevIMMDate(tradeDate), _calendar) : ImmDateLogic.getPrevIMMDate(tradeDate); return makeImmCds(tradeDate, effectiveDate, tenors); }
/** * Set up a strip of on-the-run indexes represented as a single name CDSs (i.e. by CdsAnalytic). * The index roll dates (when new indices are issued) are 20 Mar & Sep, and the index is defined * to have a maturity that is its nominal tenor plus 3M on issuance, so a 5Y index on the * 6-Feb-2014 will have a maturity of 20-Dec-2018 (5Y3M on the issue date of 20-Sep-2013). The * accrual start date will be the previous IMM date (before the trade date), business-day * adjusted. <b>Note</b> it payment interval is changed from the default of 3M, this will produce * a (possibly incorrect) non-standard first coupon. * * @param tradeDate the trade date * @param tenors the nominal lengths of the indexes * @return an array of CDS analytic descriptions */ public CdsAnalytic[] makeCdx(LocalDate tradeDate, Period[] tenors) { ArgChecker.notNull(tradeDate, "tradeDate"); ArgChecker.noNulls(tenors, "tenors"); LocalDate effectiveDate = _businessdayAdjustmentConvention.adjust(ImmDateLogic.getPrevIMMDate(tradeDate), _calendar); LocalDate mid = ImmDateLogic.getNextIndexRollDate(tradeDate).minusMonths(3); LocalDate[] maturities = ImmDateLogic.getIMMDateSet(mid, tenors); return makeCds(tradeDate, effectiveDate, maturities); }
/** * Set up an on-the-run index represented as a single name CDS (i.e. by CdsAnalytic). The index * roll dates (when new indices are issued) are 20 Mar & Sep, and the index is defined to have a * maturity that is its nominal tenor plus 3M on issuance, so a 5Y index on the 6-Feb-2014 will * have a maturity of 20-Dec-2018 (5Y3M on the issue date of 20-Sep-2013). The accrual start date * will be the previous IMM date (before the trade date), business-day adjusted. <b>Note</b> it * payment interval is changed from the default of 3M, this will produce a (possibly incorrect) * non-standard first coupon. * * @param tradeDate the trade date * @param tenor the nominal length of the index * @return a CDS analytic description */ public CdsAnalytic makeCdx(LocalDate tradeDate, Period tenor) { ArgChecker.notNull(tradeDate, "tradeDate"); ArgChecker.notNull(tenor, "tenor"); LocalDate effectiveDate = _businessdayAdjustmentConvention.adjust(ImmDateLogic.getPrevIMMDate(tradeDate), _calendar); LocalDate roll = ImmDateLogic.getNextIndexRollDate(tradeDate); LocalDate maturity = roll.plus(tenor).minusMonths(3); return makeCds(tradeDate, effectiveDate, maturity); }
/** * Make a CDS with a maturity date the given period on from the next IMM date after the * trade-date. The accrual start date will be the previous IMM date (before the trade date). * <b>Note</b> it payment interval is changed from the default of 3M, this will produce a * (possibly incorrect) non-standard first coupon. * * @param tradeDate the trade date * @param tenor the tenor (length) of the CDS * @param makeEffBusDay is the accrual start day business-day adjusted. * @return a CDS analytic description */ public CdsAnalytic makeImmCds(LocalDate tradeDate, Period tenor, boolean makeEffBusDay) { ArgChecker.notNull(tradeDate, "tradeDate"); ArgChecker.notNull(tenor, "tenor"); LocalDate effectiveDate = makeEffBusDay ? _businessdayAdjustmentConvention.adjust( ImmDateLogic.getPrevIMMDate(tradeDate), _calendar) : ImmDateLogic.getPrevIMMDate(tradeDate); LocalDate nextIMM = ImmDateLogic.getNextIMMDate(tradeDate); LocalDate maturity = nextIMM.plus(tenor); return makeCds(tradeDate, effectiveDate, maturity); }
/** * Make a set of standard CDS represented as a MultiCdsAnalytic instance. The maturities of the * CDS are measured from the next IMM date (after the trade date), and the tenors are the given * matIndices multiplied by the coupon interval (3 months). * * @param tradeDate the trade date * @param accStartDate the accrual start date * @param matIndices the CDS tenors are these multiplied by the coupon interval (3 months) * @return a set of CDS represented as a MultiCdsAnalytic */ public MultiCdsAnalytic makeMultiImmCds( LocalDate tradeDate, LocalDate accStartDate, int[] matIndices) { if (!_couponInterval.equals(DEFAULT_COUPON_INT)) { throw new IllegalArgumentException( "coupon interval must be 3M for this method. However it is set to " + _couponInterval.toString()); } ArgChecker.notNull(tradeDate, "tradeDate"); ArgChecker.notEmpty(matIndices, "matIndicies"); LocalDate nextIMM = ImmDateLogic.getNextIMMDate(tradeDate); LocalDate stepinDate = tradeDate.plusDays(_stepIn); LocalDate valueDate = addWorkDays(tradeDate, _cashSettle, _calendar); return new MultiCdsAnalytic( tradeDate, stepinDate, valueDate, accStartDate, nextIMM, matIndices, _payAccOnDefault, _couponIntervalTenor, _stubType, _protectStart, _recoveryRate, _businessdayAdjustmentConvention, DEFAULT_CALENDAR, _accrualDayCount, _curveDayCount); }
/** * Make a CDS represented as a MultiCdsAnalytic instance. Note, this is mainly for testing, since * if you want only a single CDS should use a method that returns a {@link CdsAnalytic}. * * @param tradeDate the trade date * @param maturityReferanceDate a reference date that maturities are measured from. For standard * CDSSs, this is the next IMM date after the trade date, so the actually maturities will be * some fixed periods after this. * @param termMatIndex the maturities are fixed integer multiples of the payment interval, so 2Y * tenor with a 3M payment interval, this would be 8 * @return a a CDS represented as a MultiCdsAnalytic */ public MultiCdsAnalytic makeMultiCds( LocalDate tradeDate, LocalDate maturityReferanceDate, int termMatIndex) { int[] maturityIndexes = new int[termMatIndex + 1]; for (int i = 0; i <= termMatIndex; i++) { maturityIndexes[i] = i; } LocalDate accStartDate = _businessdayAdjustmentConvention.adjust(ImmDateLogic.getPrevIMMDate(tradeDate), _calendar); return makeMultiCds(tradeDate, accStartDate, maturityReferanceDate, maturityIndexes); }
/** * A forward starting CDS starts on some date after today (the trade date). The stepin date and * cash settlement date are taken from the forward start date (1 day and 3 working days by * default). * * @param tradeDate the trade date (i.e. today) * @param forwardStartDate the forward start date * @param maturity the maturity of the CDS * @return a CDS analytic description for a forward starting CDS */ public CdsAnalytic makeForwardStartingCds( LocalDate tradeDate, LocalDate forwardStartDate, LocalDate maturity) { ArgChecker.isFalse( forwardStartDate.isBefore(tradeDate), "forwardStartDate of {} is before trade date of {}", forwardStartDate, tradeDate); LocalDate stepinDate = forwardStartDate.plusDays(_stepIn); LocalDate valueDate = addWorkDays(forwardStartDate, _cashSettle, _calendar); LocalDate accStartDate = _businessdayAdjustmentConvention.adjust( ImmDateLogic.getPrevIMMDate(forwardStartDate), _calendar); return makeCds(tradeDate, stepinDate, valueDate, accStartDate, maturity); }
/** * Make a set of standard CDS represented as a MultiCdsAnalytic instance. * * @param tradeDate the trade date * @param tenors the tenors (length) of the CDS * @return a set of CDS represented as a MultiCdsAnalytic */ public MultiCdsAnalytic makeMultiImmCds(LocalDate tradeDate, Period[] tenors) { LocalDate accStartDate = _businessdayAdjustmentConvention.adjust(ImmDateLogic.getPrevIMMDate(tradeDate), _calendar); return makeMultiImmCds(tradeDate, accStartDate, tenors); }
/** * /** A forward starting index starts on some date after today (the trade date). The stepin date * and cash settlement date are taken from the forward start date (1 day and 3 working days by * default). The maturity (of the index) is taken from the forward-start-date. The index roll * dates (when new indices are issued) are 20 Mar & Sep, and the index is defined to have a * maturity that is its nominal tenor plus 3M on issuance, so a 5Y index on the 6-Feb-2014 will * have a maturity of 20-Dec-2018 (5Y3M on the issue date of 20-Sep-2013). However for a * trade-date of 6-Feb-2014, a forward-start-date of 25-Mar-2014 and a tenor of 5Y, the maturity * will be 20-Jun-2019. * * @param tradeDate the trade date (i.e. today) * @param forwardStartDate the forward start date * @param tenor the tenor (nominal length) of the index at the forwardStartDate * @return a CDS analytic description for a forward starting index */ public CdsAnalytic makeForwardStartingCdx( LocalDate tradeDate, LocalDate forwardStartDate, Period tenor) { LocalDate roll = ImmDateLogic.getNextIndexRollDate(forwardStartDate); LocalDate maturity = roll.plus(tenor).minusMonths(3); return makeForwardStartingCds(tradeDate, forwardStartDate, maturity); }
/** * A forward starting CDS starts on some date after today (the trade date). The stepin date and * cash settlement date are taken from the forward start date (1 day and 3 working days by * default). The period is from the next IMM date after the forward-start-date, so for a * trade-date of 13-Feb-2014, a forward-start-date of 25-Mar-2014 and a tenor of 1Y, the maturity * will be 20-Jun-2015. * * @param tradeDate the trade date (i.e. today) * @param forwardStartDate the forward start date * @param tenor the tenor (length) of the CDS at the forwardStartDate * @return a CDS analytic description for a forward starting CDS */ public CdsAnalytic makeForwardStartingImmCds( LocalDate tradeDate, LocalDate forwardStartDate, Period tenor) { LocalDate nextIMM = ImmDateLogic.getNextIMMDate(forwardStartDate); LocalDate maturity = nextIMM.plus(tenor); return makeForwardStartingCds(tradeDate, forwardStartDate, maturity); }