Package com.opengamma.core.historicaltimeseries

Examples of com.opengamma.core.historicaltimeseries.HistoricalTimeSeriesAdjuster


          constraints.withOptional(HistoricalTimeSeriesFunctionUtils.AGE_LIMIT_PROPERTY);
        }
      }
    }
    // Add adjuster / normalisation constraint
    final HistoricalTimeSeriesAdjuster adjuster = resolutionResult.getAdjuster();
    final String adjustment = (adjuster == null) ? "" : adjuster.getAdjustment(resolutionResult.getHistoricalTimeSeriesInfo().getExternalIdBundle().toBundle()).toString();
    constraints.with(HistoricalTimeSeriesFunctionUtils.ADJUST_PROPERTY, adjustment);
   
    ValueRequirement valueRequirement = new ValueRequirement(ValueRequirementNames.HISTORICAL_TIME_SERIES_LATEST, ComputationTargetType.PRIMITIVE, htsId, constraints.get());
    return Collections.singleton(valueRequirement);
  }
View Full Code Here


  }

  public static HistoricalTimeSeriesFieldAdjustmentMap createFieldAdjustmentMap(final ReferenceDataProvider referenceDataProvider, final CacheManager cacheManager) {
    final HistoricalTimeSeriesFieldAdjustmentMap fieldAdjustmentMap = new HistoricalTimeSeriesFieldAdjustmentMap(BloombergConstants.BLOOMBERG_DATA_SOURCE_NAME);
    final BloombergRateClassifier rateClassifier = new BloombergRateClassifier(referenceDataProvider, cacheManager, ExternalSchemes.BLOOMBERG_BUID);
    final HistoricalTimeSeriesAdjuster rateNormalizer = new BloombergRateHistoricalTimeSeriesNormalizer(rateClassifier);
    final BloombergFixedRateHistoricalTimeSeriesNormalizer div100 = new BloombergFixedRateHistoricalTimeSeriesNormalizer(new HistoricalTimeSeriesAdjustment.DivideBy(100.0));
    fieldAdjustmentMap.addFieldAdjustment(MarketDataRequirementNames.SETTLE_PRICE, null, BloombergConstants.BBG_FIELD_SETTLE_PRICE, rateNormalizer);
    fieldAdjustmentMap.addFieldAdjustment(MarketDataRequirementNames.MARKET_VALUE, null, BloombergConstants.BBG_FIELD_LAST_PRICE, rateNormalizer);
    fieldAdjustmentMap.addFieldAdjustment(BloombergConstants.BBG_FIELD_LAST_PRICE, null, BloombergConstants.BBG_FIELD_LAST_PRICE, rateNormalizer);
    fieldAdjustmentMap.addFieldAdjustment(MarketDataRequirementNames.VOLUME, null, BloombergConstants.BBG_FIELD_VOLUME, null);
View Full Code Here

    }
    return properties;
  }

  public static ValueRequirement createHTSRequirement(final HistoricalTimeSeriesResolutionResult timeSeries, final String dataField, final ValueProperties constraints) {
    final HistoricalTimeSeriesAdjuster adjuster = timeSeries.getAdjuster();
    final String adjustment = (adjuster == null) ? "" : adjuster.getAdjustment(timeSeries.getHistoricalTimeSeriesInfo().getExternalIdBundle().toBundle()).toString();
    final Builder properties = constraints.copy()
        .with(DATA_FIELD_PROPERTY, dataField)
        .with(ADJUST_PROPERTY, adjustment);
    return new ValueRequirement(ValueRequirementNames.HISTORICAL_TIME_SERIES, ComputationTargetType.PRIMITIVE, timeSeries.getHistoricalTimeSeriesInfo().getUniqueId(),
        properties.get());
View Full Code Here

        properties.get());
  }

  public static ValueRequirement createHTSRequirement(final HistoricalTimeSeriesResolutionResult timeSeries, final String dataField, final DateConstraint startDate, final boolean includeStart,
      final DateConstraint endDate, final boolean includeEnd) {
    final HistoricalTimeSeriesAdjuster adjuster = timeSeries.getAdjuster();
    final String adjustment = (adjuster == null) ? "" : adjuster.getAdjustment(timeSeries.getHistoricalTimeSeriesInfo().getExternalIdBundle().toBundle()).toString();
    final Builder properties = htsConstraints(ValueProperties.builder(), startDate, includeStart, endDate, includeEnd)
        .with(DATA_FIELD_PROPERTY, dataField)
        .with(ADJUST_PROPERTY, adjustment);
    return new ValueRequirement(ValueRequirementNames.HISTORICAL_TIME_SERIES, ComputationTargetType.PRIMITIVE, timeSeries.getHistoricalTimeSeriesInfo().getUniqueId(),
        properties.get());
View Full Code Here

      if (selectedResult == null) {
        s_logger.debug("Resolver failed to find any time-series for {} using {}/{}", new Object[] {identifierBundle, dataField, resolutionKey });
        return null;
      }
      HistoricalTimeSeriesFieldAdjustment fieldAdjustment = fieldMappings.get(selectedResult.getDataSource());
      HistoricalTimeSeriesAdjuster adjuster = fieldAdjustment != null ? fieldAdjustment.getAdjuster() : null;
      return new HistoricalTimeSeriesResolutionResult(selectedResult, adjuster);
    } else {
      return search(dataSource, dataProvider, dataField);
    }
  }
View Full Code Here

    HistoricalTimeSeriesFieldAdjustmentMap map1 = new HistoricalTimeSeriesFieldAdjustmentMap("BLOOMBERG");
    map1.addFieldAdjustment(syntheticFieldName, "CMPL", "PX_LAST", null);
   
    // Synthetic -> (*, REUTERS.VOLUME, adjuster)
    HistoricalTimeSeriesFieldAdjustmentMap map2 = new HistoricalTimeSeriesFieldAdjustmentMap("REUTERS");
    HistoricalTimeSeriesAdjuster reutersAdjuster = mock(HistoricalTimeSeriesAdjuster.class);
    map2.addFieldAdjustment(syntheticFieldName, null, "VOLUME", reutersAdjuster);
   
    FieldMappingHistoricalTimeSeriesResolver resolver = new FieldMappingHistoricalTimeSeriesResolver(ImmutableList.<HistoricalTimeSeriesFieldAdjustmentMap>of(map1, map2), _selector, _htsMaster);
    for (ExternalIdBundleWithDates identifierBundleWithDates : _identifiers) {
      resolver.resolve(identifierBundleWithDates.toBundle(), null, null, null, "PX_LAST", null);
View Full Code Here

TOP

Related Classes of com.opengamma.core.historicaltimeseries.HistoricalTimeSeriesAdjuster

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.