Package com.opengamma.core.position.impl

Examples of com.opengamma.core.position.impl.SimplePosition.addTrade()


    ExternalId securityId = ExternalId.of("sec", "123");
    SimplePosition position = new SimplePosition(id("position"), BigDecimal.ONE, securityId);
    SimpleCounterparty counterparty = new SimpleCounterparty(ExternalId.of("cpty", "123"));
    SimpleSecurityLink securityLink = new SimpleSecurityLink(securityId);
    Trade trade = new SimpleTrade(securityLink, BigDecimal.ONE, counterparty, LocalDate.now(), OffsetTime.now());
    position.addTrade(trade);
    portfolio.setRootNode(root);
    node1.addPosition(position);
    node2.addPosition(position);
    root.addChildNode(node1);
    root.addChildNode(node2);
View Full Code Here


    SimplePortfolioNode node = new SimplePortfolioNode("TradeAttr");
    SimpleTrade trade = createTrade(securities);
    trade.addAttribute("Present Value.DEFAULT_ForwardCurve", "FooForward");
    trade.addAttribute("*.DEFAULT_FundingCurve", "FooFunding");
    SimplePosition position = createPosition(securities);
    position.addTrade(trade);
    node.addPosition(position);
    root.addChildNode(node);
    // Portfolio node with position with a trade without an attribute
    node = new SimplePortfolioNode("Trade");
    trade = createTrade(securities);
View Full Code Here

    root.addChildNode(node);
    // Portfolio node with position with a trade without an attribute
    node = new SimplePortfolioNode("Trade");
    trade = createTrade(securities);
    position = createPosition(securities);
    position.addTrade(trade);
    node.addPosition(position);
    root.addChildNode(node);
    // Portfolio node with position with an attribute
    node = new SimplePortfolioNode("PositionAttr");
    position = createPosition(securities);
View Full Code Here

  @Test
  public void tradeAttribute() {
    SimplePosition position = new SimplePosition();
    SimpleTrade trade = new SimpleTrade();
    trade.addAttribute(ATTR_NAME, TRADE_VALUE);
    position.addTrade(trade);
    assertEquals(TRADE_VALUE, _aggFn.classifyPosition(position));
  }

  /**
   * Tests the position's value is used when both the position and one of its trades have values for the same attribute.
View Full Code Here

  public void positionAndTradeAttributes() {
    SimplePosition position = new SimplePosition();
    position.addAttribute(ATTR_NAME, POS_VALUE);
    SimpleTrade trade = new SimpleTrade();
    trade.addAttribute(ATTR_NAME, TRADE_VALUE);
    position.addTrade(trade);
    assertEquals(POS_VALUE, _aggFn.classifyPosition(position));
  }
}
View Full Code Here

    return trade;
  }

  private static SimplePosition samplePosition(final AtomicInteger attribSource) {
    final SimplePosition position = new SimplePosition();
    position.addTrade(sampleTrade(attribSource));
    return position;
  }

  private static SimplePortfolioNode samplePortfolioNode(final AtomicInteger attribSource, final int depth) {
    final SimplePortfolioNode node = new SimplePortfolioNode();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.