class IsdaCdsProductPricer {

  public CurrencyAmount expectedLoss(
      ResolvedCds cds,
      CreditRatesProvider ratesProvider) {

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

  public  IsdaCdsProductPricer(AccrualOnDefaultFormula formula);

}