}
static YieldCurveBundle bundle = getBundle(y);
public static void interestRateDerivativeDemo(final PrintStream out) {
final Cash loan = new Cash(ccy, 0.0, t, notional, r, t, yieldCurveName);
// @export "interestRateDerivatives-presentValue"
final YieldCurveBundle bundle = getBundle(y);
for (double i = 1.0; i < 3.0; i += 1) {
out.format("Yield curve interest rate at %f: %f%n", i, yieldCurve.getInterestRate(i));
out.format("Yield curve discount factor at %f: %f%n", i, yieldCurve.getDiscountFactor(i));
}
final double presentValue = loan.accept(presentValueCalculator, bundle);
out.format("Present value of loan using this yield curve bundle %f%n", presentValue);
final double zeroCouponDiscountFactor = yieldCurve.getDiscountFactor(t);
final double checkCalculation = notional * (zeroCouponDiscountFactor * (1 + r * t) - 1);
out.format("Manually calculating value of loan gives %f%n", checkCalculation);