Package com.opengamma.analytics.financial.interestrate.payments.derivative

Examples of com.opengamma.analytics.financial.interestrate.payments.derivative.PaymentFixed


    ArgumentChecker.notNull(yieldCurveNames, "yield curve names");
    ArgumentChecker.isTrue(yieldCurveNames.length > 0, "at least one curve required");
    ArgumentChecker.isTrue(!date.isAfter(getPaymentDate()), "date {} is after payment date {}", date, getPaymentDate());
    final String fundingCurveName = yieldCurveNames[0];
    final double paymentTime = TimeCalculator.getTimeBetween(date, getPaymentDate());
    return new PaymentFixed(getCurrency(), paymentTime, _amount, fundingCurveName);
  }
View Full Code Here


  @Override
  public PaymentFixed toDerivative(final ZonedDateTime date) {
    ArgumentChecker.notNull(date, "date");
    ArgumentChecker.isTrue(!date.isAfter(getPaymentDate()), "date {} is after payment date {}", date, getPaymentDate());
    final double paymentTime = TimeCalculator.getTimeBetween(date, getPaymentDate());
    return new PaymentFixed(getCurrency(), paymentTime, _amount);
  }
View Full Code Here

    final BondFutureOptionPremiumSecurity modifiedSec = FVU1_C120_SEC_DEFINITION.toDerivative(REFERENCE_DATE.plusDays(1));
    modified = new BondFutureOptionPremiumTransaction(modifiedSec, QUANTITY, PREMIUM);
    assertFalse(FVU1_C120_TRA.equals(modified));
    modified = new BondFutureOptionPremiumTransaction(FVU1_C120_SEC, QUANTITY + 1, PREMIUM);
    assertFalse(FVU1_C120_TRA.equals(modified));
    modified = new BondFutureOptionPremiumTransaction(FVU1_C120_SEC, QUANTITY, new PaymentFixed(FVU1_C120_SEC.getCurrency(), TimeCalculator.getTimeBetween(REFERENCE_DATE, PREMIUM_DATE),
        PREMIUM_AMOUNT + 1.0));
    assertFalse(FVU1_C120_TRA.equals(modified));
    assertFalse(FVU1_C120_TRA.equals(EXPIRATION_DATE));
    assertFalse(FVU1_C120_TRA.equals(null));
  }
View Full Code Here

    final double[] amounts = new double[] {100000, 1, 234, 452, 0.034}; //{100000, 1, 234, -452, 0.034}
    final String[] curveNames = new String[] {FIVE_PC_CURVE_NAME, FIVE_PC_CURVE_NAME, ZERO_PC_CURVE_NAME, FIVE_PC_CURVE_NAME, FIVE_PC_CURVE_NAME};

    final Payment[] payments = new Payment[5];
    for (int i = 0; i < n; i++) {
      payments[i] = new PaymentFixed(CUR, times[i], amounts[i], curveNames[i]);
    }

    final Annuity<Payment> annuity = new Annuity<>(payments);
    final Map<String, List<DoublesPair>> sense = annuity.accept(PVSC, CURVES);
    final List<DoublesPair> sense0FD = curveSensitvityFDCalculator(annuity, PVC, CURVES, ZERO_PC_CURVE_NAME, times, eps);
View Full Code Here

  @Test
  public void testFixedPayment() {
    final double eps = 1e-9;
    final double time = 1.23;
    final double amount = 4345.3;
    final PaymentFixed payment = new PaymentFixed(CUR, time, amount, FIVE_PC_CURVE_NAME);

    final Map<String, List<DoublesPair>> sense = payment.accept(PVSC, CURVES);
    assertFalse(sense.containsKey(ZERO_PC_CURVE_NAME));
    final double senseFD = curveSensitvityFDCalculator(payment, PVC, CURVES, FIVE_PC_CURVE_NAME, time);
    assertEquals(senseFD, sense.get(FIVE_PC_CURVE_NAME).get(0).second, eps * amount);
  }
