Examples of PaymentFixedDefinition


Examples of com.opengamma.analytics.financial.instrument.payment.PaymentFixedDefinition

  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testPositiveCoupon() {
    final AnnuityCouponIborDefinition coupon = AnnuityCouponIborDefinition.fromAccrualUnadjusted(START_ACCRUAL_DATE, MATURITY_DATE, 1.0, IBOR_INDEX, false, CALENDAR);
    final AnnuityPaymentFixedDefinition nominal = new AnnuityPaymentFixedDefinition(new PaymentFixedDefinition[] {new PaymentFixedDefinition(CUR, MATURITY_DATE, -1.0) }, CALENDAR);
    new BondIborSecurityDefinition(nominal, coupon, 0, SETTLEMENT_DAYS, CALENDAR, DAY_COUNT, ISSUER_NAME);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.instrument.payment.PaymentFixedDefinition

        throw new OpenGammaRuntimeException("Encountered an EquityBarrierOption with unexpected BarrierType of: " + bUpDown);
    }

    // ForexVanillaOption's are defined in terms of the underlying forward FX transaction, the exchange of two fixed amounts in different currencies.
    // The relative size of the payments implicitly defines the option's strike. So we will build a number of ForexDefinition's below
    final PaymentFixedDefinition quoteCcyPayment = new PaymentFixedDefinition(quoteCcy, settlement, -1 * quoteAmt);
    final PaymentFixedDefinition baseCcyPayment = new PaymentFixedDefinition(baseCcy, settlement, baseAmt);
    final ForexDefinition fxFwd = new ForexDefinition(baseCcyPayment, quoteCcyPayment); // This is what defines the strike, K = quoteAmt / baseAmt
    // We restrike an option by changing the underlying Forex, adjusting the Payments to match the formulae: k = A2/A1, N = A1.
    final ForexDefinition fxFwdForBarrier = new ForexDefinition(baseCcyPayment, new PaymentFixedDefinition(quoteCcy, settlement, -1 * barrier * baseAmt));

    // For the binaries, we do this by adjusting A1' = size * A1; A2' = A1' * newStrike as A1 is the Notional in this interpretation
    final double baseAmtForSpread = size * baseAmt;
    final PaymentFixedDefinition baseCcyPmtForSpread = new PaymentFixedDefinition(baseCcy, settlement, baseAmtForSpread);
    final ForexDefinition fxFwdForNearStrike = new ForexDefinition(baseCcyPmtForSpread, new PaymentFixedDefinition(quoteCcy, settlement, -1 * nearStrike * baseAmtForSpread));
    final ForexDefinition fxFwdForFarStrike = new ForexDefinition(baseCcyPmtForSpread, new PaymentFixedDefinition(quoteCcy, settlement, -1 * farStrike * baseAmtForSpread));


    // Switch  on type
    switch (bInOut) {
      case KNOCK_OUT: // Long a linear at strike, short a linear at barrier, short a binary at barrier of size (barrier-strike)
View Full Code Here

Examples of com.opengamma.analytics.financial.instrument.payment.PaymentFixedDefinition

  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testDifferentCurrencyPayments() {
    final PaymentFixedDefinition[] payments = Arrays.copyOf(FIXED_PAYMENTS, FIXED_PAYMENTS.length);
    payments[0] = new PaymentFixedDefinition(Currency.CAD, DateUtils.getUTCDate(2011, 1, 1), 1000);
    new AnnuityDefinition<>(payments, null);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.instrument.payment.PaymentFixedDefinition

    assertEquals(FIXED_PAYMENTS.length, FIXED_DEFINITION.getNumberOfPayments());
    AnnuityDefinition<PaymentFixedDefinition> other = new AnnuityDefinition<>(FIXED_PAYMENTS, CALENDAR);
    assertEquals(FIXED_DEFINITION, other);
    assertEquals(FIXED_DEFINITION.hashCode(), other.hashCode());
    final PaymentFixedDefinition[] payments = Arrays.copyOf(FIXED_PAYMENTS, FIXED_PAYMENTS.length);
    payments[0] = new PaymentFixedDefinition(CCY, DateUtils.getUTCDate(2011, 1, 1), 10000);
    other = new AnnuityDefinition<>(payments, CALENDAR);
    assertFalse(other.equals(FIXED_DEFINITION));
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.instrument.payment.PaymentFixedDefinition

  @Test
  public void testPayer() {
    assertFalse(FIXED_DEFINITION.isPayer());
    PaymentFixedDefinition[] payments = new PaymentFixedDefinition[FIXED_PAYMENTS.length];
    for (int i = 0; i < FIXED_PAYMENTS.length; i++) {
      payments[i] = new PaymentFixedDefinition(CCY, DateUtils.getUTCDate(2011, 1, 1), -1000);
    }
    assertTrue(new AnnuityDefinition<>(payments, CALENDAR).isPayer());
    payments = Arrays.copyOf(FIXED_PAYMENTS, FIXED_PAYMENTS.length);
    payments[0] = new PaymentFixedDefinition(CCY, DateUtils.getUTCDate(2011, 1, 1), 0);
    assertFalse(FIXED_DEFINITION.isPayer());
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.instrument.payment.PaymentFixedDefinition

    final YieldCurveBundle curves = TestsDataSetsSABR.createCurves1();
    final SABRInterestRateParameters sabrParameter = TestsDataSetsSABR.createSABR1();
    final SABRInterestRateDataBundle sabrBundle = new SABRInterestRateDataBundle(sabrParameter, curves);
    final double expectedPriceLongPayer = 5107666.869;
    final double premiumAmount = expectedPriceLongPayer / curves.getCurve(FUNDING_CURVE_NAME).getDiscountFactor(SWAPTION_LONG_PAYER.getSettlementTime());
    final PaymentFixedDefinition premiumDefinition = new PaymentFixedDefinition(CUR, SETTLEMENT_DATE, -premiumAmount);
    final PaymentFixed premium = premiumDefinition.toDerivative(REFERENCE_DATE, CURVES_NAME);
    final double pvPremium = premium.accept(PVC, sabrBundle);
    final double swaptionPV = SWAPTION_LONG_PAYER.accept(PVC, sabrBundle);
    assertEquals("swaption present value with premium", -expectedPriceLongPayer, pvPremium, 1.0E-2);
    assertEquals("swaption present value with premium", expectedPriceLongPayer, swaptionPV, 1.0E-2);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.instrument.payment.PaymentFixedDefinition

  @Test
  public void testGetter() {
    final PaymentFixedDefinition[] payment = new PaymentFixedDefinition[PAYMENT_DATE.length];
    for (int looppay = 0; looppay < PAYMENT_DATE.length; looppay++) {
      payment[looppay] = new PaymentFixedDefinition(CUR, PAYMENT_DATE[looppay], PAYMENT_AMOUNT[looppay]);
    }
    final AnnuityPaymentFixedDefinition annuity = new AnnuityPaymentFixedDefinition(payment, CALENDAR);
    assertEquals(CUR, annuity.getCurrency());
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.instrument.payment.PaymentFixedDefinition

    final PaymentFixedDefinition[] annuityDefinitions = new PaymentFixedDefinition[PAYMENT_DATE.length];
    PaymentFixed[] payment = new PaymentFixed[PAYMENT_DATE.length];
    ZonedDateTime date = DateUtils.getUTCDate(2011, 6, 19);
    final String name = "A";
    for (int looppay = 0; looppay < PAYMENT_DATE.length; looppay++) {
      annuityDefinitions[looppay] = new PaymentFixedDefinition(CUR, PAYMENT_DATE[looppay], PAYMENT_AMOUNT[looppay]);
      payment[looppay] = annuityDefinitions[looppay].toDerivative(date, name);
    }
    final AnnuityPaymentFixedDefinition definition = new AnnuityPaymentFixedDefinition(annuityDefinitions, CALENDAR);
    AnnuityPaymentFixed annuity = new AnnuityPaymentFixed(payment);
    assertEquals(annuity, definition.toDerivative(date, name));
    date = DateUtils.getUTCDate(2011, 8, 19);
    payment = new PaymentFixed[PAYMENT_DATE.length - 1];
    for (int looppay = 0; looppay < PAYMENT_DATE.length; looppay++) {
      annuityDefinitions[looppay] = new PaymentFixedDefinition(CUR, PAYMENT_DATE[looppay], PAYMENT_AMOUNT[looppay]);
      if (looppay > 0) {
        payment[looppay - 1] = annuityDefinitions[looppay].toDerivative(date, name);
      }
    }
    annuity = new AnnuityPaymentFixed(payment);
View Full Code Here

Examples of com.opengamma.analytics.financial.instrument.payment.PaymentFixedDefinition

  public void testConverter() {
    final PaymentFixedDefinition[] annuityDefinitions = new PaymentFixedDefinition[PAYMENT_DATE.length];
    PaymentFixed[] payment = new PaymentFixed[PAYMENT_DATE.length];
    ZonedDateTime date = DateUtils.getUTCDate(2011, 6, 19);
    for (int looppay = 0; looppay < PAYMENT_DATE.length; looppay++) {
      annuityDefinitions[looppay] = new PaymentFixedDefinition(CUR, PAYMENT_DATE[looppay], PAYMENT_AMOUNT[looppay]);
      payment[looppay] = annuityDefinitions[looppay].toDerivative(date);
    }
    final AnnuityPaymentFixedDefinition definition = new AnnuityPaymentFixedDefinition(annuityDefinitions, CALENDAR);
    AnnuityPaymentFixed annuity = new AnnuityPaymentFixed(payment);
    assertEquals(annuity, definition.toDerivative(date));
    date = DateUtils.getUTCDate(2011, 8, 19);
    payment = new PaymentFixed[PAYMENT_DATE.length - 1];
    for (int looppay = 0; looppay < PAYMENT_DATE.length; looppay++) {
      annuityDefinitions[looppay] = new PaymentFixedDefinition(CUR, PAYMENT_DATE[looppay], PAYMENT_AMOUNT[looppay]);
      if (looppay > 0) {
        payment[looppay - 1] = annuityDefinitions[looppay].toDerivative(date);
      }
    }
    annuity = new AnnuityPaymentFixed(payment);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.