Examples of TenorLabelledLocalDateDoubleTimeSeriesMatrix1D


Examples of com.opengamma.financial.analytics.TenorLabelledLocalDateDoubleTimeSeriesMatrix1D

  /* package */ TenorLabelledLocalDateDoubleTimeSeriesMatrix1D convertLabelledMatrix(final LabelledObjectMatrix1D<Tenor, LocalDateDoubleTimeSeries, Period> values, final DoubleTimeSeries<LocalDate> conversionRates) {
    LocalDateDoubleTimeSeries[] convertedValues = new LocalDateDoubleTimeSeries[values.size()];
    for (int i = 0; i < values.size(); i++) {
      convertedValues[i] = (LocalDateDoubleTimeSeries) convertTimeSeries(values.getValues()[i], conversionRates);
    }
    return new TenorLabelledLocalDateDoubleTimeSeriesMatrix1D(values.getKeys(), values.getLabels(), values.getLabelsTitle(), convertedValues, values.getValuesTitle());
  }
View Full Code Here

Examples of com.opengamma.financial.analytics.TenorLabelledLocalDateDoubleTimeSeriesMatrix1D

    final boolean includeStart = HistoricalTimeSeriesFunctionUtils.parseBoolean(bundleValue.getSpecification().getProperty(HistoricalTimeSeriesFunctionUtils.INCLUDE_START_PROPERTY));
    final FXForwardCurveDefinition fxForwardCurveDefinition = (FXForwardCurveDefinition) inputs.getValue(ValueRequirementNames.FX_FORWARD_CURVE_DEFINITION);

    final Tenor[] tenors = fxForwardCurveDefinition.getTenors();

    final TenorLabelledLocalDateDoubleTimeSeriesMatrix1D returnSeriesVector = getReturnSeriesVector(bundle, tenors,
        schedule, samplingFunction, returnSeriesStart, includeStart, desiredValue);
    final ValueSpecification resultSpec = new ValueSpecification(ValueRequirementNames.FX_FORWARD_CURVE_RETURN_SERIES, target.toSpecification(), desiredValue.getConstraints());
    return ImmutableSet.of(new ComputedValue(resultSpec, returnSeriesVector));
  }
View Full Code Here

Examples of com.opengamma.financial.analytics.TenorLabelledLocalDateDoubleTimeSeriesMatrix1D

      // Clip the time-series to the range originally asked for
      returnSeries = returnSeries.subSeries(startDate, includeStart, returnSeries.getLatestTime(), true);

      returnSeriesArray[t] = returnSeries;
    }
    return new TenorLabelledLocalDateDoubleTimeSeriesMatrix1D(tenors, returnSeriesArray);
  }
View Full Code Here

Examples of com.opengamma.financial.analytics.TenorLabelledLocalDateDoubleTimeSeriesMatrix1D

      keys.toArray(keysArray);
      final Object[] labelsArray = new Object[matrixSize];
      labels.toArray(labelsArray);
      final LocalDateDoubleTimeSeries[] valuesArray = new LocalDateDoubleTimeSeries[matrixSize];
      values.toArray(valuesArray);
      return new TenorLabelledLocalDateDoubleTimeSeriesMatrix1D(keysArray, labelsArray, labelsTitle, valuesArray, valuesTitle);
    }
View Full Code Here

Examples of com.opengamma.financial.analytics.TenorLabelledLocalDateDoubleTimeSeriesMatrix1D

  }

  @Override
  public Set<ComputedValue> execute(FunctionExecutionContext executionContext, FunctionInputs inputs, ComputationTarget target, Set<ValueRequirement> desiredValues) throws AsynchronousExecution {
    ValueRequirement desiredValue = desiredValues.iterator().next();
    TenorLabelledLocalDateDoubleTimeSeriesMatrix1D nodalPnlSeries = (TenorLabelledLocalDateDoubleTimeSeriesMatrix1D) inputs.getValue(ValueRequirementNames.YIELD_CURVE_PNL_SERIES);
    LocalDateDoubleTimeSeries result = nodalPnlSeries.getValues()[0];
    for (int i = 1; i < nodalPnlSeries.size(); i++) {
      result = result.add(nodalPnlSeries.getValues()[i]);
    }
    ValueSpecification resultSpec = new ValueSpecification(ValueRequirementNames.PNL_SERIES, target.toSpecification(), desiredValue.getConstraints());
    return ImmutableSet.of(new ComputedValue(resultSpec, result));
  }
View Full Code Here

