class IsdaHomogenousCdsIndexProductPricer {

  public CurrencyAmount expectedLoss(
      ResolvedCdsIndex cdsIndex,
      CreditRatesProvider ratesProvider) {

    if (isExpired(cdsIndex, ratesProvider)) {
      return CurrencyAmount.of(cdsIndex.getCurrency(), 0d);
    }
    ResolvedCds cds = cdsIndex.toSingleNameCds();
    double recoveryRate = underlyingPricer.recoveryRate(cds, ratesProvider);
    Triple<CreditDiscountFactors, LegalEntitySurvivalProbabilities, Double> rates = reduceDiscountFactors(cds, ratesProvider);
    double survivalProbability = rates.getSecond().survivalProbability(cds.getProtectionEndDate());
    double el = (1d - recoveryRate) * (1d - survivalProbability) * rates.getThird();
    return CurrencyAmount.of(cds.getCurrency(), Math.abs(cds.getNotional()) * el);
  }

  public  IsdaHomogenousCdsIndexProductPricer(AccrualOnDefaultFormula formula);

}