Examples of YieldCurve


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

  }

  @Test
  public void generateCurveYieldInterpolated() {
    final YieldAndDiscountCurve curveGenerated = GENERATOR_YIELD_INTERPOLATED_NODE.generateCurve(CURVE_NAME_1, YIELD);
    final YieldAndDiscountCurve curveExpected = new YieldCurve(CURVE_NAME_1, new InterpolatedDoublesCurve(NODES, YIELD, LINEAR_FLAT, true, CURVE_NAME_1));
    assertEquals("GeneratorCurveYieldInterpolated: generate curve", curveExpected, curveGenerated);
  }
View Full Code Here

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

    System.arraycopy(NODES, 3, nodex, 4, 3);
    final double[] yieldx = new double[NODES.length + 1];
    System.arraycopy(YIELD, 0, yieldx, 0, 3);
    yieldx[3] = 0.0;
    System.arraycopy(YIELD, 3, yieldx, 4, 3);
    final YieldAndDiscountCurve curveExpected = new YieldCurve(CURVE_NAME_1, new InterpolatedDoublesCurve(nodex, yieldx, LINEAR_FLAT, true, CURVE_NAME_1));
    assertEquals("GeneratorCurveYieldInterpolated: generate curve", curveExpected.getNumberOfParameters() - 1, curveGenerated.getNumberOfParameters());
    assertArrayEquals("GeneratorCurveYieldInterpolated: generate curve", ((YieldCurve) curveExpected).getCurve().getXData(), ((YieldCurve) curveGenerated).getCurve().getXData());
    assertArrayEquals("GeneratorCurveYieldInterpolated: generate curve", ((YieldCurve) curveExpected).getCurve().getYData(), ((YieldCurve) curveGenerated).getCurve().getYData());
  }
View Full Code Here

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

  }

  @Test
  public void generateCurveYieldConstant() {
    final YieldAndDiscountCurve curveGenerated = GENERATOR_YIELD_CONSTANT.generateCurve(CURVE_NAME_1, new double[] {CST});
    final YieldAndDiscountCurve curveExpected = new YieldCurve(CURVE_NAME_1, new ConstantDoublesCurve(CST, CURVE_NAME_1));
    assertEquals("GeneratorCurveYieldConstant: generate curve", curveExpected, curveGenerated);
  }
View Full Code Here

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

  public void generateCurveYieldSpread1() {
    final double[] x = new double[YIELD.length + 1];
    System.arraycopy(YIELD, 0, x, 0, YIELD.length);
    x[YIELD.length] = CST;
    final YieldAndDiscountCurve curveGenerated = GENERATOR_SPREAD.generateCurve(CURVE_NAME_1, x);
    final YieldAndDiscountCurve curveExpected0 = new YieldCurve(CURVE_NAME_1 + "-0", new InterpolatedDoublesCurve(NODES, YIELD, LINEAR_FLAT, true, CURVE_NAME_1 + "-0"));
    final YieldAndDiscountCurve curveExpected1 = new YieldCurve(CURVE_NAME_1 + "-1", new ConstantDoublesCurve(CST, CURVE_NAME_1 + "-1"));
    final YieldAndDiscountCurve curveExpected = new YieldAndDiscountAddZeroSpreadCurve(CURVE_NAME_1, false, curveExpected0, curveExpected1);
    assertEquals("GeneratorCurveYieldConstant: generate curve", curveExpected, curveGenerated);
  }
View Full Code Here

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

    final double[] x = new double[YIELD.length + 2];
    System.arraycopy(YIELD, 0, x, 0, YIELD.length);
    x[YIELD.length] = CST;
    x[YIELD.length + 1] = CST;
    final YieldAndDiscountCurve curveGenerated = generatorSpread2.generateCurve(CURVE_NAME_1, x);
    final YieldAndDiscountCurve curveExpected00 = new YieldCurve(CURVE_NAME_1 + "-0-0", new InterpolatedDoublesCurve(NODES, YIELD, LINEAR_FLAT, true, CURVE_NAME_1 + "-0-0"));
    final YieldAndDiscountCurve curveExpected01 = new YieldCurve(CURVE_NAME_1 + "-0-1", new ConstantDoublesCurve(CST, CURVE_NAME_1 + "-0-1"));
    final YieldAndDiscountCurve curveExpected0 = new YieldAndDiscountAddZeroSpreadCurve(CURVE_NAME_1 + "-0", false, curveExpected00, curveExpected01);
    final YieldAndDiscountCurve curveExpected1 = new YieldCurve(CURVE_NAME_1 + "-1", new ConstantDoublesCurve(CST, CURVE_NAME_1 + "-1"));
    final YieldAndDiscountCurve curveExpected = new YieldAndDiscountAddZeroSpreadCurve(CURVE_NAME_1, false, curveExpected0, curveExpected1);
    assertEquals("GeneratorCurveYieldConstant: generate curve", curveExpected, curveGenerated);
  }
