Package com.opengamma.financial.analytics.curve

Examples of com.opengamma.financial.analytics.curve.FixedDateInterpolatedCurveDefinition


      for (final FudgeField nodeField : nodesFields) {
        final Object obj = deserializer.fieldValueToObject(nodeField);
        nodes.add((CurveNode) obj);
      }
      final String interpolatorName = message.getString(INTERPOLATOR_NAME_FIELD);
      final FixedDateInterpolatedCurveDefinition curveDefinition;
      final List<FudgeField> fixedDatesFields = message.getAllByName(FIXED_DATE_FIELD);
      final List<LocalDate> fixedDates = new ArrayList<>();
      for (final FudgeField fixedDateField : fixedDatesFields) {
        fixedDates.add(deserializer.fieldValueToObject(LocalDate.class, fixedDateField));
      }
      if (message.hasField(RIGHT_EXTRAPOLATOR_NAME_FIELD)) {
        final String rightExtrapolatorName = message.getString(RIGHT_EXTRAPOLATOR_NAME_FIELD);
        final String leftExtrapolatorName = message.getString(LEFT_EXTRAPOLATOR_NAME_FIELD);
        curveDefinition = new FixedDateInterpolatedCurveDefinition(name, nodes, interpolatorName, rightExtrapolatorName, leftExtrapolatorName, fixedDates);
      } else {
        curveDefinition = new FixedDateInterpolatedCurveDefinition(name, nodes, interpolatorName, fixedDates);
      }
      final FudgeField uniqueId = message.getByName(UNIQUE_ID_FIELD);
      if (uniqueId != null) {
        curveDefinition.setUniqueId(deserializer.fieldValueToObject(UniqueId.class, uniqueId));
      }
      return curveDefinition;
    }
View Full Code Here


    assertEquals(definition, cycleObject(InterpolatedCurveDefinition.class, definition));
    definition = new InterpolatedCurveDefinition(curveName, nodes, interpolatorName, rightExtrapolatorName, leftExtrapolatorName);
    definition.setUniqueId(UniqueId.of("test", "id3"));
    assertEquals(definition, cycleObject(InterpolatedCurveDefinition.class, definition));
    final List<LocalDate> fixedDates = Arrays.asList(LocalDate.of(2013, 10, 1), LocalDate.of(2013, 11, 1), LocalDate.of(2014, 1, 1));
    FixedDateInterpolatedCurveDefinition fixedDateDefinition = new FixedDateInterpolatedCurveDefinition(curveName, nodes, interpolatorName, fixedDates);
    assertEquals(fixedDateDefinition, cycleObject(FixedDateInterpolatedCurveDefinition.class, fixedDateDefinition));
    fixedDateDefinition = new FixedDateInterpolatedCurveDefinition(curveName, nodes, interpolatorName, rightExtrapolatorName, fixedDates);
    assertEquals(fixedDateDefinition, cycleObject(FixedDateInterpolatedCurveDefinition.class, fixedDateDefinition));
    fixedDateDefinition = new FixedDateInterpolatedCurveDefinition(curveName, nodes, interpolatorName, rightExtrapolatorName, leftExtrapolatorName, fixedDates);
    assertEquals(fixedDateDefinition, cycleObject(FixedDateInterpolatedCurveDefinition.class, fixedDateDefinition));
  }
View Full Code Here

        final String interpolatorName = interpolatedDefinition.getInterpolatorName();
        final String leftExtrapolatorName = interpolatedDefinition.getLeftExtrapolatorName();
        final String rightExtrapolatorName = interpolatedDefinition.getRightExtrapolatorName();
        final Interpolator1D interpolator = CombinedInterpolatorExtrapolatorFactory.getInterpolator(interpolatorName, leftExtrapolatorName, rightExtrapolatorName);
        if (definition instanceof FixedDateInterpolatedCurveDefinition) {
          final FixedDateInterpolatedCurveDefinition fixedDateDefinition = (FixedDateInterpolatedCurveDefinition) definition;
          final List<LocalDate> fixedDates = fixedDateDefinition.getFixedDates();
          final DoubleArrayList nodePoints = new DoubleArrayList(fixedDates.size()); //TODO what about equal node points?
          for (final LocalDate fixedDate : fixedDates) {
            nodePoints.add(TimeCalculator.getTimeBetween(valuationDate, fixedDate)); //TODO what to do if the fixed date is before the valuation date?
          }
          final double anchor = nodePoints.get(0); //TODO should the anchor go into the definition?
View Full Code Here

TOP

Related Classes of com.opengamma.financial.analytics.curve.FixedDateInterpolatedCurveDefinition

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.