// assertEquals((price - deltaPrice) * notional * paymentAccrualFactor * quantity, pv, 1e-12);
// }
@Test
public void testFixedCouponAnnuity() {
AnnuityCouponFixed annuityReceiver = new AnnuityCouponFixed(CUR, new double[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, 1.0, ZERO_PC_CURVE_NAME, false);
double pv = annuityReceiver.accept(PVC, CURVES);
assertEquals(10.0, pv, 1e-12);
final int n = 15;
final double alpha = 0.49;
final double yearFrac = 0.51;
final double[] paymentTimes = new double[n];
final double[] coupons = new double[n];
final double[] yearFracs = new double[n];
final YieldAndDiscountCurve curve = CURVES.getCurve(FIVE_PC_CURVE_NAME);
final double rate = curve.getInterestRate(0.0);
for (int i = 0; i < n; i++) {
paymentTimes[i] = (i + 1) * alpha;
coupons[i] = Math.exp((i + 1) * rate * alpha);
yearFracs[i] = yearFrac;
}
annuityReceiver = new AnnuityCouponFixed(CUR, paymentTimes, Math.PI, rate, yearFracs, ZERO_PC_CURVE_NAME, false);
pv = annuityReceiver.accept(PVC, CURVES);
assertEquals(n * yearFrac * rate * Math.PI, pv, 1e-12);
final AnnuityCouponFixed annuityPayer = new AnnuityCouponFixed(CUR, paymentTimes, Math.PI, rate, yearFracs, ZERO_PC_CURVE_NAME, true);
assertEquals(pv, -annuityPayer.accept(PVC, CURVES), 1e-12);
}