class DiscountingRatePaymentPeriodPricer implements SwapPaymentPeriodPricer<RatePaymentPeriod> {

  @Override
  public PointSensitivityBuilder forecastValueSensitivity(RatePaymentPeriod period, RatesProvider provider) {
    // historic payments have zero sensi
    if (period.getPaymentDate().isBefore(provider.getValuationDate())) {
      return PointSensitivityBuilder.none();
    }
    PointSensitivityBuilder sensiFx = fxRateSensitivity(period, provider);
    double accrual = accrualWithNotional(period, period.getNotional(), provider);
    sensiFx = sensiFx.multipliedBy(accrual);
    PointSensitivityBuilder sensiAccrual = PointSensitivityBuilder.none();
    if (period.isCompoundingApplicable()) {
      sensiAccrual = accrueCompoundedSensitivity(period, provider);
    } else {
      sensiAccrual = unitNotionalSensitivityNoCompounding(period, provider);
    }
    double notional = period.getNotional() * fxRate(period, provider);
    sensiAccrual = sensiAccrual.multipliedBy(notional);
    return sensiFx.combinedWith(sensiAccrual);
  }

  public  DiscountingRatePaymentPeriodPricer(
      RateComputationFn<RateComputation> rateComputationFn);

}