public virtual void test_presentValue() { MultiCurrencyAmount computed1 = PRICER.presentValue(CAP_ONE_LEG, RATES, VOLS); MultiCurrencyAmount computed2 = PRICER.presentValue(CAP_TWO_LEGS, RATES, VOLS); CurrencyAmount cap = PRICER_CAP_LEG.presentValue(CAP_LEG, RATES, VOLS); CurrencyAmount pay = PRICER_PAY_LEG.presentValue(PAY_LEG, RATES); assertEquals(computed1, MultiCurrencyAmount.of(cap)); assertEquals(computed2, MultiCurrencyAmount.of(cap.plus(pay))); }
public virtual void test_presentValue() { MultiCurrencyAmount computedWithPayLeg = PRICER.presentValue(TRADE_PAYLEG, RATES, VOLS); MultiCurrencyAmount computedWithPremium = PRICER.presentValue(TRADE_PREMIUM, RATES, VOLS); MultiCurrencyAmount pvOneLeg = PRICER_PRODUCT.presentValue(CAP_ONE_LEG, RATES, VOLS); MultiCurrencyAmount pvTwoLegs = PRICER_PRODUCT.presentValue(CAP_TWO_LEGS, RATES, VOLS); CurrencyAmount pvPrem = PRICER_PREMIUM.presentValue(PREMIUM, RATES); assertEquals(computedWithPayLeg, pvTwoLegs); assertEquals(computedWithPremium, pvOneLeg.plus(pvPrem)); }