if (underlyingConvention == null) {
throw new OpenGammaRuntimeException("Could not get convention with id " + convention.getIborIndexConvention());
}
throw new OpenGammaRuntimeException("Convention of the underlying was not an ibor index convention; have " + underlyingConvention.getClass());
}
final IborIndexConvention indexConvention = (IborIndexConvention) underlyingConvention;
final Currency currency = indexConvention.getCurrency();
final DayCount dayCount = indexConvention.getDayCount();
final BusinessDayConvention businessDayConvention = indexConvention.getBusinessDayConvention();
final boolean eomIndex = indexConvention.isIsEOM();
final boolean eomLeg = convention.isIsEOM();
final Period indexTenor = convention.getResetTenor().getPeriod();
final Calendar calendar = CalendarUtils.getCalendar(_regionSource,
_holidaySource,
indexConvention.getFixingCalendar());
final int spotLag = indexConvention.getSettlementDays();
final IborIndex iborIndex = new IborIndex(currency,
indexTenor,
spotLag,
dayCount,
businessDayConvention,
eomIndex,
indexConvention.getName());
final Period maturityTenor = swapNode.getMaturityTenor().getPeriod();
final int spotLagLeg = convention.getSettlementDays();
final ZonedDateTime spotDateLeg = ScheduleCalculator.getAdjustedDate(_valuationTime, spotLagLeg, calendar);
final ZonedDateTime startDate = ScheduleCalculator.getAdjustedDate(spotDateLeg,
swapNode.getStartTenor().getPeriod(),
businessDayConvention,
calendar,
eomLeg);
if (isFloatFloat) {
//return AnnuityCouponIborSpreadDefinition.from(startDate, maturityTenor, 1, iborIndex, spread, isPayer, calendar);
return Pair.of(new FloatingSpreadIRLeg(dayCount,
PeriodFrequency.of(convention.getResetTenor().getPeriod()),
indexConvention.getRegionCalendar(),
businessDayConvention,
new InterestRateNotional(currency, _amount),
eomLeg,
floatingReferenceRateId,
FloatingRateType.IBOR,
_rate),
Triple.of(startDate, spotDateLeg, _valuationTime.plus(maturityTenor)));
}
//return AnnuityCouponIborDefinition.from(startDate, maturityTenor, 1, iborIndex, isPayer, calendar);
return Pair.of(new FloatingInterestRateLeg(dayCount,
PeriodFrequency.of(maturityTenor),
indexConvention.getRegionCalendar(),
businessDayConvention,
new InterestRateNotional(currency, _amount),
eomLeg,
floatingReferenceRateId, FloatingRateType.IBOR),
Triple.of(startDate, spotDateLeg, _valuationTime.plus(maturityTenor)));