Package com.opengamma.id

Examples of com.opengamma.id.ExternalIdBundle


    final ManageablePosition position = test.getPosition();
    assertNotNull(position);
    assertEquals(uniqueId, position.getUniqueId());
    assertEquals(ExternalId.of("A", "222"), position.getProviderId());
    assertEquals(BigDecimal.valueOf(222.987), position.getQuantity());
    final ExternalIdBundle secKey = position.getSecurityLink().getExternalId();
    assertEquals(1, secKey.size());
    assertEquals(ExternalId.of("TICKER", "IBMC"), secKey.getExternalIds().iterator().next());
    assertEquals(ObjectId.of("DbSec", "1234"), position.getSecurityLink().getObjectId());

    final List<ManageableTrade> trades = position.getTrades();
    assertEquals(1, trades.size());
    final ManageableTrade expected = new ManageableTrade(BigDecimal.valueOf(222.987), secKey, _now.toLocalDate(), _now.toOffsetTime().minusSeconds(408), ExternalId.of("CPARTY", "C222"));
View Full Code Here


  public BondFutureDeliverable buildObject(FudgeDeserializer deserializer, FudgeMsg msg) {
    return fromFudgeMsg(deserializer, msg);
  }

  public static BondFutureDeliverable fromFudgeMsg(FudgeDeserializer deserializer, FudgeMsg msg) {
    ExternalIdBundle bundle = ExternalIdBundleFudgeBuilder.fromFudgeMsg(deserializer, msg.getMessage(IDENTIFIERS_FIELD_NAME));
    double conversionFactor = msg.getDouble(CONVERSION_FACTOR_FIELD_NAME);
    return new BondFutureDeliverable(bundle, conversionFactor);
  }
View Full Code Here

  protected ObjectId setupTestData(Instant now) {
    Clock origClock = _usrMaster.getClock();
    try {
      _usrMaster.setClock(Clock.fixed(now, ZoneOffset.UTC));

      final ExternalIdBundle bundle = ExternalIdBundle.of("B", "B0");
      ManageableOGUser user = new ManageableOGUser("initial");
      user.setExternalIdBundle(bundle);
      UserDocument initialDoc = new UserDocument(user);

      _usrMaster.add(initialDoc);
View Full Code Here

    assertEquals(null, test.getCorrectionToInstant());
    ManageablePosition position = test.getPosition();
    assertNotNull(position);
    assertEquals(uniqueId, position.getUniqueId());
    assertEquals(BigDecimal.valueOf(122.987), position.getQuantity());
    ExternalIdBundle secKey = position.getSecurityLink().getExternalId();
    assertEquals(1, secKey.size());
    assertEquals(ExternalId.of("TICKER", "ORCL"), secKey.getExternalIds().iterator().next());
  }
View Full Code Here

  @Test
  public void test_getTradePosition_versioned_404() {
    final UniqueId uniqueId = UniqueId.of("DbPos", "404", "0");
    final ManageableTrade test = _posMaster.getTrade(uniqueId);

    final ExternalIdBundle secKey = ExternalIdBundle.of(ExternalId.of("NASDAQ", "ORCL135"), ExternalId.of("TICKER", "ORCL134"));
    final ManageableTrade expected = new ManageableTrade(BigDecimal.valueOf(100.987), secKey, _now.toLocalDate(), _now.toOffsetTime().minusSeconds(404), ExternalId.of("CPARTY", "C104"));
    expected.setUniqueId(uniqueId);
    expected.setProviderId(ExternalId.of("B", "404"));
    expected.setParentPositionId(UniqueId.of("DbPos", "123", "0"));
    assertEquals(expected, test);
View Full Code Here

  @Test
  public void test_getTradePosition_versioned_405() {
    final UniqueId uniqueId = UniqueId.of("DbPos", "405", "0");
    final ManageableTrade test = _posMaster.getTrade(uniqueId);

    final ExternalIdBundle secKey = ExternalIdBundle.of(ExternalId.of("NASDAQ", "ORCL135"), ExternalId.of("TICKER", "ORCL134"));
    final ManageableTrade expected = new ManageableTrade(BigDecimal.valueOf(200.987), secKey, _now.toLocalDate(), _now.toOffsetTime().minusSeconds(405), ExternalId.of("CPARTY", "C105"));
    expected.setUniqueId(uniqueId);
    expected.setProviderId(ExternalId.of("B", "405"));
    expected.setParentPositionId(UniqueId.of("DbPos", "123", "0"));
    assertEquals(expected, test);
View Full Code Here

  @Test
  public void test_getTradePosition_versioned_notLatest() {
    final UniqueId uniqueId = UniqueId.of("DbPos", "407", "0");
    final ManageableTrade test = _posMaster.getTrade(uniqueId);

    final ExternalIdBundle secKey = ExternalIdBundle.of("TICKER", "IBMC");
    final ManageableTrade expected = new ManageableTrade(BigDecimal.valueOf(221.987), secKey, _now.toLocalDate(), _now.toOffsetTime().minusSeconds(407), ExternalId.of("CPARTY", "C221"));
    expected.setUniqueId(uniqueId);
    expected.setProviderId(ExternalId.of("B", "407"));
    expected.setParentPositionId(UniqueId.of("DbPos", "221", "0"));
    assertEquals(expected, test);
View Full Code Here

  @Test
  public void test_getTradePosition_versioned_latest() {
    final UniqueId uniqueId = UniqueId.of("DbPos", "407", "1");
    final ManageableTrade test = _posMaster.getTrade(uniqueId);

    final ExternalIdBundle secKey = ExternalIdBundle.of("TICKER", "IBMC");
    final ManageableTrade expected = new ManageableTrade(BigDecimal.valueOf(222.987), secKey, _now.toLocalDate(), _now.toOffsetTime().minusSeconds(408), ExternalId.of("CPARTY", "C222"));
    expected.setUniqueId(uniqueId);
    expected.setProviderId(ExternalId.of("B", "408"));
    expected.setParentPositionId(UniqueId.of("DbPos", "221", "1"));
    assertEquals(expected, test);
View Full Code Here

  @Test
  public void test_getTradePosition_unversioned() {
    final UniqueId oid = UniqueId.of("DbPos", "407");
    final ManageableTrade test = _posMaster.getTrade(oid);

    final ExternalIdBundle secKey = ExternalIdBundle.of("TICKER", "IBMC");
    final ManageableTrade expected = new ManageableTrade(BigDecimal.valueOf(222.987), secKey, _now.toLocalDate(), _now.toOffsetTime().minusSeconds(408), ExternalId.of("CPARTY", "C222"));
    expected.setUniqueId(UniqueId.of("DbPos", "407", "1"));
    expected.setProviderId(ExternalId.of("B", "408"));
    expected.setParentPositionId(UniqueId.of("DbPos", "221", "1"));
    assertEquals(expected, test);
View Full Code Here

    }
  }

  protected List<String> getIdentifiers(final ComputationTarget target) {
    if (target.getValue() instanceof Security) {
      final ExternalIdBundle identifiers = ((Security) target.getValue()).getExternalIdBundle();
      final List<String> result = new ArrayList<String>(identifiers.size() + 1);
      result.add(getUniqueId(target));
      for (ExternalId identifier : identifiers) {
        result.add(identifier.toString());
      }
      return result;
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.