Examples of toDerivative()


Examples of com.opengamma.analytics.financial.instrument.cash.DepositCounterpartDefinition.toDerivative()

  public void parSpreadBeforeStart() {
    final ZonedDateTime referenceDate = TRADE_DATE;
    final DepositCounterpart deposit = DEPOSIT_CPTY_DEFINITION.toDerivative(referenceDate);
    final double parSpread = METHOD_DEPOSIT.parSpread(deposit, PROVIDER_ISSUER);
    final DepositCounterpartDefinition deposit0Definition = DepositCounterpartDefinition.fromStart(SPOT_DATE, DEPOSIT_PERIOD, NOTIONAL, RATE + parSpread, GENERATOR, ISSUER_NAME);
    final DepositCounterpart deposit0 = deposit0Definition.toDerivative(referenceDate);
    final MultipleCurrencyAmount pv0 = METHOD_DEPOSIT.presentValue(deposit0, PROVIDER_ISSUER);
    assertEquals("DepositDefinition: present value", 0, pv0.getAmount(EUR), TOLERANCE_PV);
  }

  @Test
View Full Code Here

Examples of com.opengamma.analytics.financial.instrument.cash.DepositCounterpartDefinition.toDerivative()

  public void parSpreadOnStart() {
    final ZonedDateTime referenceDate = DEPOSIT_CPTY_DEFINITION.getStartDate();
    final DepositCounterpart deposit = DEPOSIT_CPTY_DEFINITION.toDerivative(referenceDate);
    final double parSpread = METHOD_DEPOSIT.parSpread(deposit, PROVIDER_ISSUER);
    final DepositCounterpartDefinition deposit0Definition = DepositCounterpartDefinition.fromStart(SPOT_DATE, DEPOSIT_PERIOD, NOTIONAL, RATE + parSpread, GENERATOR, ISSUER_NAME);
    final DepositCounterpart deposit0 = deposit0Definition.toDerivative(referenceDate);
    final MultipleCurrencyAmount pv0 = METHOD_DEPOSIT.presentValue(deposit0, PROVIDER_ISSUER);
    assertEquals("DepositDefinition: present value", 0, pv0.getAmount(EUR), TOLERANCE_PV);
  }

  @Test
View Full Code Here

Examples of com.opengamma.analytics.financial.instrument.cash.DepositCounterpartDefinition.toDerivative()

  public void parSpreadAfterStart() {
    final ZonedDateTime referenceDate = ScheduleCalculator.getAdjustedDate(DEPOSIT_CPTY_DEFINITION.getStartDate(), 1, TARGET);
    final DepositCounterpart deposit = DEPOSIT_CPTY_DEFINITION.toDerivative(referenceDate);
    final double parSpread = METHOD_DEPOSIT.parSpread(deposit, PROVIDER_ISSUER); // Spread will be -(1/delta+rate), as there is no initial amount
    final DepositCounterpartDefinition deposit0Definition = DepositCounterpartDefinition.fromStart(SPOT_DATE, DEPOSIT_PERIOD, NOTIONAL, RATE + parSpread, GENERATOR, ISSUER_NAME);
    final DepositCounterpart deposit0 = deposit0Definition.toDerivative(referenceDate);
    final MultipleCurrencyAmount pv0 = METHOD_DEPOSIT.presentValue(deposit0, PROVIDER_ISSUER);
    assertEquals("DepositDefinition: present value", 0, pv0.getAmount(EUR), TOLERANCE_PV);
  }

  @Test
View Full Code Here

Examples of com.opengamma.analytics.financial.instrument.cash.DepositIborDefinition.toDerivative()

  public void parSpreadBeforeStart() {
    final ZonedDateTime referenceDate = TRADE_DATE;
    final DepositIbor deposit = DEPOSIT_IBOR_DEFINITION.toDerivative(referenceDate);
    final double parSpread = METHOD_DEPOSIT.parSpread(deposit, PROVIDER_MULTICURVES);
    final DepositIborDefinition deposit0Definition = DepositIborDefinition.fromTrade(referenceDate, NOTIONAL, RATE + parSpread, EURIBOR3M, CALENDAR);
    final DepositIbor deposit0 = deposit0Definition.toDerivative(referenceDate);
    final MultipleCurrencyAmount pv0 = METHOD_DEPOSIT.presentValue(deposit0, PROVIDER_MULTICURVES);
    assertEquals("DepositDefinition: present value", 0, pv0.getAmount(EUR), TOLERANCE_PV);
  }

  @Test
View Full Code Here

