Package com.opengamma.financial.analytics

Examples of com.opengamma.financial.analytics.LocalDateLabelledMatrix1D


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


    }
    final Object bucketedCS01Object = inputs.getValue(ValueRequirementNames.BUCKETED_CS01);
    if (bucketedCS01Object == null) {
      throw new OpenGammaRuntimeException("Could not get bucketed CS01");
    }
    final LocalDateLabelledMatrix1D bucketedCS01 = (LocalDateLabelledMatrix1D) bucketedCS01Object;
    final Object htsObject = inputs.getValue(ValueRequirementNames.CREDIT_SPREAD_CURVE_HISTORICAL_TIME_SERIES);
    if (htsObject == null) {
      throw new OpenGammaRuntimeException("Could not get credit spread curve historical time series");
    }
    final HistoricalTimeSeriesBundle hts = (HistoricalTimeSeriesBundle) htsObject;
View Full Code Here

                      analytic,
                      spreadCurveBump,
                      spreadBumpType,
                      gammaCS01,
                      dates);
    final LocalDateLabelledMatrix1D cs01Matrix = new LocalDateLabelledMatrix1D(dates, gammaCS01);
    final ValueSpecification spec = new ValueSpecification(ValueRequirementNames.BUCKETED_GAMMA_CS01, target.toSpecification(), properties);
    return Collections.singleton(new ComputedValue(spec, cs01Matrix));
  }
View Full Code Here

            TENOR_LABELLED_TIME_SERIES_MATRIX_1D_VALUE_NAMES.contains(spec.getValueName())));
  }

  public static List<ColumnMeta> columnMeta(Object value) {
    if (value instanceof LocalDateLabelledMatrix1D) {
      LocalDateLabelledMatrix1D matrix = (LocalDateLabelledMatrix1D) value;
      return getLocalDateDoubleLabelledMatrix1DColumnMeta(matrix);
    }
    if (value instanceof TenorLabelledLocalDateDoubleTimeSeriesMatrix1D) {
      TenorLabelledLocalDateDoubleTimeSeriesMatrix1D matrix = (TenorLabelledLocalDateDoubleTimeSeriesMatrix1D) value;
      return getTenorLabelledLocalDateDoubleTimeSeriesMatrix1DColumnMeta(matrix);
View Full Code Here

  @Test
  public void testLocalDate() {
    final LocalDate[] keys = new LocalDate[] {LocalDate.of(2012, 1, 1), LocalDate.of(2013, 1, 1), LocalDate.of(2014, 1, 1), LocalDate.of(2015, 1, 1), LocalDate.of(2016, 1, 1)};
    final Object[] labels = new Object[] {"1y", "2y", "3y", "4y", "5y"};
    final double[] values = new double[] {0.1, 0.2, 0.3, 0.4, 0.5};
    final LocalDateLabelledMatrix1D m1 = new LocalDateLabelledMatrix1D(keys, labels, values);
    final LocalDateLabelledMatrix1D m2 = cycleObject(LocalDateLabelledMatrix1D.class, m1);
    assertEquals(m1, m2);
    final LocalDateLabelledMatrix1D m3 = new LocalDateLabelledMatrix1D(keys, values);
    final LocalDateLabelledMatrix1D m4 = cycleObject(LocalDateLabelledMatrix1D.class, m3);
    assertEquals(m3, m4);
    final LocalDateLabelledMatrix1D m5 = new LocalDateLabelledMatrix1D(keys, keys, values);
    final LocalDateLabelledMatrix1D m6 = cycleObject(LocalDateLabelledMatrix1D.class, m5);
    assertEquals(m5, m6);
    final LocalDateLabelledMatrix1D m7 = new LocalDateLabelledMatrix1D(keys, labels, "labels", values, "values");
    final LocalDateLabelledMatrix1D m8 = cycleObject(LocalDateLabelledMatrix1D.class, m7);
    assertEquals(m7, m8);
  }
View Full Code Here

                                                CDSAnalytic analytic) {
    final LocalDate[] dates = new LocalDate[yieldCurve.getNumberOfKnots()];

    final double[] ir01 = StandardVanillaBucketedIR01CDSFunction.getBucketedIR01(definition, yieldCurve, valuationDate, properties, hazardCurve, analytic, dates);
    //final String[] labels = CreditFunctionUtils.getFormattedBucketedXAxis(dates, valuationDate);
    final LocalDateLabelledMatrix1D ir01Matrix = new LocalDateLabelledMatrix1D(dates, ir01);
    final ValueSpecification spec = new ValueSpecification(ValueRequirementNames.BUCKETED_IR01, target.toSpecification(), properties);
    return Collections.singleton(new ComputedValue(spec, ir01Matrix));
  }
View Full Code Here

                                                final ValueProperties properties,
                                                final FunctionInputs inputs,
                                                ISDACompliantCreditCurve hazardCurve, CDSAnalytic analytic) {
    //TODO: bump type
    Double bump = Double.valueOf(Iterables.getOnlyElement(properties.getValues(CreditInstrumentPropertyNamesAndValues.PROPERTY_SPREAD_CURVE_BUMP)));
    final LocalDateLabelledMatrix1D cs01Matrix = getBucketedCS01(definition, yieldCurve, times, hazardCurve, analytic, bump * 1e-4);
    final ValueSpecification spec = new ValueSpecification(ValueRequirementNames.BUCKETED_CS01, target.toSpecification(), properties);
    return Collections.singleton(new ComputedValue(spec, cs01Matrix));
  }
View Full Code Here

    final LocalDate[] dates = new LocalDate[n];
    for (int i = 0; i < n; i++) {
      dates[i] = times[i].toLocalDate();
      cs01Values[i] *= 1e-4 * definition.getNotional();
    }
    return new LocalDateLabelledMatrix1D(dates, cs01Values);
  }
View Full Code Here

    final LocalDate[] dates = new LocalDate[yieldCurve.getNumberOfKnots()];

    final double[] ir01 = getBucketedIR01(definition, yieldCurve, valuationDate, properties, hazardCurve, analytic, dates);

    //final String[] labels = CreditFunctionUtils.getFormattedBucketedXAxis(dates, valuationDate);
    final LocalDateLabelledMatrix1D ir01Matrix = new LocalDateLabelledMatrix1D(dates, ir01);
    final ValueSpecification spec = new ValueSpecification(ValueRequirementNames.BUCKETED_IR01, target.toSpecification(), properties);
    return Collections.singleton(new ComputedValue(spec, ir01Matrix));
  }
View Full Code Here

    final int n = calibrationTenors.length;
    final LocalDate[] dates = new LocalDate[n];
    for (int i = 0; i < n; i++) {
      dates[i] = calibrationTenors[i].toLocalDate();
    }
    final LocalDateLabelledMatrix1D cs01Matrix = new LocalDateLabelledMatrix1D(dates, cs01);
    final ValueSpecification spec = new ValueSpecification(ValueRequirementNames.BUCKETED_CS01, target.toSpecification(), properties);
    return Collections.singleton(new ComputedValue(spec, cs01Matrix));
  }
View Full Code Here

TOP

Related Classes of com.opengamma.financial.analytics.LocalDateLabelledMatrix1D

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.