Package com.opengamma.analytics.financial.model.interestrate.curve

Examples of com.opengamma.analytics.financial.model.interestrate.curve.ForwardCurve



  @Test
  public void testCurve1() {
    final double spot = 100;
    final ForwardCurve curve1 = new ForwardCurve(spot);
    final ForwardCurve curve2 = cycleObject(ForwardCurve.class, curve1);
    assertEquals(curve1.getSpot(), curve2.getSpot(), EPS);
    assertTrue(curve2.getForwardCurve() instanceof ConstantDoublesCurve);
    assertTrue(curve2.getDriftCurve() instanceof ConstantDoublesCurve);
    assertCurveEquals(curve1.getForwardCurve(), curve2.getForwardCurve());
    assertCurveEquals(curve1.getDriftCurve(), curve2.getDriftCurve());
  }
View Full Code Here


    assertCurveEquals(curve1.getDriftCurve(), curve2.getDriftCurve());
  }

  @Test
  public void testCurve2() {
    final ForwardCurve curve1 = new ForwardCurve(InterpolatedDoublesCurve.from(EXPIRIES, FORWARD, INTERPOLATOR));
    final ForwardCurve curve2 = cycleObject(ForwardCurve.class, curve1);
    assertEquals(curve1.getSpot(), curve2.getSpot(), EPS);
    assertTrue(curve2.getForwardCurve() instanceof InterpolatedDoublesCurve);
    assertTrue(curve2.getDriftCurve() instanceof FunctionalDoublesCurve);
    assertCurveEquals(curve1.getForwardCurve(), curve2.getForwardCurve());
    assertCurveEquals(curve1.getDriftCurve(), curve2.getDriftCurve());
  }
View Full Code Here

  @Test
  public void testCurve3() {
    final double spot = 100;
    final Curve<Double, Double> driftCurve = InterpolatedDoublesCurve.from(EXPIRIES, FORWARD, INTERPOLATOR);
    final ForwardCurve curve1 = new ForwardCurve(spot, driftCurve);
    final ForwardCurve curve2 = cycleObject(ForwardCurve.class, curve1);
    assertTrue(curve2.getForwardCurve() instanceof FunctionalDoublesCurve);
    assertTrue(curve2.getDriftCurve() instanceof InterpolatedDoublesCurve);
    assertCurveEquals(curve1.getForwardCurve(), curve2.getForwardCurve());
    assertCurveEquals(curve1.getDriftCurve(), curve2.getDriftCurve());
  }
View Full Code Here

  @Test
  public void testCurve4() {
    final double spot = 100;
    final double drift = 1.5;
    final ForwardCurve curve1 = new ForwardCurve(spot, drift);
    final ForwardCurve curve2 = cycleObject(ForwardCurve.class, curve1);
    assertTrue(curve2.getForwardCurve() instanceof FunctionalDoublesCurve);
    assertTrue(curve2.getDriftCurve() instanceof ConstantDoublesCurve);
    assertCurveEquals(curve1.getForwardCurve(), curve2.getForwardCurve());
    assertCurveEquals(curve1.getDriftCurve(), curve2.getDriftCurve());
  }
View Full Code Here

    assertCurveEquals(curve1.getDriftCurve(), curve2.getDriftCurve());
  }

  @Test
  public void testCurve5() {
    final ForwardCurve curve1 = new ForwardCurve(InterpolatedDoublesCurve.from(EXPIRIES, FORWARD, INTERPOLATOR), InterpolatedDoublesCurve.from(FORWARD, EXPIRIES, INTERPOLATOR));
    final ForwardCurve curve2 = cycleObject(ForwardCurve.class, curve1);
    assertEquals(curve1.getSpot(), curve2.getSpot(), EPS);
    assertTrue(curve2.getForwardCurve() instanceof InterpolatedDoublesCurve);
    assertTrue(curve2.getDriftCurve() instanceof InterpolatedDoublesCurve);
    assertCurveEquals(curve1.getForwardCurve(), curve2.getForwardCurve());
    assertCurveEquals(curve1.getDriftCurve(), curve2.getDriftCurve());
  }
View Full Code Here

    };
  }
 
  @Test
  public void testCurve6() {
    final ForwardCurve curve1 = new ForwardCurve(getForwardCurve());
    final ForwardCurve curve2 = cycleObject(ForwardCurve.class, curve1);
    assertEquals(curve1.getSpot(), curve2.getSpot(), EPS);
    assertTrue(curve2.getForwardCurve() instanceof FunctionalDoublesCurve);
    assertTrue(curve2.getDriftCurve() instanceof FunctionalDoublesCurve);
    assertCurveEquals(curve1.getForwardCurve(), curve2.getForwardCurve());
    assertCurveEquals(curve1.getDriftCurve(), curve2.getDriftCurve());
  }
View Full Code Here

  public void printTest() {
    System.out.println("MixedLogNormalVolatilitySurfaceTest. printTest");
    final double t = 1.5;
    final double spot = 100.0;
    final double r = 0.05;
    final ForwardCurve fc = new ForwardCurve(spot, r);
    final YieldAndDiscountCurve discountCurve = new YieldCurve("test", ConstantDoublesCurve.from(r));
    double[] w = new double[] {0.7, 0.25, 0.05 };
    double[] sigma = new double[] {0.3, 0.6, 1.0 };
    double[] mu = new double[] {0.0, 0.3, -0.5 };
    MultiHorizonMixedLogNormalModelData data = new MultiHorizonMixedLogNormalModelData(w, sigma, mu);
View Full Code Here

  @Test
  public void flatTest() {
    final double spot = 123.0;
    final double r = 0.05;
    final ForwardCurve fc = new ForwardCurve(spot, r);
    final double vol = 0.3;
    double[] w = new double[] {0.6, 0.4 };
    double[] sigma = new double[] {vol, vol };
    MultiHorizonMixedLogNormalModelData data = new MultiHorizonMixedLogNormalModelData(w, sigma);
    BlackVolatilitySurfaceStrike ivs = MixedLogNormalVolatilitySurface.getImpliedVolatilitySurface(fc, data);
View Full Code Here

  @Test
  public void nonflatTest1() {
    DupireLocalVolatilityCalculator dupire = new DupireLocalVolatilityCalculator();
    final double spot = 0.03;
    final double r = 0.05;
    final ForwardCurve fc = new ForwardCurve(spot, r);
    final double vol = 0.3;
    double[] w = new double[] {0.8, 0.2 };
    double[] sigma = new double[] {0.2, 0.7 };
    MultiHorizonMixedLogNormalModelData data = new MultiHorizonMixedLogNormalModelData(w, sigma);
    BlackVolatilitySurfaceStrike ivs = MixedLogNormalVolatilitySurface.getImpliedVolatilitySurface(fc, data);
View Full Code Here

  @Test
  public void nonflatTest2() {
    DupireLocalVolatilityCalculator dupire = new DupireLocalVolatilityCalculator();
    final double spot = 0.03;
    final double r = 0.10;
    final ForwardCurve fc = new ForwardCurve(spot, r);
    final double vol = 0.3;
    double[] w = new double[] {0.9, 0.1 };
    double[] sigma = new double[] {0.2, 0.7 };
    double[] mu = new double[] {0.1, -0.1 };
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.model.interestrate.curve.ForwardCurve

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.