Package com.opengamma.id

Examples of com.opengamma.id.ExternalScheme


    return new CurveSpecificationBuilderConfiguration(null, fraInstrumentProviders, null, null, null, null, null, null, null, null,
        swapInstrumentProviders, basisSwapInstrumentProviders, null, null, null, null, null, null, null);
  }

  public static CurveSpecificationBuilderConfiguration buildSyntheticAUD6MCurveSpecification() {
    final ExternalScheme scheme = ExternalSchemes.OG_SYNTHETIC_TICKER;
    final Tenor[] tenors = new Tenor[] {Tenor.ONE_YEAR, Tenor.TWO_YEARS, Tenor.THREE_YEARS, Tenor.FOUR_YEARS, Tenor.FIVE_YEARS, Tenor.ofYears(6), Tenor.ofYears(7), Tenor.ofYears(8), Tenor.ofYears(9),
        Tenor.ofYears(10), Tenor.ofYears(11), Tenor.ofYears(12), Tenor.ofYears(15), Tenor.ofYears(20), Tenor.ofYears(25), Tenor.ofYears(30), Tenor.ofYears(40), Tenor.ofYears(50), Tenor.ofYears(80)};
    final Map<Tenor, CurveInstrumentProvider> fraInstrumentProviders = new HashMap<>();
    final Map<Tenor, CurveInstrumentProvider> swapInstrumentProviders = new HashMap<>();
    final Map<Tenor, CurveInstrumentProvider> basisSwapInstrumentProviders = new HashMap<>();
View Full Code Here


    return results;
  }

  public static Map<Currency, CurveSpecificationBuilderConfiguration> buildSyntheticCurveSpecificationBuilderConfigurations() {
    final Map<Currency, CurveSpecificationBuilderConfiguration> configurations = new HashMap<Currency, CurveSpecificationBuilderConfiguration>();
    final ExternalScheme scheme = ExternalSchemes.OG_SYNTHETIC_TICKER;
    configurations.put(Currency.EUR, buildSyntheticCurveSpecificationBuilderConfiguration(Currency.EUR, scheme));
    configurations.put(Currency.DKK, buildSyntheticCurveSpecificationBuilderConfiguration(Currency.DKK, scheme));
    configurations.put(Currency.DEM, buildSyntheticCurveSpecificationBuilderConfiguration(Currency.DEM, scheme));
    configurations.put(Currency.CZK, buildSyntheticCurveSpecificationBuilderConfiguration(Currency.CZK, scheme));
    configurations.put(Currency.CAD, buildSyntheticCurveSpecificationBuilderConfiguration(Currency.CAD, scheme));
View Full Code Here

  @Override
  public ExternalIdOrderConfig buildObject(FudgeDeserializer deserializer, FudgeMsg message) {
    Map<ExternalScheme, Integer> properMap = Maps.newHashMap();
    for (FudgeField field : message.getAllByName("entry")) {
      FudgeMsg entryMsg = deserializer.fieldValueToObject(FudgeMsg.class, field);
      ExternalScheme scheme = ExternalScheme.of(entryMsg.getString("scheme"));
      int rating = entryMsg.getInt("rating");
      properMap.put(scheme, rating);
    }
    ExternalIdOrderConfig config = new ExternalIdOrderConfig();
    config.setRateMap(properMap);
View Full Code Here

      }
      String html = getFreemarker().build(HTML_DIR + "timeseries-add.ftl", out);
      return Response.ok(html).build();
    }
   
    ExternalScheme scheme = ExternalScheme.of(idScheme);
    Set<ExternalId> identifiers = buildSecurityRequest(scheme, idValue);
    Map<ExternalId, UniqueId> added = addTimeSeries(dataProvider, dataField, identifiers, startDate, endDate);
   
    URI uri = null;
    if (!identifiers.isEmpty()) {
View Full Code Here

   
    if (dataField == null || idValue == null || !validStartDate || !validEndDate) {
      return Response.status(Status.BAD_REQUEST).build();
    }
   
    ExternalScheme scheme = ExternalScheme.of(idScheme);
    Set<ExternalId> identifiers = buildSecurityRequest(scheme, idValue);
    Map<ExternalId, UniqueId> added = addTimeSeries(dataProvider, dataField, identifiers, startDate, endDate);

    FlexiBean out = createPostJSONOutput(added, identifiers, scheme, dataProvider, dataField, startDate, endDate);   
    Response response = Response.ok(getFreemarker().build(JSON_DIR + "timeseries-added.ftl", out)).build();
View Full Code Here

      out.put("idscheme", idScheme);
      out.put("idvalue", idValue);
      String html = getFreemarker().build(HTML_DIR + "securities-add.ftl", out);
      return Response.ok(html).build();
    }
    ExternalScheme scheme = ExternalScheme.of(idScheme);
    Collection<ExternalIdBundle> bundles = buildSecurityRequest(scheme, idValue);
    SecurityLoader securityLoader = data().getSecurityLoader();
    Map<ExternalIdBundle, UniqueId> loadedSecurities = securityLoader.loadSecurities(bundles);
   
    URI uri = null;
View Full Code Here

    idScheme = StringUtils.trimToNull(idScheme);
    idValue = StringUtils.trimToNull(idValue);
    if (idScheme == null || idValue == null) {
      return Response.status(Status.BAD_REQUEST).build();
    }
    ExternalScheme scheme = ExternalScheme.of(idScheme);
    Collection<ExternalIdBundle> requestBundles = buildSecurityRequest(scheme, idValue);
    SecurityLoader securityLoader = data().getSecurityLoader();
    Map<ExternalIdBundle, UniqueId> loadedSecurities = securityLoader.loadSecurities(requestBundles);
    FlexiBean out = createPostJSONOutput(loadedSecurities, requestBundles, scheme);   
    return Response.ok(getFreemarker().build(JSON_DIR + "securities-added.ftl", out)).build();
