Package com.opengamma.analytics.financial.interestrate

Examples of com.opengamma.analytics.financial.interestrate.YieldCurveBundle


    final Map<String, YieldAndDiscountCurve> otherCurves = new HashMap<>();
    final YieldAndDiscountCurve curve = CURVES.getCurve(CURVES.getAllNames().iterator().next());
    for (final String name : CURVES.getAllNames()) {
      otherCurves.put(name, curve);
    }
    other = new YieldCurveWithBlackForexTermStructureBundle(new YieldCurveBundle(CURVES.getFxRates(), CURVES.getCurrencyMap(), otherCurves), VOLS, CCYS);
    assertFalse(FX_DATA.equals(other));
    other = new YieldCurveWithBlackForexTermStructureBundle(CURVES, new BlackForexTermStructureParameters(InterpolatedDoublesCurve.fromSorted(NODES, VOL, LINEAR_FLAT)), CCYS);
    assertFalse(FX_DATA.equals(other));
    other = new YieldCurveWithBlackForexTermStructureBundle(CURVES, VOLS, Pair.of(Currency.EUR, Currency.GBP));
    assertFalse(FX_DATA.equals(other));
View Full Code Here


   * @param dsc The discounting curve level.
   * @param fwd The forward curve level.
   * @return
   */
  public static YieldCurveBundle curves1(final double dsc, final double fwd) {
    final YieldCurveBundle curves = new YieldCurveBundle();
    curves.setCurve(DSC_CURVE_NAME, YieldCurve.from(ConstantDoublesCurve.from(dsc)));
    curves.setCurve(FWD_CURVE_NAME, YieldCurve.from(ConstantDoublesCurve.from(fwd)));
    return curves;
  }
View Full Code Here

    final double[] fwdArray = new double[RATES_TIME.length];
    for (int loopt = 0; loopt < RATES_TIME.length; loopt++) {
      dscArray[loopt] = dsc;
      fwdArray[loopt] = fwd;
    }
    final YieldCurveBundle curves = new YieldCurveBundle();
    curves.setCurve(DSC_CURVE_NAME, YieldCurve.from(new InterpolatedDoublesCurve(RATES_TIME, dscArray, LINEAR_FLAT, true)));
    curves.setCurve(FWD_CURVE_NAME, YieldCurve.from(new InterpolatedDoublesCurve(RATES_TIME, fwdArray, LINEAR_FLAT, true)));
    return curves;
  }
View Full Code Here

    SABRInterestRateDataBundle other = new SABRInterestRateDataBundle(PARAMETERS, CURVES);
    assertEquals(SABR_DATA, other);
    assertEquals(SABR_DATA.hashCode(), other.hashCode());
    other = new SABRInterestRateDataBundle(new SABRInterestRateParameters(SURFACE, SURFACE, SURFACE, SURFACE, DAYCOUNT, new SABRHaganAlternativeVolatilityFunction()), CURVES);
    assertFalse(other.equals(SABR_DATA));
    other = new SABRInterestRateDataBundle(PARAMETERS, new YieldCurveBundle(new String[] {"Curve1"}, new YieldAndDiscountCurve[] {CURVE}));
    assertFalse(other.equals(SABR_DATA));
  }
View Full Code Here

    final ZonedDateTime referenceDate = DateUtils.getUTCDate(2012, 8, 17);
    final MultipleCurrencyAmount theta = THETAC.getTheta(SWAP_FIXED_IBOR_DEFINITION, referenceDate, CURVE_NAMES, CURVES, FIXING_TS_3_6, 1);
    final SwapFixedCoupon<Coupon> swapToday = SWAP_FIXED_IBOR_DEFINITION.toDerivative(referenceDate, FIXING_TS_3_6, CURVE_NAMES);
    final SwapFixedCoupon<Coupon> swapTomorrow = SWAP_FIXED_IBOR_DEFINITION.toDerivative(referenceDate.plusDays(1), FIXING_TS_3_6, CURVE_NAMES);
    final double pvToday = swapToday.accept(PVC, CURVES);
    final YieldCurveBundle tomorrowData = CURVE_ROLLDOWN.rollDown(CURVES, TimeCalculator.getTimeBetween(referenceDate, referenceDate.plusDays(1)));
    final double pvTomorrow = swapTomorrow.accept(PVC, tomorrowData);
    final double todayCash = ((CouponFixed) swapToday.getSecondLeg().getNthPayment(0)).getAmount();
    assertEquals("ThetaCalculator: fixed-coupon swap", pvTomorrow - (pvToday - todayCash), theta.getAmount(USDLIBOR3M.getCurrency()), TOLERANCE_PV);
    assertEquals("ThetaCalculator: fixed-coupon swap", 1, theta.getCurrencyAmounts().length);
  }
