Package com.opengamma.id

Examples of com.opengamma.id.ExternalIdBundle


  public void test_construction_ExternalIdBundle_BigDecimal_Counterparty_LocalDate_OffsetTime_nullLocalDate() {
    new SimpleTrade(new SimpleSecurityLink(BUNDLE), BigDecimal.ONE, COUNTERPARTY, null, TRADE_OFFSET_DATETIME.toOffsetTime());
  }

  public void test_construction_Security_BigDecimal_Counterparty_Instant() {
    ExternalIdBundle securityKey = ExternalIdBundle.of(ExternalId.of("A", "B"));
    SimpleSecurity security = new SimpleSecurity("A");
    security.setExternalIdBundle(securityKey);
   
    SimpleTrade test = new SimpleTrade(security, BigDecimal.ONE, COUNTERPARTY, TRADE_OFFSET_DATETIME.toLocalDate(), TRADE_OFFSET_DATETIME.toOffsetTime());
    assertNull(test.getUniqueId());
View Full Code Here


  private final SecuritySource _securitySource;

  @SuppressWarnings({"unchecked", "rawtypes" })
  public SimpleSecurityResolverTest() {
    _securityExternalId = ExternalId.of("Scheme1", "Value1");
    ExternalIdBundle externalIdBundle = ExternalIdBundle.of(_securityExternalId, ExternalId.of("Scheme2", "Value2"));
    _intersectingExternalIdBundle = ExternalIdBundle.of(_securityExternalId, ExternalId.of("Scheme3", "Value3"));

    _objectId = ObjectId.of("Sec", "a");

    _securityV1 = new SimpleSecurity(_objectId.atVersion("1"), externalIdBundle, "Type", "Security V1");
View Full Code Here

    assertTrue(provider.getAllValueKeys().isEmpty());
    provider.addValue(new ValueRequirement("Foo", ComputationTargetSpecification.NULL), "FooValue");
    assertEquals(provider.getAllValueKeys().size(), 1);
    provider.addValue(new ValueRequirement("Bar", ComputationTargetSpecification.NULL), "BarValue");
    assertEquals(provider.getAllValueKeys().size(), 2);
    final ExternalIdBundle identifiers = ExternalIdBundle.of(ExternalId.of("A", "1"), ExternalId.of("B", "1"));
    provider.addValue(new ValueRequirement("Foo", ComputationTargetRequirement.of(identifiers)), "FooValue");
    provider.addValue(new ValueRequirement("Bar", ComputationTargetRequirement.of(identifiers)), "BarValue");
    assertEquals(provider.getAllValueKeys().size(), 4);
    provider.removeValue(new ValueRequirement("Foo", ComputationTargetSpecification.NULL));
    assertEquals(provider.getAllValueKeys().size(), 3);
View Full Code Here

    assertNotNull(fooNull);
    provider.addValue(new ValueRequirement("Bar", ComputationTargetSpecification.NULL), "BarValue1");
    final ValueSpecification barNull = provider.getAvailabilityProvider(MarketData.live()).getAvailability(ComputationTargetSpecification.NULL, null,
        new ValueRequirement("Bar", ComputationTargetSpecification.NULL));
    assertNotNull(barNull);
    final ExternalIdBundle identifiers = ExternalIdBundle.of(ExternalId.of("A", "1"), ExternalId.of("B", "1"));
    provider.addValue(new ValueRequirement("Foo", ComputationTargetRequirement.of(identifiers)), "FooValue2");
    final ValueSpecification foo = provider.getAvailabilityProvider(MarketData.live()).getAvailability(ComputationTargetSpecification.of(UniqueId.of("X", "1")), identifiers,
        new ValueRequirement("Foo", ComputationTargetRequirement.of(identifiers)));
    assertNotNull(foo);
    assertEquals(provider.getAllValueKeys(), ImmutableSet.of(fooNull, barNull, foo));
View Full Code Here

      @Override
      public Void visitBondFutureSecurity(BondFutureSecurity security) {
        List<BondFutureDeliverable> basketList = security.getBasket();
        for (BondFutureDeliverable deliverable : basketList) {
          ExternalIdBundle identifiers = deliverable.getIdentifiers();
          if (identifiers != null) {
            _underlyings.add(identifiers);
          }
        }
        return null;
View Full Code Here

  protected void parseIdentifiers(final FudgeMsg fieldData, final ManageableSecurity security) {
    parseIdentifiers(fieldData, security, FIELD_FUT_FIRST_TRADE_DT, FIELD_FUT_LAST_TRADE_DT);
  }

  protected void parseIdentifiers(final FudgeMsg fieldData, final ManageableSecurity security, final String firstTradeDateField, final String lastTradeDateField) {
    ExternalIdBundle identifierBundle = BloombergDataUtils.parseIdentifiers(fieldData, firstTradeDateField, lastTradeDateField).toBundle();
    security.setUniqueId(BloombergSecurityProvider.createUniqueId(identifierBundle.getValue(ExternalSchemes.BLOOMBERG_BUID)));
    security.setExternalIdBundle(identifierBundle);
  }
View Full Code Here

public class InterpolatedYieldCurveSpecificationWithSecuritiesFudgeEncodingTest extends FinancialTestBase {

  @Test
  public void testCycle() {
    ExternalId dummyId = ExternalSchemes.bloombergTickerSecurityId("USDRC Curncy");
    ExternalIdBundle bundle = ExternalIdBundle.of(dummyId);
    final ZonedDateTime start = DateUtils.getUTCDate(2011, 9, 30);
    final ZonedDateTime maturity = DateUtils.getUTCDate(2011, 10, 1);
    final DayCount dayCount = DayCountFactory.INSTANCE.getDayCount("Actual/365");
    final CashSecurity cash = new CashSecurity(Currency.USD, ExternalSchemes.financialRegionId("US"), start, maturity, dayCount, 0.05, 1);
    cash.setUniqueId(UniqueId.of("TEST", "TEST"));
View Full Code Here

      throw new OpenGammaRuntimeException("Error obtaining normalization factor for security " + buid, ex);
    }
  }

  private Integer getNormalizationFactorCore(String buid) {
    ExternalIdBundle buidBundle = ExternalIdBundle.of(_bbgScheme, buid);
    SecurityType securityType = _securityTypeResolver.getSecurityType(Collections.singleton(buidBundle)).get(buidBundle);
    if (securityType == null) {
      s_logger.warn("Unable to determine security type for BUID " + buid);
      return null;
    }
View Full Code Here

     */
    private static void extractFieldData(
        Element securityElem, String field, Map<String, ExternalIdBundle> reverseBundleMap, Map<ExternalIdBundle, LocalDateDoubleTimeSeriesBuilder> result) {

      String secDes = securityElem.getElementAsString(BloombergConstants.SECURITY);
      ExternalIdBundle identifiers = reverseBundleMap.get(secDes);
      if (identifiers == null) {
        String message = "Found time series data for unrecognized security" + secDes + " " + reverseBundleMap;
        throw new OpenGammaRuntimeException(message);
      }
      LocalDateDoubleTimeSeriesBuilder bld = result.get(identifiers);
View Full Code Here

  private static SnapshotDataBundle buildMarketDataMap(final FunctionExecutionContext context, final FunctionInputs inputs) {
    final SnapshotDataBundle marketData = new SnapshotDataBundle();
    final ExternalIdBundleResolver resolver = new ExternalIdBundleResolver(context.getComputationTargetResolver());
    for (final ComputedValue value : inputs.getAllValues()) {
      final ExternalIdBundle identifiers = value.getSpecification().getTargetSpecification().accept(resolver);
      double rate = (Double) value.getValue();
      //TODO this is here because KWCDC Curncy is not normalized
      if (rate > 1.1) {
        s_logger.error("Normalizing {}, value {}", value.getSpecification(), rate);
        s_logger.warn("Performing normalization of rate in YieldCurveMarketDataFunction; if this is being used for anything other than KWCDC Curncy check market data normalization");
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.