View Full Code Here

    for (int i = 0; i < n; i++) {
      coupons[i] = new CouponFixed(CUR, tau * (i + 1), FIVE_PC_CURVE_NAME, yearFrac, coupon);
      couponsUp[i] = new CouponFixed(CUR, tau * (i + 1), FIVE_PC_CURVE_NAME, yearFrac, coupon + DELTA);
      couponsDown[i] = new CouponFixed(CUR, tau * (i + 1), FIVE_PC_CURVE_NAME, yearFrac, coupon - DELTA);
    }
    final AnnuityPaymentFixed nominal = new AnnuityPaymentFixed(new PaymentFixed[] {new PaymentFixed(CUR, tau * n, 1, FIVE_PC_CURVE_NAME)});
    final BondFixedSecurity bond = new BondFixedSecurity(nominal, new AnnuityCouponFixed(coupons), 0, 0, 0.5, SimpleYieldConvention.TRUE, 2, FIVE_PC_CURVE_NAME, "S");
    final BondFixedSecurity bondUp = new BondFixedSecurity(nominal, new AnnuityCouponFixed(couponsUp), 0, 0, 0.5, SimpleYieldConvention.TRUE, 2, FIVE_PC_CURVE_NAME, "S");
    final BondFixedSecurity bondDown = new BondFixedSecurity(nominal, new AnnuityCouponFixed(couponsDown), 0, 0, 0.5, SimpleYieldConvention.TRUE, 2, FIVE_PC_CURVE_NAME, "S");
    final double pvUp = bondUp.accept(PVC, CURVES);
    final double pvDown = bondDown.accept(PVC, CURVES);
View Full Code Here

    final BondFutureOptionPremiumSecurity modifiedSec = FVU1_C120_SEC_DEFINITION.toDerivative(REFERENCE_DATE.plusDays(1), CURVE_NAMES);
    modified = new BondFutureOptionPremiumTransaction(modifiedSec, QUANTITY, PREMIUM);
    assertFalse(FVU1_C120_TRA.equals(modified));
    modified = new BondFutureOptionPremiumTransaction(FVU1_C120_SEC, QUANTITY + 1, PREMIUM);
    assertFalse(FVU1_C120_TRA.equals(modified));
    modified = new BondFutureOptionPremiumTransaction(FVU1_C120_SEC, QUANTITY, new PaymentFixed(FVU1_C120_SEC.getCurrency(), TimeCalculator.getTimeBetween(REFERENCE_DATE, PREMIUM_DATE),
        PREMIUM_AMOUNT + 1.0, FVU1_C120_SEC.getDiscountingCurveName()));
    assertFalse(FVU1_C120_TRA.equals(modified));
    assertFalse(FVU1_C120_TRA.equals(EXPIRATION_DATE));
    assertFalse(FVU1_C120_TRA.equals(null));
  }
View Full Code Here

  }

  @Test
  public void testBond() {
    final double mat = 1.0;
    final AnnuityPaymentFixed nominal = new AnnuityPaymentFixed(new PaymentFixed[] {new PaymentFixed(CUR, mat, 1.0) });
    final AnnuityCouponFixed coupon = new AnnuityCouponFixed(CUR, new double[] {0.5, mat }, 0.03, false);
    final BondFixedSecurity bond = new BondFixedSecurity(nominal, coupon, 0, 0, 0.5, SimpleYieldConvention.TRUE, 2, "Issuer");
    assertEquals(mat, bond.accept(LDC), 1e-12);
  }
View Full Code Here

  }

  @Test
  public void testForex() {
    final double t = 0.124;
    final Forex fx = new Forex(new PaymentFixed(Currency.AUD, t, -100), new PaymentFixed(Currency.USD, t, 100));
    assertEquals(fx.accept(LDC), t, 0);
  }
View Full Code Here

    final double coupon = (1.0 / curve.getDiscountFactor(tau) - 1.0) / yearFrac;
    final CouponFixed[] coupons = new CouponFixed[n];
    for (int i = 0; i < n; i++) {
      coupons[i] = new CouponFixed(CUR, tau * (i + 1), FIVE_PC_CURVE_NAME, yearFrac, coupon);
    }
    final AnnuityPaymentFixed nominal = new AnnuityPaymentFixed(new PaymentFixed[] {new PaymentFixed(CUR, tau * n, 1, FIVE_PC_CURVE_NAME)});
    final BondFixedSecurity bond = new BondFixedSecurity(nominal, new AnnuityCouponFixed(coupons), 0, 0, 0.5, SimpleYieldConvention.TRUE, 2, FIVE_PC_CURVE_NAME, "S");
    final double pv = bond.accept(PVC, CURVES);
    assertEquals(1.0, pv, 1e-12);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.interestrate.payments.derivative.PaymentFixed

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.