View Full Code Here

  public static YieldCurveBundle createCurves1() {
    final String FUNDING_CURVE_NAME = "Funding";
    final String FORWARD_CURVE_NAME = "Forward";
    final YieldAndDiscountCurve CURVE_5 = YieldCurve.from(ConstantDoublesCurve.from(0.05));
    final YieldAndDiscountCurve CURVE_4 = YieldCurve.from(ConstantDoublesCurve.from(0.04));
    final YieldCurveBundle curves = new YieldCurveBundle();
    curves.setCurve(FUNDING_CURVE_NAME, CURVE_5);
    curves.setCurve(FORWARD_CURVE_NAME, CURVE_4);
    return curves;
  }
View Full Code Here

    final String DISCOUNTING_CURVE_NAME = "Repo";
    final String FORWARD_CURVE_NAME = "Forward";
    final YieldAndDiscountCurve CURVE_5 = YieldCurve.from(ConstantDoublesCurve.from(0.05));
    final YieldAndDiscountCurve CURVE_4 = YieldCurve.from(ConstantDoublesCurve.from(0.04));
    final YieldAndDiscountCurve CURVE_45 = YieldCurve.from(ConstantDoublesCurve.from(0.045));
    final YieldCurveBundle curves = new YieldCurveBundle();
    curves.setCurve(CREDIT_CURVE_NAME, CURVE_5);
    curves.setCurve(DISCOUNTING_CURVE_NAME, CURVE_4);
    curves.setCurve(FORWARD_CURVE_NAME, CURVE_45);
    return curves;
  }
View Full Code Here

    final String DISCOUNTING_CURVE_NAME = "Repo";
    final String FORWARD_CURVE_NAME = "Forward";
    final YieldAndDiscountCurve CURVE_6 = YieldCurve.from(ConstantDoublesCurve.from(0.06));
    final YieldAndDiscountCurve CURVE_5 = YieldCurve.from(ConstantDoublesCurve.from(0.05));
    final YieldAndDiscountCurve CURVE_55 = YieldCurve.from(ConstantDoublesCurve.from(0.0550));
    final YieldCurveBundle curves = new YieldCurveBundle();
    curves.setCurve(CREDIT_CURVE_NAME, CURVE_6);
    curves.setCurve(DISCOUNTING_CURVE_NAME, CURVE_5);
    curves.setCurve(FORWARD_CURVE_NAME, CURVE_55);
    return curves;
  }
View Full Code Here

  @Test
  /**
   * Tests the present value versus an hard-coded value.
   */
  public void persentValueHardCoded() {
    final YieldCurveBundle curves = TestsDataSetsForex.createCurvesForexXXXYYY(USD, JPY, SPOT_USD_JPY);
    final SmileDeltaTermStructureDataBundle curvesVol = new SmileDeltaTermStructureDataBundle(curves, SMILE_TERM_FLAT_USD_JPY, Pair.of(USD, JPY));
    final MultipleCurrencyAmount pvComputed = METHOD_BARRIER.presentValue(CALL_USD_JPY_BARRIER, curvesVol);
    final CurrencyAmount pvComputedUSD = curves.getFxRates().convert(pvComputed, USD);
    final double pvHardCodedUSD = 12958.820;
    assertEquals("Forex Barrier option: present value", pvHardCodedUSD, pvComputedUSD.getAmount(), TOLERANCE_PV);
    final MultipleCurrencyAmount pvVanilla = METHOD_VANILLA.presentValue(CALL_USD_JPY_BARRIER.getUnderlyingOption(), curvesVol);
    assertTrue("Forex Barrier option: present value", pvVanilla.getAmount(JPY) > pvComputed.getAmount(JPY));
  }
View Full Code Here

  /**
   * Tests that the present value given by the method for a generic ForexDerivatrive is the same as for a specific ForexOptionSingleBarrier.
   */
  public void methodForexBarrier() {
    final InstrumentDerivative fx = OPTION_BARRIER;
    final YieldCurveBundle curves = SMILE_BUNDLE;
    final MultipleCurrencyAmount priceGeneric = METHOD_BARRIER.presentValue(fx, curves);
    final MultipleCurrencyAmount priceSpecific = METHOD_BARRIER.presentValue(OPTION_BARRIER, SMILE_BUNDLE);
    assertEquals("Barrier price: generic vs specific", priceSpecific, priceGeneric);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.interestrate.YieldCurveBundle

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.