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

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


    // Form market scenario
    ValueProperties constraints = desiredValues.iterator().next().getConstraints();
   
    // Apply shift to forward price curve
    final ForwardCurve fwdCurveScen;
    String priceShiftTypeConstraint = constraints.getValues(s_priceShiftType).iterator().next();
    String stockConstraint = constraints.getValues(s_priceShift).iterator().next();
   
    if (stockConstraint.equals("")) {
      fwdCurveScen = market.getForwardCurve(); // use base market prices
View Full Code Here


   
    // Form market scenario
    ValueProperties constraints = desiredValues.iterator().next().getConstraints();
   
    // Apply shift to forward price curve
    final ForwardCurve fwdCurveScen;
    String priceShiftTypeConstraint = constraints.getValues(s_priceShiftType).iterator().next();
    String stockConstraint = constraints.getValues(s_priceShift).iterator().next();
   
    if (stockConstraint.equals("")) {
      fwdCurveScen = market.getForwardCurve(); // use base market prices
View Full Code Here

    FORWARD_CURVE = new ForwardCurve(InterpolatedDoublesCurve.from(EXPIRIES, FORWARDS, EXTRAPOLATOR_1D));
  }

  @Test
  public void testFlat() {
    final ForwardCurve fc = new ForwardCurve(SPOT);
    assertEquals(SPOT, fc.getForward(4.56), 1e-9);
    assertEquals(0.0, fc.getDrift(1.4), 1e-9);
  }
View Full Code Here

    assertEquals(0.0, fc.getDrift(1.4), 1e-9);
  }

  @Test
  public void testConstDrift() {
    final ForwardCurve fc = new ForwardCurve(SPOT, DRIFT);
    final double t = 5.67;
    assertEquals(SPOT * Math.exp(t * DRIFT), fc.getForward(t), 1e-9);
    assertEquals(DRIFT, fc.getDrift(1.4), 1e-9);
  }
View Full Code Here

      @Override
      public Double evaluate(final Double t) {
        return SPOT * (1 + 0.1 * t);
      }
    };
    final ForwardCurve fc = new ForwardCurve(FunctionalDoublesCurve.from(f));
    final double t = 5.67;
    assertEquals(f.evaluate(t), fc.getForward(t), 1e-9);
    assertEquals(0.1 / (1 + 0.1 * t), fc.getDrift(t), 1e-9);
  }
View Full Code Here

    assertEquals(0.1 / (1 + 0.1 * t), fc.getDrift(t), 1e-9);
  }

  @Test
  public void testDriftCurve() {
    final ForwardCurve fc = new ForwardCurve(SPOT, ConstantDoublesCurve.from(DRIFT));
    final double t = 5.67;
    assertEquals(SPOT * Math.exp(t * DRIFT), fc.getForward(t), 1e-9);
    assertEquals(DRIFT, fc.getDrift(t), 1e-9);
  }
View Full Code Here

  public void testTwoCurves() {
    final double rate = 0.05;
    final double cc = 0.02;
    final YieldAndDiscountCurve r = YieldCurve.from(ConstantDoublesCurve.from(rate));
    final YieldAndDiscountCurve q = YieldCurve.from(ConstantDoublesCurve.from(cc));
    final ForwardCurve fc = new ForwardCurveYieldImplied(SPOT, r, q);
    final double t = 5.67;
    assertEquals(SPOT * Math.exp(t * (rate - cc)), fc.getForward(t), 1e-9);
    assertEquals(rate - cc, fc.getDrift(t), 1e-9);
  }
View Full Code Here

  @Test
  public void testShift() {
    final double shift = 0.1;

    final ForwardCurve shifedCurve = FORWARD_CURVE.withFractionalShift(shift);
    assertEquals(SPOT * (1 + shift), shifedCurve.getSpot(), 0.0);

    for (int i = 0; i < EXPIRIES.length - 1; i++) {
      final double t = EXPIRIES[i];
      assertEquals("time " + i, SPOT * (1 + shift) * Math.exp(DRIFT * t), shifedCurve.getForward(t), 1e-9);
    }

  }
View Full Code Here

    for (int i = 0; i < nExp; i++) {
      temp += STRIKES[i].length;
    }
    final int totalStrikes = temp;

    final ForwardCurve fwdCurve = new ForwardCurve(1.0);
    final double xL = 0.0;
    final double xH = 4;
    final BoundaryCondition lower = new DirichletBoundaryCondition(1.0, xL);
    final BoundaryCondition upper = new NeumannBoundaryCondition(0.0, xH, false);
    final MeshingFunction spaceMesh = new HyperbolicMeshing(xL, xH, 1.0, 40, 0.05);
View Full Code Here

    final int totalStrikes = temp;

    final List<Function1D<Double, Double>> bSplines = _generator.generateSet(0.0, 6.0, 30, 3);
    final int nKnots = bSplines.size();

    final ForwardCurve fwdCurve = new ForwardCurve(1.0);
    final double xL = 0.0;
    final double xH = 6;
    final BoundaryCondition lower = new DirichletBoundaryCondition(1.0, xL);
    final BoundaryCondition upper = new NeumannBoundaryCondition(0.0, xH, false);
    final MeshingFunction spaceMesh = new HyperbolicMeshing(xL, xH, 1.0, 40, 0.05);
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.