Package com.opengamma.master.position

Examples of com.opengamma.master.position.ManageableTrade$Meta


    assertEquals(true, secKey.getExternalIds().contains(ExternalId.of("TICKER", "T130")));
    assertEquals(null, position.getSecurityLink().getObjectId());

    final List<ManageableTrade> trades = position.getTrades();
    assertEquals(1, trades.size());
    final ManageableTrade trade = trades.get(0);
    assertNotNull(trade);
    assertEquals(UniqueId.of("DbPos", "400", "0"), trade.getUniqueId());
    assertEquals(ExternalId.of("B", "400"), trade.getProviderId());
    assertEquals(ExternalId.of("CPARTY", "C100"), trade.getCounterpartyExternalId());
    assertEquals(BigDecimal.valueOf(120.987), trade.getQuantity());
    assertEquals(_now.toLocalDate(), trade.getTradeDate());
    assertEquals(_now.toOffsetTime().minusSeconds(400), trade.getTradeTime());
    assertEquals(true, trade.getSecurityLink().getExternalIds().contains(ExternalId.of("TICKER", "T130")));
  }
View Full Code Here


    assertEquals(true, secKey.getExternalIds().contains(ExternalId.of("NASDAQ", "Micro")));
    assertEquals(null, position.getSecurityLink().getObjectId());

    final List<ManageableTrade> trades = position.getTrades();
    assertEquals(1, trades.size());
    final ManageableTrade trade = trades.get(0);
    assertNotNull(trade);
    assertEquals(UniqueId.of("DbPos", "401", "0"), trade.getUniqueId());
    assertEquals(ExternalId.of("B", "401"), trade.getProviderId());
    assertEquals(ExternalId.of("CPARTY", "C101"), trade.getCounterpartyExternalId());
    assertEquals(BigDecimal.valueOf(121.987), trade.getQuantity());
    assertEquals(_now.toLocalDate(), trade.getTradeDate());
    assertEquals(_now.toOffsetTime().minusSeconds(401), trade.getTradeTime());
  }
View Full Code Here

    assertEquals(null, position.getSecurityLink().getObjectId());

    final List<ManageableTrade> trades = position.getTrades();
    assertEquals(3, trades.size());

    ManageableTrade trade = new ManageableTrade(BigDecimal.valueOf(100.987), secKey, _now.toLocalDate(), _now.toOffsetTime().minusSeconds(404), ExternalId.of("CPARTY", "C104"));
    trade.setUniqueId(UniqueId.of("DbPos", "404", "0"));
    trade.setProviderId(ExternalId.of("B", "404"));
    trade.setParentPositionId(uniqueId);
    assertTrue(trades.contains(trade));

    trade = new ManageableTrade(BigDecimal.valueOf(200.987), secKey, _now.toLocalDate(), _now.toOffsetTime().minusSeconds(405), ExternalId.of("CPARTY", "C105"));
    trade.setUniqueId(UniqueId.of("DbPos", "405", "0"));
    trade.setProviderId(ExternalId.of("B", "405"));
    trade.setParentPositionId(uniqueId);
    assertTrue(trades.contains(trade));

    trade = new ManageableTrade(BigDecimal.valueOf(300.987), secKey, _now.toLocalDate(), _now.toOffsetTime().minusSeconds(406),ExternalId.of("CPARTY", "C106"));
    trade.setUniqueId(UniqueId.of("DbPos", "406", "0"));
    trade.setProviderId(ExternalId.of("B", "406"));
    trade.setParentPositionId(uniqueId);
    assertTrue(trades.contains(trade));
  }
View Full Code Here

    assertEquals(ExternalId.of("TICKER", "IBMC"), secKey.getExternalIds().iterator().next());
    assertEquals(null, position.getSecurityLink().getObjectId());

    final List<ManageableTrade> trades = position.getTrades();
    assertEquals(1, trades.size());
    final ManageableTrade expected = new ManageableTrade(BigDecimal.valueOf(221.987), secKey, _now.toLocalDate(), _now.toOffsetTime().minusSeconds(407), ExternalId.of("CPARTY", "C221"));
    expected.setUniqueId(UniqueId.of("DbPos", "407", "0"));
    expected.setProviderId(ExternalId.of("B", "407"));
    expected.setParentPositionId(uniqueId);
    assertTrue(trades.contains(expected));
  }
View Full Code Here

    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"));
    expected.setUniqueId(UniqueId.of("DbPos", "407", "1"));
    expected.setProviderId(ExternalId.of("B", "408"));
    expected.setParentPositionId(uniqueId);
    assertTrue(trades.contains(expected));
  }
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

      return bundle;
    }
  }

  private ManageableTrade createTrade(final ManageableSecurity security) {
    final ManageableTrade trade = new ManageableTrade(BigDecimal.ONE, getBundle(security), LocalDate.now(), OffsetTime.now(), ExternalId.of(
        "counterparty", "Foo"));
    if (BondFutureOptionSecurity.SECURITY_TYPE.equals(security.getSecurityType())) {
      trade.setPremium(-100d);
    } else if (IRFutureOptionSecurity.SECURITY_TYPE.equals(security.getSecurityType())) {
      trade.setPremium(100d);
    }
    return trade;
  }
View Full Code Here

TOP

Related Classes of com.opengamma.master.position.ManageableTrade$Meta

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.