View Full Code Here

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

    final double[] x = new double[2 * YIELD.length];
    System.arraycopy(YIELD, 0, x, 0, YIELD.length);
    System.arraycopy(YIELD, 0, x, YIELD.length, YIELD.length);
    final GeneratorCurveAddYield generatorIntMinusInt = new GeneratorCurveAddYield(new GeneratorYDCurve[] {GENERATOR_YIELD_INTERPOLATED_NODE, GENERATOR_YIELD_INTERPOLATED_NODE}, true);
    final YieldAndDiscountCurve curveGenerated = generatorIntMinusInt.generateCurve(CURVE_NAME_1, x);
    final YieldAndDiscountCurve curveExpected0 = new YieldCurve(CURVE_NAME_1 + "-0", new InterpolatedDoublesCurve(NODES, YIELD, LINEAR_FLAT, true, CURVE_NAME_1 + "-0"));
    final YieldAndDiscountCurve curveExpected1 = new YieldCurve(CURVE_NAME_1 + "-1", new InterpolatedDoublesCurve(NODES, YIELD, LINEAR_FLAT, true, CURVE_NAME_1 + "-1"));
    final YieldAndDiscountCurve curveExpected = new YieldAndDiscountAddZeroSpreadCurve(CURVE_NAME_1, true, curveExpected0, curveExpected1);
    assertEquals("GeneratorCurveYieldConstant: generate curve", curveExpected, curveGenerated);
  }
View Full Code Here

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

  }

  @Test
  @Deprecated
  public void generateCurveYieldSpreadExisting() {
    final YieldAndDiscountCurve curveExisting = new YieldCurve(CURVE_NAME_1, new InterpolatedDoublesCurve(NODES, YIELD, LINEAR_FLAT, true, CURVE_NAME_1));
    final YieldCurveBundle bundle = new YieldCurveBundle();
    bundle.setCurve(CURVE_NAME_1, curveExisting);
    final YieldAndDiscountCurve curveGenerated = GENERATOR_EXISTING.generateCurve(CURVE_NAME_2, bundle, new double[] {CST});
    final YieldAndDiscountCurve curveExpected0 = new YieldCurve(CURVE_NAME_2 + "-0", new ConstantDoublesCurve(CST, CURVE_NAME_2 + "-0"));
    final YieldAndDiscountCurve curveExpected = new YieldAndDiscountAddZeroSpreadCurve(CURVE_NAME_2, true, curveExisting, curveExpected0);
    assertEquals("GeneratorCurveYieldConstant: generate curve", curveExpected, curveGenerated);
  }
View Full Code Here

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

  }

  @Test
  public void generateCurveYieldNelsonSiegel() {
    final YieldAndDiscountCurve curveGenerated = GENERATOR_NS.generateCurve(CURVE_NAME_1, PARAMETERS_NS);
    final YieldAndDiscountCurve curveExpected = new YieldCurve(CURVE_NAME_1, new DoublesCurveNelsonSiegel(CURVE_NAME_1, PARAMETERS_NS));
    assertEquals("GeneratorCurveYieldNelsonSiegel: generate curve", curveExpected, curveGenerated);

  }
View Full Code Here

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

  @Test
  public void testBuilders() {
    final ZonedDateTime newDate = DATE.plusDays(1);
    assertEquals(DATA.withDate(newDate), new GeneralLogNormalOptionDataBundle(YIELD, DRIFT_SURFACE, VOLATILITY_SURFACE, SPOT, newDate));
    final YieldCurve newCurve = YieldCurve.from(ConstantDoublesCurve.from(0.05));
    assertEquals(DATA.withInterestRateCurve(newCurve), new GeneralLogNormalOptionDataBundle(newCurve, DRIFT_SURFACE, VOLATILITY_SURFACE, SPOT, DATE));
    final VolatilitySurface newSurface = new VolatilitySurface(ConstantDoublesSurface.from(0.9));
    assertEquals(DATA.withVolatilitySurface(newSurface), new GeneralLogNormalOptionDataBundle(YIELD, DRIFT_SURFACE, newSurface, SPOT, DATE));
    final DriftSurface newDrift = new DriftSurface(ConstantDoublesSurface.from(0.9));
    assertEquals(DATA.withDriftSurface(newDrift), new GeneralLogNormalOptionDataBundle(YIELD, newDrift, VOLATILITY_SURFACE, SPOT, DATE));
View Full Code Here

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

    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);
    BlackVolatilitySurfaceStrike ivs = MixedLogNormalVolatilitySurface.getImpliedVolatilitySurface(fc, data);
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.