View Full Code Here

    final HullWhiteOneFactorParameters parameters = configs.iterator().next().getValue();
    requirements.add(new ValueRequirement(MarketDataRequirementNames.MARKET_VALUE, ComputationTargetType.PRIMITIVE, parameters.getMeanReversionId()));
    requirements.add(new ValueRequirement(MarketDataRequirementNames.MARKET_VALUE, ComputationTargetType.PRIMITIVE, parameters.getInitialVolatilityId()));
    final Map<Tenor, ExternalId> volatilityTermStructure = parameters.getVolatilityTermStructure();
    for (final Map.Entry<Tenor, ExternalId> entry : volatilityTermStructure.entrySet()) {
      final ExternalScheme scheme = entry.getValue().getScheme();
      final String id = entry.getValue().getValue();
      final ExternalId tenorAppendedId = ExternalId.of(scheme, createId(entry.getKey(), id));
      requirements.add(new ValueRequirement(MarketDataRequirementNames.MARKET_VALUE, ComputationTargetType.PRIMITIVE, tenorAppendedId));
    }
    final ZonedDateTime atZDT = ZonedDateTime.ofInstant(atInstant, ZoneOffset.UTC);
    return new AbstractInvokingCompiledFunction(atZDT.with(LocalTime.MIDNIGHT), atZDT.plusDays(1).with(LocalTime.MIDNIGHT).minusNanos(1000000)) {

      @Override
      public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target,
          final Set<ValueRequirement> desiredValues) throws AsynchronousExecution {
        final Clock snapshotClock = executionContext.getValuationClock();
        final ZonedDateTime now = ZonedDateTime.now(snapshotClock);
        Object meanReversionObject = inputs.getValue(new ValueRequirement(MarketDataRequirementNames.MARKET_VALUE,
            ComputationTargetType.PRIMITIVE, parameters.getMeanReversionId()));
        if (meanReversionObject == null) {
          // Jim - these are hacks that should be removed.
          meanReversionObject = MEAN_REVERSION_DEFAULT;
          s_logger.warn("Using default mean reversion");
          //throw new OpenGammaRuntimeException("Could not get mean reversion value");
        }
        Object initialVolatilityObject = inputs.getValue(new ValueRequirement(MarketDataRequirementNames.MARKET_VALUE,
            ComputationTargetType.PRIMITIVE, parameters.getInitialVolatilityId()));
        if (initialVolatilityObject == null) {
          // Jim - these are hacks that should be removed.
          initialVolatilityObject = INITIAL_VOLATILITY_DEFAULT;
          s_logger.warn("Using default initial volatility");
          //throw new OpenGammaRuntimeException("Could not get initial volatility value");
        }
        final Double meanReversion = (Double) meanReversionObject;
        final Double initialVolatility = (Double) initialVolatilityObject;
        final DoubleArrayList volatility = new DoubleArrayList();
        volatility.add(initialVolatility);
        final DoubleArrayList volatilityTime = new DoubleArrayList();
        for (final Map.Entry<Tenor, ExternalId> entry : volatilityTermStructure.entrySet()) {
          final ExternalScheme scheme = entry.getValue().getScheme();
          final String id = entry.getValue().getValue();
          final ExternalId tenorAppendedId = ExternalId.of(scheme, createId(entry.getKey(), id));
          Object volatilityObject = inputs.getValue(new ValueRequirement(MarketDataRequirementNames.MARKET_VALUE,
              ComputationTargetType.PRIMITIVE, tenorAppendedId));
          // Jim - next block is a hack that should be removed.
View Full Code Here

    if (underlyingId == null) {
      s_logger.error("Underlying id for security {} was null", security);
      return null;
    }
    final String value = underlyingId.getValue();
    final ExternalScheme scheme = underlyingId.getScheme();
    if (scheme.equals(ExternalSchemes.BLOOMBERG_BUID) || scheme.equals(ExternalSchemes.BLOOMBERG_BUID_WEAK)) {
      if (security instanceof EquityIndexOptionSecurity) {
        final int length = value.length();
        return value.substring(length - 3, length).toUpperCase(); //TODO fix this
      }
      s_logger.info("Can only use BUIDs for equity index options; have {}", security);
      return null;
    } else if (scheme.equals(ExternalSchemes.BLOOMBERG_TICKER) || scheme.equals(ExternalSchemes.BLOOMBERG_TICKER_WEAK)) {
      final int lastSpace = value.lastIndexOf(" ");
      return value.substring(0, lastSpace);
    }
    s_logger.info("Cannot handle scheme of type {}", scheme);
    return null;
View Full Code Here

   * @return The equity or index name, null if the underlying id is not a Bloomberg ticker
   */
  public static String getIndexOrEquityNameFromUnderlying(final ExternalId underlyingId) {
    ArgumentChecker.notNull(underlyingId, "underlying id");
    final String value = underlyingId.getValue();
    final ExternalScheme scheme = underlyingId.getScheme();
    if (scheme.equals(ExternalSchemes.BLOOMBERG_TICKER) || scheme.equals(ExternalSchemes.BLOOMBERG_TICKER_WEAK)) {
      final int lastSpace = value.lastIndexOf(" ");
      return value.substring(0, lastSpace);
    }
    s_logger.info("Cannot handle scheme of type {}", scheme);
    return null;
View Full Code Here

TOP

Related Classes of com.opengamma.id.ExternalScheme

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.