Examples of VolatilityCurve


Examples of com.opengamma.analytics.financial.model.volatility.curve.VolatilityCurve

  }


  public VolatilityCurve getSlice(final Axis axis, final double here, final Interpolator1D interpolator) {
    final Curve<Double, Double> curve = SurfaceSliceFunction.cut(_surface, axis, here, interpolator);
    return new VolatilityCurve(curve);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.model.volatility.curve.VolatilityCurve

  @Test
  public void test() {
    final YieldCurve shortRate = YieldCurve.from(ConstantDoublesCurve.from(0.05));
    final double longRate = 0.06;
    final double speed = 0.01;
    final VolatilityCurve sigma = new VolatilityCurve(ConstantDoublesCurve.from(0.01));
    VasicekDataBundle data = new VasicekDataBundle(shortRate, sigma, TODAY, longRate, speed);
    assertEquals(MODEL.getDiscountBondFunction(START, START).evaluate(data), 1, 0);
    data = new VasicekDataBundle(shortRate, new VolatilityCurve(ConstantDoublesCurve.from(0)), TODAY, longRate, speed);
    final double factor = (1 - Math.exp(-speed * YEARS));
    final double lnA = longRate * (factor / speed - YEARS);
    assertEquals(MODEL.getDiscountBondFunction(START, MATURITY).evaluate(data), Math.exp(lnA - data.getShortRate(0) * factor / speed), 0);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.model.volatility.curve.VolatilityCurve

  @Test
  public void test() {
    HullWhiteOneFactorDataBundle data = new HullWhiteOneFactorDataBundle(R, SIGMA, TODAY, SPEED);
    assertEquals(MODEL.getDiscountBondFunction(START, START).evaluate(data), 1, EPS);
    data = new HullWhiteOneFactorDataBundle(R, new VolatilityCurve(ConstantDoublesCurve.from(0)), TODAY, SPEED);
    assertEquals(Math.log(MODEL.getDiscountBondFunction(START, MATURITY).evaluate(data)), -RATE * YEARS, EPS);
    data = new HullWhiteOneFactorDataBundle(R, SIGMA, TODAY, 200);
    assertEquals(Math.log(MODEL.getDiscountBondFunction(START, MATURITY).evaluate(data)), -RATE * YEARS, EPS);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.model.volatility.curve.VolatilityCurve

  @Test
  public void test() {
    final double eps = 1e-9;
    assertEquals(MODEL.getDiscountBondFunction(START, START).evaluate(DATA), 1, 0);
    StandardDiscountBondModelDataBundle data = new StandardDiscountBondModelDataBundle(YieldCurve.from(ConstantDoublesCurve.from(0.)), new VolatilityCurve(ConstantDoublesCurve.from(0)), TODAY);
    assertEquals(MODEL.getDiscountBondFunction(START, MATURITY).evaluate(data), 1, 0);
    data = new StandardDiscountBondModelDataBundle(YieldCurve.from(ConstantDoublesCurve.from(0.)), SIGMA, TODAY);
    assertEquals(MODEL.getDiscountBondFunction(START, MATURITY).evaluate(data), Math.exp(-0.5 * VOL * VOL * YEARS * YEARS), 0);
    data = new StandardDiscountBondModelDataBundle(R, new VolatilityCurve(ConstantDoublesCurve.from(0)), TODAY);
    assertEquals(MODEL.getDiscountBondFunction(START, MATURITY).evaluate(data), Math.exp(-IR * YEARS), eps);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.model.volatility.curve.VolatilityCurve

    MODEL.getDiscountBondFunction(START, MATURITY).evaluate((HullWhiteTwoFactorDataBundle) null);
  }

  @Test
  public void test() {
    HullWhiteTwoFactorDataBundle data = new HullWhiteTwoFactorDataBundle(R, new VolatilityCurve(ConstantDoublesCurve.from(0)), VOL2, TODAY, SPEED1, SPEED2, U, YieldCurve.from(ConstantDoublesCurve
        .from(F)), RHO);
    assertEquals(MODEL.getDiscountBondFunction(START, MATURITY).evaluate(data), 0, EPS);
    data = new HullWhiteTwoFactorDataBundle(R, VOL1, VOL2, TODAY, SPEED1, SPEED2, U, YieldCurve.from(ConstantDoublesCurve.from(F)), RHO);
    assertEquals(MODEL.getDiscountBondFunction(START, START).evaluate(data), 1, EPS);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.model.volatility.curve.VolatilityCurve

    HullWhiteOneFactorDataBundle other = new HullWhiteOneFactorDataBundle(R_CURVE, SIGMA_CURVE, DATE, SPEED);
    assertEquals(other, DATA);
    assertEquals(other.hashCode(), DATA.hashCode());
    other = new HullWhiteOneFactorDataBundle(YieldCurve.from(ConstantDoublesCurve.from(R + 0.01)), SIGMA_CURVE, DATE, SPEED);
    assertFalse(other.equals(DATA));
    other = new HullWhiteOneFactorDataBundle(R_CURVE, new VolatilityCurve(ConstantDoublesCurve.from(SIGMA + 0.1)), DATE, SPEED);
    assertFalse(other.equals(DATA));
    other = new HullWhiteOneFactorDataBundle(R_CURVE, SIGMA_CURVE, DATE.minusDays(2), SPEED);
    assertFalse(other.equals(DATA));
    other = new HullWhiteOneFactorDataBundle(R_CURVE, SIGMA_CURVE, DATE, SPEED + 0.5);
    assertFalse(other.equals(DATA));
View Full Code Here

Examples of com.opengamma.analytics.financial.model.volatility.curve.VolatilityCurve

    HullWhiteTwoFactorDataBundle other = new HullWhiteTwoFactorDataBundle(R_CURVE, SIGMA_CURVE_1, SIGMA_CURVE_2, DATE, SPEED_1, SPEED_2, U, F, RHO);
    assertEquals(other, DATA);
    assertEquals(other.hashCode(), DATA.hashCode());
    other = new HullWhiteTwoFactorDataBundle(YieldCurve.from(ConstantDoublesCurve.from(R - 0.01)), SIGMA_CURVE_1, SIGMA_CURVE_2, DATE, SPEED_1, SPEED_2, U, F, RHO);
    assertFalse(other.equals(DATA));
    other = new HullWhiteTwoFactorDataBundle(R_CURVE, new VolatilityCurve(ConstantDoublesCurve.from(SIGMA + 0.3)), SIGMA_CURVE_2, DATE, SPEED_1, SPEED_2, U, F, RHO);
    assertFalse(other.equals(DATA));
    other = new HullWhiteTwoFactorDataBundle(R_CURVE, SIGMA_CURVE_1, new VolatilityCurve(ConstantDoublesCurve.from(SIGMA + 0.1)), DATE, SPEED_1, SPEED_2, U, F, RHO);
    assertFalse(other.equals(DATA));
    other = new HullWhiteTwoFactorDataBundle(R_CURVE, SIGMA_CURVE_1, SIGMA_CURVE_2, DATE.minusDays(4), SPEED_1, SPEED_2, U, F, RHO);
    assertFalse(other.equals(DATA));
    other = new HullWhiteTwoFactorDataBundle(R_CURVE, SIGMA_CURVE_1, SIGMA_CURVE_2, DATE, SPEED_1 + 0.1, SPEED_2, U, F, RHO);
    assertFalse(other.equals(DATA));
View Full Code Here

Examples of com.opengamma.analytics.financial.model.volatility.curve.VolatilityCurve

    StandardDiscountBondModelDataBundle other = new StandardDiscountBondModelDataBundle(R_CURVE, SIGMA_CURVE, DATE);
    assertEquals(other, DATA);
    assertEquals(other.hashCode(), DATA.hashCode());
    other = new StandardDiscountBondModelDataBundle(YieldCurve.from(ConstantDoublesCurve.from(R + 0.01)), SIGMA_CURVE, DATE);
    assertFalse(other.equals(DATA));
    other = new StandardDiscountBondModelDataBundle(R_CURVE, new VolatilityCurve(ConstantDoublesCurve.from(SIGMA + 0.1)), DATE);
    assertFalse(other.equals(DATA));
    other = new StandardDiscountBondModelDataBundle(R_CURVE, SIGMA_CURVE, DATE.minusDays(2));
    assertFalse(other.equals(DATA));
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.model.volatility.curve.VolatilityCurve

    VasicekDataBundle other = new VasicekDataBundle(SHORT_RATE, SIGMA, DATE, LONG_RATE, SPEED);
    assertEquals(other, DATA);
    assertEquals(other.hashCode(), DATA.hashCode());
    other = new VasicekDataBundle(YieldCurve.from(ConstantDoublesCurve.from(SHORT_RATE.getInterestRate(0.) + 1)), SIGMA, DATE, LONG_RATE, SPEED);
    assertFalse(other.equals(DATA));
    other = new VasicekDataBundle(SHORT_RATE, new VolatilityCurve(ConstantDoublesCurve.from(SIGMA.getVolatility(0.) + 0.2)), DATE, LONG_RATE, SPEED);
    assertFalse(other.equals(DATA));
    other = new VasicekDataBundle(SHORT_RATE, SIGMA, DATE.plusDays(10), LONG_RATE, SPEED);
    assertFalse(other.equals(DATA));
    other = new VasicekDataBundle(SHORT_RATE, SIGMA, DATE, LONG_RATE + 1, SPEED);
    assertFalse(other.equals(DATA));
View Full Code Here

Examples of com.opengamma.analytics.financial.model.volatility.curve.VolatilityCurve

  @Test
  public void test() {
    final int steps = 3;
    final ZonedDateTime date = DateUtils.getUTCDate(2009, 1, 1);
    final ZonedDateTime maturity = DateUtils.getDateOffsetWithYearFraction(date, 3);
    final StandardDiscountBondModelDataBundle data = new StandardDiscountBondModelDataBundle(YieldCurve.from(ConstantDoublesCurve.from(0.05)), new VolatilityCurve(ConstantDoublesCurve.from(0.1)),
        date);
    final BlackDermanToyYieldOnlyInterestRateModel model = new BlackDermanToyYieldOnlyInterestRateModel(steps);
    final RecombiningBinomialTree<Triple<Double, Double, Double>> tree = model.getTrees(maturity).evaluate(data);
    final Triple<Double, Double, Double>[][] result = tree.getNodes();
    @SuppressWarnings("unchecked")
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.