Examples of com.opengamma.financial.analytics.TenorLabelledLocalDateDoubleTimeSeriesMatrix1D

      final Position position = target.getPosition();
      final ValueRequirement desiredValue = desiredValues.iterator().next();
      final ValueProperties constraints = desiredValue.getConstraints();
      final Set<String> resultCurrencies = constraints.getValues(CURRENCY);
      final FXForwardSecurity security = (FXForwardSecurity) position.getSecurity();
      final TenorLabelledLocalDateDoubleTimeSeriesMatrix1D ycReturnSeries = (TenorLabelledLocalDateDoubleTimeSeriesMatrix1D) inputs.getValue(ValueRequirementNames.YIELD_CURVE_RETURN_SERIES);
      final TenorLabelledLocalDateDoubleTimeSeriesMatrix1D fcReturnSeries = (TenorLabelledLocalDateDoubleTimeSeriesMatrix1D) inputs.getValue(ValueRequirementNames.FX_FORWARD_CURVE_RETURN_SERIES);
      final DoubleLabelledMatrix1D sensitivities = (DoubleLabelledMatrix1D) inputs.getValue(ValueRequirementNames.YIELD_CURVE_NODE_SENSITIVITIES);
      final Currency payCurrency = security.getPayCurrency();
      final Currency receiveCurrency = security.getReceiveCurrency();
      final CurrencyPair currencyPair = _currencyPairs.getCurrencyPair(payCurrency, receiveCurrency);
      final String curveCurrency = desiredValue.getConstraint(CURVE_CURRENCY);

      final Currency baseCurrency = currencyPair.getBase();
      final ValueProperties resultProperties = desiredValues.iterator().next().getConstraints();
      TenorLabelledLocalDateDoubleTimeSeriesMatrix1D returnSeries;
      if (ycReturnSeries != null) {
        returnSeries = ycReturnSeries;
      } else if (fcReturnSeries != null) {
        returnSeries = fcReturnSeries;
      } else {
        throw new OpenGammaRuntimeException("Could not get return series for either yield curve or FX forward curve");
      }
      if (returnSeries.size() != sensitivities.size()) {
        throw new OpenGammaRuntimeException("Yield Curve Node Sensitivities vector of size " + sensitivities.size() + " but return series vector of size " + returnSeries.size());
      }
      TenorLabelledLocalDateDoubleTimeSeriesMatrix1D pnlSeriesVector;
      if (resultCurrencies == null || resultCurrencies.size() != 1) {
        s_logger.warn("No Currency property - returns result in base currency");
        pnlSeriesVector = getPnLVector(returnSeries, sensitivities);
      } else {
        final String resultCurrency = Iterables.getOnlyElement(resultCurrencies);
View Full Code Here

Examples of com.opengamma.financial.analytics.TenorLabelledLocalDateDoubleTimeSeriesMatrix1D

      final LocalDateDoubleTimeSeries[] nodesPnlSeries = new LocalDateDoubleTimeSeries[size];
      for (int i = 0; i < size; i++) {
        final LocalDateDoubleTimeSeries nodePnlSeries = returnSeries.getValues()[i].multiply(sensitivities.getValues()[i]);
        nodesPnlSeries[i] = nodePnlSeries;
      }
      return new TenorLabelledLocalDateDoubleTimeSeriesMatrix1D(returnSeries.getKeys(), returnSeries.getLabels(), nodesPnlSeries);
    }
View Full Code Here

Examples of com.opengamma.financial.analytics.TenorLabelledLocalDateDoubleTimeSeriesMatrix1D

          final LocalDateDoubleTimeSeries convertedSeries = conversionSeries.reciprocal().multiply(sensitivities.getValues()[i]);
          final LocalDateDoubleTimeSeries nodePnlSeries = returnSeries.getValues()[i].multiply(convertedSeries);
          nodesPnlSeries[i] = nodePnlSeries;
        }
      }
      return new TenorLabelledLocalDateDoubleTimeSeriesMatrix1D(returnSeries.getKeys(), returnSeries.getLabels(), nodesPnlSeries);
    }
View Full Code Here

Examples of com.opengamma.financial.analytics.TenorLabelledLocalDateDoubleTimeSeriesMatrix1D

  public void testConvertLabelledMatrix() throws Exception {
    final double conversionFactor = 0.5;
    final Tenor[] tenors = new Tenor[] {Tenor.ONE_DAY, Tenor.TWO_DAYS, Tenor.THREE_DAYS};
    final LocalDateDoubleTimeSeries[] dateArray = new LocalDateDoubleTimeSeries[] { ImmutableLocalDateDoubleTimeSeries.of(new LocalDate[] {LocalDate.now()}, new double[] { 2.0 }),
        ImmutableLocalDateDoubleTimeSeries.of(new LocalDate[] {LocalDate.now()}, new double[] { 3.0 }), ImmutableLocalDateDoubleTimeSeries.of(new LocalDate[] {LocalDate.now()}, new double[] { 4.0 })};
    final TenorLabelledLocalDateDoubleTimeSeriesMatrix1D instance = new TenorLabelledLocalDateDoubleTimeSeriesMatrix1D(tenors, dateArray);
    final DoubleTimeSeries<LocalDate> conversionRates = ImmutableLocalDateDoubleTimeSeries.of(new LocalDate[] {LocalDate.now()},new double[] {conversionFactor} );

    final CurrencySeriesConversionFunction function = new CurrencySeriesConversionFunction("Blah");
    final TenorLabelledLocalDateDoubleTimeSeriesMatrix1D result = function.convertLabelledMatrix(instance, conversionRates);
    assertEquals(instance.getValues()[0].getEarliestValueFast() / conversionFactor, result.getValues()[0].getEarliestValueFast());
    assertEquals(instance.getValues()[1].getEarliestValueFast() / conversionFactor, result.getValues()[1].getEarliestValueFast());
    assertEquals(instance.getValues()[2].getEarliestValueFast() / conversionFactor, result.getValues()[2].getEarliestValueFast());
  }
View Full Code Here

Examples of com.opengamma.financial.analytics.TenorLabelledLocalDateDoubleTimeSeriesMatrix1D

    if (value instanceof LocalDateLabelledMatrix1D) {
      LocalDateLabelledMatrix1D matrix = (LocalDateLabelledMatrix1D) value;
      return getLocalDateDoubleLabelledMatrix1DColumnMeta(matrix);
    }
    if (value instanceof TenorLabelledLocalDateDoubleTimeSeriesMatrix1D) {
      TenorLabelledLocalDateDoubleTimeSeriesMatrix1D matrix = (TenorLabelledLocalDateDoubleTimeSeriesMatrix1D) value;
      return getTenorLabelledLocalDateDoubleTimeSeriesMatrix1DColumnMeta(matrix);
    }
    return Collections.emptyList();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.