Examples of PaymentFixedDefinition


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

    ArgumentChecker.notNull(index, "index");
    final AnnuityDefinition<CouponIborSpreadDefinition> legNoNotional = annuityIborSpreadFrom(settlementDate, maturityDate, notional, index, spread, isPayer, calendar);
    final double sign = (isPayer) ? -1.0 : 1.0;
    final int nbPay = legNoNotional.getNumberOfPayments();
    final PaymentDefinition[] legWithNotional = new PaymentDefinition[nbPay + 2];
    legWithNotional[0] = new PaymentFixedDefinition(legNoNotional.getCurrency(), settlementDate, -notional * sign);
    for (int loopp = 0; loopp < nbPay; loopp++) {
      legWithNotional[loopp + 1] = legNoNotional.getNthPayment(loopp);
    }
    legWithNotional[nbPay + 1] = new PaymentFixedDefinition(legNoNotional.getCurrency(), legNoNotional.getNthPayment(nbPay - 1).getPaymentDate(), notional * sign);
    return new AnnuityDefinition<>(legWithNotional, calendar);
  }
View Full Code Here

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

    ArgumentChecker.notNull(premiumDate, "premium date");
    _underlyingOption = underlyingOption;
    _quantity = quantity;
    _tradePrice = tradePrice;
    final double premiumAmount = _tradePrice * _underlyingOption.getUnderlyingFuture().getNotional() * _underlyingOption.getUnderlyingFuture().getPaymentAccrualFactor();
    _premium = new PaymentFixedDefinition(underlyingOption.getCurrency(), premiumDate, premiumAmount);
  }
View Full Code Here

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

   */
  //REVIEW: the method that this is testing (one that took an array of InstrumentDerivative has gone - leaving this test in for now
  public void presentValueWithPremium() {
    final double expectedPriceLongPayer = 2419978.690;
    final double premiumAmount = expectedPriceLongPayer / MULTICURVES.getDiscountFactor(EUR, SWAPTION_LONG_PAYER.getSettlementTime());
    final PaymentFixedDefinition premiumDefinition = new PaymentFixedDefinition(EUR, SETTLEMENT_DATE, -premiumAmount);
    final PaymentFixed premium = premiumDefinition.toDerivative(REFERENCE_DATE);
    final MultipleCurrencyAmount pvPremium = premium.accept(PVDC, MULTICURVES);
    final MultipleCurrencyAmount swaptionPV = SWAPTION_LONG_PAYER.accept(PVSSC, SABR_MULTICURVES);
    assertEquals("swaption present value with premium", -expectedPriceLongPayer, pvPremium.getAmount(EUR), TOLERANCE_PV);
    assertEquals("swaption present value with premium", expectedPriceLongPayer, swaptionPV.getAmount(EUR), TOLERANCE_PV);
  }
View Full Code Here

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

  public ForexDefinition(final Currency currency1, final Currency currency2, final ZonedDateTime exchangeDate, final double amountCurrency1, final double fxRate) {
    ArgumentChecker.notNull(currency1, "Currency 1");
    ArgumentChecker.notNull(currency2, "Currency 2");
    ArgumentChecker.notNull(exchangeDate, "Exchange date");
    ArgumentChecker.isTrue(fxRate > 0, "FX rate must be positive");
    _paymentCurrency1 = new PaymentFixedDefinition(currency1, exchangeDate, amountCurrency1);
    _paymentCurrency2 = new PaymentFixedDefinition(currency2, exchangeDate, -amountCurrency1 * fxRate);
  }
View Full Code Here

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

      final double amountCurrency2) {
    ArgumentChecker.notNull(currency1, "Currency 1");
    ArgumentChecker.notNull(currency2, "Currency 2");
    ArgumentChecker.notNull(exchangeDate, "Exchange date");
    ArgumentChecker.isTrue(amountCurrency1 * amountCurrency2 <= 0, "Amounts should have different signs");
    final PaymentFixedDefinition paymentCurrency1 = new PaymentFixedDefinition(currency1, exchangeDate, amountCurrency1);
    final PaymentFixedDefinition paymentCurrency2 = new PaymentFixedDefinition(currency2, exchangeDate, amountCurrency2);
    return new ForexDefinition(paymentCurrency1, paymentCurrency2);
  }
View Full Code Here

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

      throw new OpenGammaRuntimeException("Could not get EOM convention information from " + conventionName);
    }
    final boolean isEOM = convention.isEOMConvention();
    final YieldConvention yieldConvention = security.getYieldConvention();
    if (security.getCouponType().equals("NONE") || security.getCouponType().equals("ZERO COUPON")) { //TODO find where string is
      return new PaymentFixedDefinition(currency, maturityDate, 1);
    }
    if (convention.getBondSettlementDays(firstAccrualDate, maturityDate) == null) {
      throw new OpenGammaRuntimeException("Could not get bond settlement days from " + conventionName);
    }
    final int settlementDays = convention.getBondSettlementDays(firstAccrualDate, maturityDate);
