Package com.opengamma.id

Examples of com.opengamma.id.ExternalIdBundle


   */
  protected ManageablePosition createPosition(BondSecurity security) {
    s_logger.info("Creating position {}", security);
    int shares = (RandomUtils.nextInt(490) + 10) * 10;
    ExternalId buid = security.getExternalIdBundle().getExternalId(ExternalSchemes.BLOOMBERG_BUID);
    ExternalIdBundle bundle;
    if (buid != null) {
      bundle = ExternalIdBundle.of(buid);
    } else {
      bundle = security.getExternalIdBundle();
    }
View Full Code Here


    manageablePosition.setAttributes(position.getAttributes());
    final Collection<Trade> trades = position.getTrades();
    final List<ManageableTrade> manageableTrades = new ArrayList<ManageableTrade>(trades.size());
    for (Trade trade : trades) {
      final ManageableTrade mtrade = new ManageableTrade(trade);
      final ExternalIdBundle replacementKey = mapSecurityKey(mtrade.getSecurityLink().getExternalId());
      if (replacementKey != null) {
        mtrade.getSecurityLink().setExternalId(replacementKey);
      }
      mtrade.setAttributes(trade.getAttributes());
      manageableTrades.add(mtrade);
View Full Code Here

    }

    @Override
    public VanillaIborLegConvention buildObject(final FudgeDeserializer deserializer, final FudgeMsg message) {
      final String name = message.getString(NAME_FIELD);
      final ExternalIdBundle externalIdBundle = deserializer.fieldValueToObject(ExternalIdBundle.class, message.getByName(EXTERNAL_ID_BUNDLE_FIELD));
      final ExternalId iborIndexConvention = deserializer.fieldValueToObject(ExternalId.class, message.getByName(IBOR_INDEX_CONVENTION_FIELD));
      final boolean isAdvanceFixing = message.getBoolean(ADVANCE_FIXING_FIELD);
      final StubType stubType = StubType.valueOf(message.getString(STUB_TYPE_FIELD));
      final String interpolatorName = message.getString(INTERPOLATOR_NAME_FIELD);
      final Tenor resetTenor = Tenor.of(Period.parse(message.getString(RESET_TENOR_FIELD)));
View Full Code Here

    }

    @Override
    public InflationLegConvention buildObject(final FudgeDeserializer deserializer, final FudgeMsg message) {
      final String name = message.getString(NAME_FIELD);
      final ExternalIdBundle externalIdBundle = deserializer.fieldValueToObject(ExternalIdBundle.class, message.getByName(EXTERNAL_ID_BUNDLE_FIELD));
      final BusinessDayConvention businessDayConvention = BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention(message.getString(BUSINESS_DAY_CONVENTION_FIELD));
      final DayCount dayCount = DayCountFactory.INSTANCE.getDayCount(message.getString(DAYCOUNT_FIELD));
      final boolean isEOM = message.getBoolean(IS_EOM_FIELD);
      final int monthLag = message.getInt(MONTH_LAG_FIELD);
      final int spotLag = message.getInt(SPOT_LAG_FIELD);
View Full Code Here

      } else if (requirement.getTargetReference().getType().isTargetType(ComputationTargetType.PRIMITIVE)) {
        requirement.getTargetReference().accept(new ComputationTargetReferenceVisitor<Void>() {

          @Override
          public Void visitComputationTargetRequirement(final ComputationTargetRequirement requirement) {
            final ExternalIdBundle bundle = requirement.getIdentifiers();
            eval.setVariable("externalIds", bundle);
            if (bundle.size() == 1) {
              eval.setVariable("externalId", bundle.iterator().next());
            }
            return null;
          }

          @Override
View Full Code Here

  public Set<ValueRequirement> getRequirements(final FunctionCompilationContext context, final ComputationTarget target, final ValueRequirement desiredValue) {
    final CurrencyPair currencies = (CurrencyPair) target.getValue();
    final ValueProperties.Builder constraints = ValueProperties
        .with(AbstractCurrencyMatrixSourcingFunction.SOURCE_CURRENCY_PROPERTY, currencies.getCounter().getCode())
        .with(AbstractCurrencyMatrixSourcingFunction.TARGET_CURRENCY_PROPERTY, currencies.getBase().getCode());
    ExternalIdBundle matrixIdentifiers = null;
    if (desiredValue.getConstraints().getProperties() != null) {
      for (String constraintName : desiredValue.getConstraints().getProperties()) {
        if (ValuePropertyNames.FUNCTION.equals(constraintName) || constraintName.startsWith(ValuePropertyNames.OUTPUT_RESERVED_PREFIX)) {
          continue;
        }
View Full Code Here

    Security sec;
    // retrieve by unique identifier
    sec = getSecurity(uniqueId);
    normalizeSecurity(sec);
    assertEquals(security, sec);
    ExternalIdBundle bundle = null;
    if (security.getExternalIdBundle().size() > 0) {
      final Iterator<ExternalId> iterator = security.getExternalIdBundle().iterator();
      bundle = ExternalIdBundle.EMPTY;
      // retrieve with one identifier
      ExternalId id = iterator.next();
      bundle = bundle.withExternalId(id);
      sec = getSecurity(bundle);
      normalizeSecurity(sec);
      assertEquals(security, sec);
      // retrieve with one valid and one incorrect identifier
      sec = getSecurity(Arrays.asList(id, ExternalId.of("FOO", "BAR")));
View Full Code Here

    return result;
  }

  private void addExternalIds(FinancialSecurity security, Map<String, Object> secMap) {
    Map<String, String> identifiers = Maps.newHashMap();
    ExternalIdBundle externalIdBundle = security.getExternalIdBundle();
    if (externalIdBundle.getExternalId(ExternalSchemes.BLOOMBERG_BUID) != null) {
      identifiers.put(ExternalSchemes.BLOOMBERG_BUID.getName(), ExternalSchemes.BLOOMBERG_BUID.getName() + "-" + externalIdBundle.getValue(ExternalSchemes.BLOOMBERG_BUID));
    }
    if (externalIdBundle.getExternalId(ExternalSchemes.BLOOMBERG_TICKER) != null) {
      identifiers.put(ExternalSchemes.BLOOMBERG_TICKER.getName(), ExternalSchemes.BLOOMBERG_TICKER.getName() + "-" + externalIdBundle.getValue(ExternalSchemes.BLOOMBERG_TICKER));
    }
    if (externalIdBundle.getExternalId(ExternalSchemes.CUSIP) != null) {
      identifiers.put(ExternalSchemes.CUSIP.getName(), ExternalSchemes.CUSIP.getName() + "-" + externalIdBundle.getValue(ExternalSchemes.CUSIP));
    }
    if (externalIdBundle.getExternalId(ExternalSchemes.ISIN) != null) {
      identifiers.put(ExternalSchemes.ISIN.getName(), ExternalSchemes.ISIN.getName() + "-" + externalIdBundle.getValue(ExternalSchemes.ISIN));
    }
    if (externalIdBundle.getExternalId(ExternalSchemes.SEDOL1) != null) {
      identifiers.put(ExternalSchemes.SEDOL1.getName(), ExternalSchemes.SEDOL1.getName() + "-" + externalIdBundle.getValue(ExternalSchemes.SEDOL1));
    }
    secMap.put("identifiers", identifiers);
  }
View Full Code Here

      }
    }
    if (security == null) {
      return null;
    }
    final ExternalIdBundle externalIdBundle = security.getExternalIdBundle();
    final Pair<LocalDate, Double> results = _htsSource.getLatestDataPoint(FIELD, externalIdBundle, RESOLUTION_KEY);
    if (results != null && results.getFirst() != null && results.getSecond() != null) {
      final Double beta = results.getSecond();
      return beta;
    }
View Full Code Here

  @Test
  public void bondFuture() throws JSONException {
    ZonedDateTime firstDeliveryDate = zdt(2012, 12, 21, 11, 0, 0, 0, ZoneOffset.UTC);
    ZonedDateTime lastDeliveryDate = zdt(2013, 12, 21, 11, 0, 0, 0, ZoneOffset.UTC);
    ZonedDateTime expiryDate = zdt(2013, 12, 22, 11, 0, 0, 0, ZoneOffset.UTC);
    ExternalIdBundle bundle1 = ExternalIdBundle.of(ExternalId.of("sch1", "123"), ExternalId.of("sch1", "234"));
    ExternalIdBundle bundle2 = ExternalIdBundle.of(ExternalId.of("sch1", "345"));
    List<BondFutureDeliverable> basket = Lists.newArrayList(
        new BondFutureDeliverable(bundle1, 111),
        new BondFutureDeliverable(bundle2, 222));
    BondFutureSecurity security = new BondFutureSecurity(new Expiry(expiryDate), "exch", "settExch", Currency.GBP, 1234,
                                                         basket, firstDeliveryDate, lastDeliveryDate, "category");
View Full Code Here

TOP

Related Classes of com.opengamma.id.ExternalIdBundle

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.