*/
//REVIEW emcleod This method does not belong in this class
@Deprecated
public InstrumentDerivative[] calibrationBasket(final RatchetIborCalibrationType type, final YieldCurveBundle curves) {
final ArrayList<InstrumentDerivative> calibration = new ArrayList<>();
final ParRateCalculator prc = ParRateCalculator.getInstance();
switch (type) {
case FORWARD_COUPON:
final int nbCpn = getNumberOfPayments();
final double[] cpnRate = new double[nbCpn];
for (int loopcpn = 0; loopcpn < nbCpn; loopcpn++) {
if (getNthPayment(loopcpn) instanceof CouponIborRatchet) {
final CouponIborRatchet cpn = (CouponIborRatchet) getNthPayment(loopcpn);
final double ibor = prc.visitCouponIborSpread(cpn, curves);
final double cpnMain = cpn.getMainCoefficients()[0] * cpnRate[loopcpn - 1] + cpn.getMainCoefficients()[1] * ibor + cpn.getMainCoefficients()[2];
final double cpnFloor = cpn.getFloorCoefficients()[0] * cpnRate[loopcpn - 1] + cpn.getFloorCoefficients()[1] * ibor + cpn.getFloorCoefficients()[2];
final double cpnCap = cpn.getCapCoefficients()[0] * cpnRate[loopcpn - 1] + cpn.getCapCoefficients()[1] * ibor + cpn.getCapCoefficients()[2];
cpnRate[loopcpn] = Math.min(Math.max(cpnFloor, cpnMain), cpnCap);
calibration.add(new CapFloorIbor(cpn.getCurrency(), cpn.getPaymentTime(), cpn.getFundingCurveName(), cpn.getPaymentYearFraction(), cpn.getNotional(), cpn.getFixingTime(), cpn.getIndex(),
cpn.getFixingPeriodStartTime(), cpn.getFixingPeriodEndTime(), cpn.getFixingAccrualFactor(), cpn.getForwardCurveName(), cpnRate[loopcpn], true));
} else {
if (getNthPayment(loopcpn) instanceof CouponFixed) {
final CouponFixed cpn = (CouponFixed) getNthPayment(loopcpn);
cpnRate[loopcpn] = cpn.getFixedRate();
} else {
final CouponIborGearing cpn = (CouponIborGearing) getNthPayment(loopcpn);
final double ibor = prc.visitCouponIborGearing(cpn, curves);
cpnRate[loopcpn] = cpn.getFactor() * ibor + cpn.getSpread();
}
}
}
break;