View Full Code Here

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

  }

  @Test
  public void leg1() {
    // The first payment is a fixed payment with -notional
    final PaymentFixedDefinition exchangeNotionalStart = new PaymentFixedDefinition(XCCY_GENERATOR.getIborIndex1().getCurrency(), SETTLEMENT_DATE, -NOTIONAL1 * SIGN_1);
    assertEquals("SwapXCcyIborIborDefinition", exchangeNotionalStart, SWAP_XCCY_IBOR_IBOR.getFirstLeg().getNthPayment(0));
    // The last payment is a fixed payment with notional
    final int nbPayments = SWAP_XCCY_IBOR_IBOR.getFirstLeg().getNumberOfPayments();
    final PaymentFixedDefinition exchangeNotionalEnd = new PaymentFixedDefinition(XCCY_GENERATOR.getIborIndex1().getCurrency(), MATURITY_DATE, NOTIONAL1 * SIGN_1);
    assertEquals("SwapXCcyIborIborDefinition", exchangeNotionalEnd, SWAP_XCCY_IBOR_IBOR.getFirstLeg().getNthPayment(nbPayments - 1));
    // The intermediary payments are coupons from the floating leg
    for (int loopcpn = 0; loopcpn < nbPayments - 2; loopcpn++) {
      assertEquals("SwapXCcyIborIborDefinition", IBOR_LEG_1.getNthPayment(loopcpn), SWAP_XCCY_IBOR_IBOR.getFirstLeg().getNthPayment(loopcpn + 1));
    }
View Full Code Here

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

  }

  @Test
  public void leg2() {
    // The first payment is a fixed payment with -notional
    final PaymentFixedDefinition exchangeNotionalStart = new PaymentFixedDefinition(XCCY_GENERATOR.getIborIndex2().getCurrency(), SETTLEMENT_DATE, NOTIONAL2 * SIGN_1);
    assertEquals("SwapXCcyIborIborDefinition", exchangeNotionalStart, SWAP_XCCY_IBOR_IBOR.getSecondLeg().getNthPayment(0));
    // The last payment is a fixed payment with notional
    final int nbPayments = SWAP_XCCY_IBOR_IBOR.getSecondLeg().getNumberOfPayments();
    final PaymentFixedDefinition exchangeNotionalEnd = new PaymentFixedDefinition(XCCY_GENERATOR.getIborIndex2().getCurrency(), MATURITY_DATE, -NOTIONAL2 * SIGN_1);
    assertEquals("SwapXCcyIborIborDefinition", exchangeNotionalEnd, SWAP_XCCY_IBOR_IBOR.getSecondLeg().getNthPayment(nbPayments - 1));
    // The intermediary payments are coupons from the floating leg
    for (int loopcpn = 0; loopcpn < nbPayments - 2; loopcpn++) {
      assertEquals("SwapXCcyIborIborDefinition", IBOR_LEG_2.getNthPayment(loopcpn), SWAP_XCCY_IBOR_IBOR.getSecondLeg().getNthPayment(loopcpn + 1));
    }
View Full Code Here

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

      throw new OpenGammaRuntimeException("Could not get EOM convention information from " + conventionName);
    }
    final boolean isEOM = convention.isEOMConvention();
    final YieldConvention yieldConvention = security.getYieldConvention();
    if (security.getCouponType().equals("NONE") || security.getCouponType().equals("ZERO COUPON")) { //TODO find where string is
      return new PaymentFixedDefinition(currency, maturityDate, 1);
    }
    if (convention.getBondSettlementDays(firstAccrualDate, maturityDate) == null) {
      throw new OpenGammaRuntimeException("Could not get bond settlement days from " + conventionName);
    }
    final int settlementDays = convention.getBondSettlementDays(firstAccrualDate, maturityDate);
View Full Code Here

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

    final FXForwardNode node = new FXForwardNode(Tenor.of(Period.ZERO), tenorFx, FX_FORWARD_ID, Currency.USD, Currency.CAD, "Mapper");
    final CurveNodeVisitor<InstrumentDefinition<?>> converter = new FXForwardNodeConverter(CONVENTION_SOURCE, HOLIDAY_SOURCE, REGION_SOURCE, marketValues, marketDataId, NOW);
    final InstrumentDefinition<?> definition = node.accept(converter);
    final ZonedDateTime spotDate = ScheduleCalculator.getAdjustedDate(NOW, FX_SPOT.getSettlementDays(), CALENDAR);
    final ZonedDateTime payDate = ScheduleCalculator.getAdjustedDate(spotDate, tenorFx.getPeriod(), FX_FORWARD.getBusinessDayConvention(), CALENDAR, FX_FORWARD.isIsEOM());
    final PaymentFixedDefinition payment1 = new PaymentFixedDefinition(Currency.USD, payDate, 1);
    final PaymentFixedDefinition payment2 = new PaymentFixedDefinition(Currency.CAD, payDate, -forward);
    assertEquals(new ForexDefinition(payment1, payment2), definition);
  }
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.