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

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


  }

  @Override
  public YieldCurveWithBlackForexTermStructureBundle copy() {
    final YieldCurveBundle curves = getCurvesCopy();
    final BlackForexTermStructureParameters termStructure = new BlackForexTermStructureParameters(getVolatilityModel().getVolatilityCurve());
    final Pair<Currency, Currency> currencyPair = Pair.of(getCurrencyPair().getFirst(), getCurrencyPair().getSecond());
    return new YieldCurveWithBlackForexTermStructureBundle(curves, termStructure, currencyPair);
  }
View Full Code Here


    final double[] vols = new double[n];
    final int atmIndex = (_volatilityTerm[0].getVolatility().length - 1) / 2;
    for (int i = 0; i < n; i++) {
      vols[i] = _volatilityTerm[i].getVolatility()[atmIndex];
    }
    return new BlackForexTermStructureParameters(InterpolatedDoublesCurve.fromSorted(timesToExpiry, vols, interpolator));
  }
View Full Code Here

    final FXMatrix fxMatrix = new FXMatrix(ccy1, ccy2, spot);
    final ValueProperties.Builder properties = getResultProperties(target, desiredValue, baseQuotePair);
    final ValueSpecification spec = new ValueSpecification(_valueRequirementName, target.toSpecification(), properties.get());
    final YieldCurveBundle curvesWithFX = new YieldCurveBundle(fxMatrix, curveCurrency, yieldCurves.getCurvesMap());
    final ObjectsPair<Currency, Currency> currencyPair = Pair.of(ccy1, ccy2);
    BlackForexTermStructureParameters termStructure;
    if (volatilitySurfaceObject instanceof SmileDeltaTermStructureParametersStrikeInterpolation) {
      final SmileDeltaTermStructureParametersStrikeInterpolation smiles = (SmileDeltaTermStructureParametersStrikeInterpolation) volatilitySurfaceObject;
      termStructure = smiles.toTermStructureOnlyData(interpolator);
    } else {
      termStructure = (BlackForexTermStructureParameters) volatilitySurfaceObject;
View Full Code Here

    if (volatilitySurfaceObject instanceof SmileDeltaTermStructureParametersStrikeInterpolation) {
      final SmileDeltaTermStructureParametersStrikeInterpolation smiles = (SmileDeltaTermStructureParametersStrikeInterpolation) volatilitySurfaceObject;
      final SmileDeltaTermStructureDataBundle smileBundle = new SmileDeltaTermStructureDataBundle(curvesWithFX, smiles, currencyPair);
      return smileBundle;
    }
    final BlackForexTermStructureParameters termStructure = (BlackForexTermStructureParameters) volatilitySurfaceObject;
    final YieldCurveWithBlackForexTermStructureBundle flatData = new YieldCurveWithBlackForexTermStructureBundle(curvesWithFX, termStructure, currencyPair);
    return flatData;
  }
View Full Code Here

    private static final String VOLATILITY_DATA_FIELD_NAME = "Volatility data";

    @Override
    public BlackForexTermStructureParameters buildObject(final FudgeDeserializer deserializer, final FudgeMsg message) {
      final DoublesCurve volatility = deserializer.fieldValueToObject(DoublesCurve.class, message.getByName(VOLATILITY_DATA_FIELD_NAME));
      return new BlackForexTermStructureParameters(volatility);
    }
View Full Code Here

  }

  @Test
  public void test3() {
    final DoublesCurve volatility = InterpolatedDoublesCurve.fromSorted(new double[] {1, 2, 3, 4, 5}, new double[] {0.3, 0.4, 0.5, 0.6, 0.7}, Interpolator1DFactory.LINEAR_INSTANCE);
    final BlackForexTermStructureParameters termStructure = new BlackForexTermStructureParameters(volatility);
    assertEquals(termStructure, cycleObject(BlackForexTermStructureParameters.class, termStructure));
  }
View Full Code Here

    for (final String name : CURVES.getAllNames()) {
      otherCurves.put(name, curve);
    }
    other = new YieldCurveWithBlackForexTermStructureBundle(new YieldCurveBundle(CURVES.getFxRates(), CURVES.getCurrencyMap(), otherCurves), VOLS, CCYS);
    assertFalse(FX_DATA.equals(other));
    other = new YieldCurveWithBlackForexTermStructureBundle(CURVES, new BlackForexTermStructureParameters(InterpolatedDoublesCurve.fromSorted(NODES, VOL, LINEAR_FLAT)), CCYS);
    assertFalse(FX_DATA.equals(other));
    other = new YieldCurveWithBlackForexTermStructureBundle(CURVES, VOLS, Pair.of(Currency.EUR, Currency.GBP));
    assertFalse(FX_DATA.equals(other));
  }
View Full Code Here

    final YieldCurveWithBlackForexTermStructureBundle fxData = new YieldCurveWithBlackForexTermStructureBundle(CURVES, VOLS, CCYS);
    assertEquals(FX_DATA, fxData);
    YieldCurveWithBlackForexTermStructureBundle other = fxData.with(TestsDataSetsForex.createCurvesForex2());
    assertEquals(FX_DATA, fxData);
    assertFalse(other.equals(fxData));
    other = FX_DATA.with(new BlackForexTermStructureParameters(InterpolatedDoublesCurve.fromSorted(NODES, VOL, LINEAR_FLAT)));
    assertEquals(FX_DATA, fxData);
    assertFalse(other.equals(fxData));
  }
View Full Code Here

    if (shifts != null) {
      resultProperties.with(VolatilitySurfaceShiftFunction.SHIFT, shifts);
    }
    final Interpolator1D interpolator = CombinedInterpolatorExtrapolatorFactory.getInterpolator(interpolatorName, leftExtrapolatorName, rightExtrapolatorName);
    final DoublesCurve volatility = InterpolatedDoublesCurve.fromSorted(timesList.toDoubleArray(), volsList.toDoubleArray(), interpolator);
    final BlackForexTermStructureParameters termStructure = new BlackForexTermStructureParameters(volatility);
    return Collections.singleton(new ComputedValue(new ValueSpecification(ValueRequirementNames.STANDARD_VOLATILITY_SURFACE_DATA, target.toSpecification(),
        resultProperties.get()), termStructure));
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.model.volatility.curve.BlackForexTermStructureParameters

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.