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

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


          }
        }
      }
      if (generator instanceof GeneratorPriceIndexCurve) {
        final GeneratorPriceIndexCurve inflationGenerator = (GeneratorPriceIndexCurve) generator;
        final PriceIndexCurve inflationCurve = inflationGenerator.generateCurve(name, provider, paramCurve);

        if (_inflationMap.containsKey(name)) {
          final IndexPrice[] indexes = _inflationMap.get(name);
          for (final IndexPrice indexe : indexes) {
            provider.setCurve(indexe, inflationCurve);
View Full Code Here


    }

    // Inflation
    final Set<IndexPrice> indexPrice = multicurve.getPriceIndexes();
    for (final IndexPrice index : indexPrice) {
      final PriceIndexCurve curveIndex = multicurve.getCurve(index);

      ArgumentChecker.isTrue(curveIndex.getCurve() instanceof InterpolatedDoublesCurve, "Yield curve should be based on InterpolatedDoublesCurve");
      final InterpolatedDoublesCurve curveInt = (InterpolatedDoublesCurve) curveIndex.getCurve();
      final int nbNodePoint = curveInt.getXDataAsPrimitive().length;
      final double[][] sensitivity = new double[nbCcy][nbNodePoint];
      for (int loopnode = 0; loopnode < nbNodePoint; loopnode++) {
        final double[] yieldBumped = curveInt.getYDataAsPrimitive().clone();
        yieldBumped[loopnode] += _shift;
        final PriceIndexCurve dscBumped = new PriceIndexCurve(new InterpolatedDoublesCurve(curveInt.getXDataAsPrimitive(), yieldBumped, curveInt.getInterpolator(), true));
        final InflationProviderDiscount marketDscBumped = multicurve.withPriceIndex(index, dscBumped);
        final MultipleCurrencyAmount pvBumped = instrument.accept(_valueCalculator, marketDscBumped);
        final MultipleCurrencyAmount pvDiff = pvBumped.plus(pvInitMinus);
        for (int loopccypv = 0; loopccypv < nbCcy; loopccypv++) {
          sensitivity[loopccypv][loopnode] = pvDiff.getAmount(ccyList.get(loopccypv)) / _shift;
View Full Code Here

    _priceIndexCurves.put(index, curve);
  }

  @Override
  public Integer getNumberOfParameters(final String name) {
    final PriceIndexCurve curve = _allCurves.get(name);
    return curve.getNumberOfParameters();
  }
View Full Code Here

    return null;
  }

  @Override
  public double[] parameterInflationSensitivity(final String name, final List<DoublesPair> pointSensitivity) {
    final PriceIndexCurve curve = _allCurves.get(name);
    final int nbParameters = curve.getNumberOfParameters();
    final double[] result = new double[nbParameters];
    if (pointSensitivity != null && pointSensitivity.size() > 0) {
      for (final DoublesPair timeAndS : pointSensitivity) {
        final double[] sensi1Point = curve.getPriceIndexParameterSensitivity(timeAndS.getFirst());
        for (int loopparam = 0; loopparam < nbParameters; loopparam++) {
          result[loopparam] += timeAndS.getSecond() * sensi1Point[loopparam];
        }
      }
    }
View Full Code Here

      final List<FudgeField> indexCurveFields = message.getAllByName(PRICE_INDEX_CURVE_FIELD);
      final Map<IndexPrice, PriceIndexCurve> priceIndexCurves = new LinkedHashMap<>();
      final int n = indexFields.size();
      for (int i = 0; i < n; i++) {
        final IndexPrice index = deserializer.fudgeMsgToObject(IndexPrice.class, (FudgeMsg) indexFields.get(i).getValue());
        final PriceIndexCurve curve = deserializer.fudgeMsgToObject(PriceIndexCurve.class, (FudgeMsg) indexCurveFields.get(i).getValue());
        priceIndexCurves.put(index, curve);
      }
      return new InflationProviderDiscount(yieldCurves, priceIndexCurves);
    }
View Full Code Here

    private static final String CURVE_FIELD = "curve";

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

    assertEquals(NODES.length, GENERATOR_PRICE_INDEX_INTERPOLATED_NODE.getNumberOfParameter());
  }

  @Test
  public void generateCurveYieldInterpolated() {
    final PriceIndexCurve curveGenerated = GENERATOR_PRICE_INDEX_INTERPOLATED_NODE.generateCurve(CURVE_NAME_1, CPI);
    final PriceIndexCurve curveExpected = new PriceIndexCurve(new InterpolatedDoublesCurve(NODES, CPI, LINEAR_FLAT, true, CURVE_NAME_1));
    assertEquals("GeneratorPriceIndexCurveInterpolatedNode: generate curve", curveExpected, curveGenerated);
  }
View Full Code Here

    assertEquals("GeneratorPriceIndexCurveInterpolatedNode: generate curve", curveExpected, curveGenerated);
  }

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

    final Map<IndexON, YieldAndDiscountCurve> overnight = new LinkedHashMap<>();
    overnight.put(new IndexON("NAME1", Currency.USD, DayCountFactory.INSTANCE.getDayCount("Act/360"), 1), new YieldCurve("E", ConstantDoublesCurve.from(0.003, "e")));
    overnight.put(new IndexON("NAME2", Currency.EUR, DayCountFactory.INSTANCE.getDayCount("Act/360"), 0), new YieldCurve("F", ConstantDoublesCurve.from(0.006, "f")));
    final MulticurveProviderDiscount provider = new MulticurveProviderDiscount(discounting, ibor, overnight, matrix);
    final Map<IndexPrice, PriceIndexCurve> curves = new LinkedHashMap<>();
    curves.put(new IndexPrice("CPI1", Currency.USD), new PriceIndexCurve(ConstantDoublesCurve.from(0.02, "A")));
    curves.put(new IndexPrice("CPI2", Currency.EUR), new PriceIndexCurve(ConstantDoublesCurve.from(0.03, "B")));
    final InflationProviderDiscount inflation = new InflationProviderDiscount(provider, curves);
    assertEquals(inflation, cycleObject(InflationProviderDiscount.class, inflation));
  }
View Full Code Here

      timeValueUs[2 + 2 * loopus + 1] = TimeCalculator.getTimeBetween(pricingDate, maturityDateUs[2 * loopus + 1]);
      indexValueUs[2 + 2 * loopus] = indexValueUs[0] * Math.pow(1 + 0.02, yearUs[loopus]); // 2% inflation a year.
      indexValueUs[2 + 2 * loopus + 1] = indexValueUs[1] * Math.pow(1 + 0.02, yearUs[loopus]); // 2% inflation a year.
    }
    final InterpolatedDoublesCurve curveUs = InterpolatedDoublesCurve.from(timeValueUs, indexValueUs, new LinearInterpolator1D(), NAME_USD_PRICE_INDEX);
    final PriceIndexCurve priceIndexCurveUs = new PriceIndexCurve(curveUs);
    market.setCurve(PRICE_INDEX_USD, priceIndexCurveUs);
    return market;
  }
View Full Code Here

TOP

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

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.