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

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


    @Override
    public ForwardCurveYieldImplied buildObject(final FudgeDeserializer deserializer, final FudgeMsg message) {
      final double spot = message.getDouble(SPOT_FIELD_NAME);
      final YieldAndDiscountCurve riskFreeCurve = deserializer.fieldValueToObject(YieldAndDiscountCurve.class, message.getByName(RISK_FREE_FIELD_NAME));
      final YieldAndDiscountCurve costOfCarryCurve = deserializer.fieldValueToObject(YieldAndDiscountCurve.class, message.getByName(COST_OF_CARRY_FIELD_NAME));
      return new ForwardCurveYieldImplied(spot, riskFreeCurve, costOfCarryCurve);
    }
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

    if (isContinuousDividends) {
      // Cost of Carry - if no dividend yield available set 0 cost of carry
      final Double dividendYieldObject = (Double) inputs.getValue(MarketDataRequirementNames.DIVIDEND_YIELD);
      final double dividendYield = dividendYieldObject == null ? 0.0 : dividendYieldObject.doubleValue();
      final YieldCurve costOfCarryCurve = YieldCurve.from(ConstantDoublesCurve.from(dividendYield, "CostOfCarry"));
      forwardCurve = new ForwardCurveYieldImplied(spot, fundingCurve, costOfCarryCurve);     
    } else {
      Object discreteDividendsInput = inputs.getValue(ValueRequirementNames.AFFINE_DIVIDENDS);
      if ((discreteDividendsInput != null) && (discreteDividendsInput instanceof AffineDividends)) {
        final AffineDividends discreteDividends = (AffineDividends) discreteDividendsInput;
        forwardCurve = new ForwardCurveAffineDividends(spot, fundingCurve, discreteDividends);
      } else {
        forwardCurve = new ForwardCurveYieldImplied(spot, fundingCurve, YieldCurve.from(ConstantDoublesCurve.from(0.0, "CostOfCarry")));
      }
    }
   
    final ValueProperties properties = createValueProperties()
        .with(ForwardCurveValuePropertyNames.PROPERTY_FORWARD_CURVE_CALCULATION_METHOD, ForwardCurveValuePropertyNames.PROPERTY_YIELD_CURVE_IMPLIED_METHOD)
View Full Code Here

        throw new OpenGammaRuntimeException("Null or non-unique FX forward curve names: " + fxForwardCurveNames);
      }
      final YieldCurve payCurve = (YieldCurve) payCurveObject;
      final YieldCurve receiveCurve = (YieldCurve) receiveCurveObject;
      final String fxForwardCurveName = fxForwardCurveNames.iterator().next();
      final ForwardCurve fxForwardCurve = new ForwardCurveYieldImplied(spot, payCurve, receiveCurve);
      final ValueProperties properties = createValueProperties()
          .with(ValuePropertyNames.CURVE, fxForwardCurveName)
          .with(ForwardCurveValuePropertyNames.PROPERTY_FORWARD_CURVE_CALCULATION_METHOD, ForwardCurveValuePropertyNames.PROPERTY_YIELD_CURVE_IMPLIED_METHOD)
          .with(ValuePropertyNames.PAY_CURVE, Iterables.getOnlyElement(payCurveNames))
          .with(ValuePropertyNames.PAY_CURVE_CALCULATION_CONFIG, Iterables.getOnlyElement(payCurveCalculationConfigs))
View Full Code Here

TOP

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

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.