throw new OpenGammaRuntimeException("Could not get convention with id " + underlyingConventionId);
}
if (!(underlyingConvention instanceof FXSpotConvention)) {
throw new OpenGammaRuntimeException("Need a convention of type " + FXSpotConvention.class + ", have " + convention.getClass());
}
final FXSpotConvention spotConvention = (FXSpotConvention) underlyingConvention;
final Currency payCurrency = fxForward.getPayCurrency();
final Currency receiveCurrency = fxForward.getReceiveCurrency();
final Tenor forwardTenor = fxForward.getMaturityTenor();
final double payAmount = 1;
final double receiveAmount = forward;
final int settlementDays = spotConvention.getSettlementDays();
final ExternalId settlementRegion = forwardConvention.getSettlementRegion();
final Calendar settlementCalendar = CalendarUtils.getCalendar(_regionSource, _holidaySource, settlementRegion);
final ZonedDateTime spotDate = ScheduleCalculator.getAdjustedDate(_valuationTime, settlementDays, settlementCalendar);
final ZonedDateTime exchangeDate = ScheduleCalculator.getAdjustedDate(spotDate, forwardTenor.getPeriod(), forwardConvention.getBusinessDayConvention(), settlementCalendar,
forwardConvention.isIsEOM());