Examples of com.opengamma.analytics.financial.instrument.cash.DepositZeroDefinition.toDerivative()

  public void parSpreadTrade() {
    final ZonedDateTime referenceDate = DateUtils.getUTCDate(2011, 12, 12);
    final DepositZero deposit = DEPOSIT_DEFINITION.toDerivative(referenceDate, CURVES_NAME[0]);
    final double psMethod = METHOD_DEPOSIT.parSpread(deposit, CURVES);
    final DepositZeroDefinition deposit0Definition = new DepositZeroDefinition(EUR, SPOT_DATE, END_DATE, NOTIONAL, DEPOSIT_AF, new PeriodicInterestRate(RATE_FIGURE + psMethod, 1));
    final DepositZero deposit0 = deposit0Definition.toDerivative(referenceDate, CURVES_NAME[0]);
    final CurrencyAmount pv0 = METHOD_DEPOSIT.presentValue(deposit0, CURVES);
    assertEquals("DepositZero: par spread", 0, pv0.getAmount(), TOLERANCE_PRICE);
    final double psCalculator = deposit.accept(PSC, CURVES);
    assertEquals("DepositZero: par rate", psMethod, psCalculator, TOLERANCE_RATE);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.instrument.cds.ISDACDSDefinition.toDerivative()

    final double[] timePoints = {cds.getMaturity()};
    final double[] dataPoints = {flatSpread};

    final ISDACDSDefinition bootstrapCDSDefinition = makeBootstrapCDSDefinition(cds, flatSpread, calendar);
    final ISDACDSDerivative bootstrapCDS = bootstrapCDSDefinition.toDerivative(pricingDate, stepinDate, settlementDate, cds.getDiscountCurveName(), cds.getSpreadCurveName());

    final double guess = dataPoints[0] / (1.0 - cds.getRecoveryRate());

    dataPoints[0] = HAZARD_SOLVER.findRoot(
      new Function1D<Double, Double>() {
View Full Code Here

Examples of com.opengamma.analytics.financial.instrument.fra.ForwardRateAgreementDefinition.toDerivative()

  @Test
  public void presentValueBuySellParity() {
    final YieldCurveBundle curves = TestsDataSetsSABR.createCurves1();
    final ForwardRateAgreementDefinition fraDefinitionSell = new ForwardRateAgreementDefinition(CUR, PAYMENT_DATE, ACCRUAL_START_DATE, ACCRUAL_END_DATE, ACCRUAL_FACTOR_PAYMENT, -NOTIONAL,
        FIXING_DATE, INDEX, FRA_RATE, CALENDAR);
    final ForwardRateAgreement fraSell = (ForwardRateAgreement) fraDefinitionSell.toDerivative(REFERENCE_DATE, CURVE_NAME_1);
    final CurrencyAmount pvBuy = FRA_METHOD.presentValue(FRA, curves);
    final CurrencyAmount pvSell = FRA_METHOD.presentValue(fraSell, curves);
    assertEquals("FRA discounting: present value - buy/sell parity", pvSell.getAmount(), -pvBuy.getAmount(), 1.0E-2);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.instrument.fra.ForwardRateAgreementDefinition.toDerivative()

  public void parSpread() {
    final ForwardRateAgreement fra2 = (ForwardRateAgreement) FRA_DEFINITION.toDerivative(REFERENCE_DATE, CURVE_NAME_2);
    final double parSpread = FRA_METHOD.parSpread(fra2, CURVES_2);
    final ForwardRateAgreementDefinition fra0Definition = new ForwardRateAgreementDefinition(CUR, PAYMENT_DATE, ACCRUAL_START_DATE, ACCRUAL_END_DATE, ACCRUAL_FACTOR_PAYMENT, NOTIONAL, FIXING_DATE,
        INDEX, FRA_RATE + parSpread, CALENDAR);
    final ForwardRateAgreement fra0 = (ForwardRateAgreement) fra0Definition.toDerivative(REFERENCE_DATE, CURVE_NAME_2);
    final double pv0 = fra0.accept(PVC, CURVES_2);
    assertEquals("FRA discounting: par spread", pv0, 0, TOLERANCE_PV);
  }

  @Test
View Full Code Here

Examples of com.opengamma.analytics.financial.instrument.future.BondFutureDefinition.toDerivative()

    final ValueRequirement desiredValue = Iterables.getOnlyElement(desiredValues);
    final BondFutureSecurity security = (BondFutureSecurity) target.getSecurity();
    final BondFutureDefinition definition = (BondFutureDefinition) security.accept(_visitor);
    final Double referencePrice = 0.0; // TODO Futures Refactor
    final String[] curveNames = getCurveNames(desiredValue);
    final BondFuture bondFuture = definition.toDerivative(date, referencePrice, curveNames);
    return calculate(security, bondFuture, getData(desiredValue, inputs, target), target);
  }

  protected abstract Set<ComputedValue> calculate(com.opengamma.financial.security.future.BondFutureSecurity security, BondFuture bondFuture, T data, ComputationTarget target);
View Full Code Here

Examples of com.opengamma.analytics.financial.instrument.future.InterestRateFutureOptionMarginSecurityDefinition.toDerivative()

  /**
   * Tests the price for very deep out-of-the-money options.
   */
  public void priceDeepOTM() {
    final InterestRateFutureOptionMarginSecurityDefinition callDefinition = new InterestRateFutureOptionMarginSecurityDefinition(ERH3_DEFINITION, OPT_EXP_MAR13, 1.25, true);
    final InterestRateFutureOptionMarginSecurity call = callDefinition.toDerivative(REFERENCE_DATE);
    final double priceCallDeep = METHOD_OPT_SEC.price(call, HW_MULTICURVES);
    assertEquals("InterestRateFutureOptionMarginSecurityHullWhiteMethod: price", 0.0, priceCallDeep, TOLERANCE_PRICE);
    final InterestRateFutureOptionMarginSecurityDefinition putDefinition = new InterestRateFutureOptionMarginSecurityDefinition(ERH3_DEFINITION, OPT_EXP_MAR13, 0.75, false);
    final InterestRateFutureOptionMarginSecurity put = putDefinition.toDerivative(REFERENCE_DATE);
    final double pricePutDeep = METHOD_OPT_SEC.price(put, HW_MULTICURVES);
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.