Package com.opengamma.core.position.impl

Examples of com.opengamma.core.position.impl.SimplePosition


  // -------------------------------------------------------------------------
  private static void readPositions(FudgeDeserializer deserializer, FudgeMsg message, SimplePortfolioNode node) {
    if (message != null) {
      for (FudgeField field : message) {
        if (field.getValue() instanceof FudgeMsg) {
          final SimplePosition position = PositionFudgeBuilder.buildObjectImpl(deserializer, (FudgeMsg) field.getValue());
          node.addPosition(position);
        }
      }
    }
  }
View Full Code Here


  }

  @Test
  public void testPositionWithUnlocatableSecurityIsIgnored() {

    Position posn = new SimplePosition(BigDecimal.ONE, ExternalId.of("SEC_ID", "9999"));
    assertEquals(_aggregator.classifyPosition(posn), "N/A");
  }
View Full Code Here

    ExternalId secId = ExternalId.of("SEC_ID", "12345");
    security.addExternalId(secId);
    document.setSecurity(security);
    _securityMaster.add(document);

    Position posn = new SimplePosition(BigDecimal.ONE, secId);
    assertEquals(_aggregator.classifyPosition(posn), "N/A");
  }
View Full Code Here

    ExternalId secId = ExternalId.of("SEC_ID", "12345");
    cds.addExternalId(secId);
    document.setSecurity(cds);
    _securityMaster.add(document);

    Position posn = new SimplePosition(BigDecimal.ONE, secId);

    assertEquals(_aggregator.classifyPosition(posn), "FINANCIALS");
  }
View Full Code Here

  }

  @Test
  public void testPositionWithUnlocatableSecurityIsIgnored() {

    Position posn = new SimplePosition(BigDecimal.ONE, ExternalId.of("SEC_ID", "9999"));
    assertEquals(_aggregator.classifyPosition(posn), "N/A");
  }
View Full Code Here

    ExternalId secId = ExternalId.of("SEC_ID", "12345");
    security.addExternalId(secId);
    document.setSecurity(security);
    _securityMaster.add(document);

    Position posn = new SimplePosition(BigDecimal.ONE, secId);
    assertEquals(_aggregator.classifyPosition(posn), "N/A");
  }
View Full Code Here

    ExternalId secId = ExternalId.of("SEC_ID", "12345");
    cds.addExternalId(secId);
    document.setSecurity(cds);
    _securityMaster.add(document);

    Position posn = new SimplePosition(BigDecimal.ONE, secId);

    assertEquals(_aggregator.classifyPosition(posn), "SNRFOR");
  }
View Full Code Here

    }
    return trade;
  }

  protected Position createPosition(final String uid, final int quantity, final Security security, final String attr1Value, final String attr2Value, final Trade trade1, final Trade trade2) {
    final SimplePosition position = new SimplePosition(new BigDecimal(quantity), security.getExternalIdBundle());
    position.setSecurityLink(SimpleSecurityLink.of(security));
    if (attr1Value != null) {
      position.addAttribute("Attr1", attr1Value);
    }
    if (attr2Value != null) {
      position.addAttribute("Attr2", attr2Value);
    }
    if (trade1 != null) {
      position.addTrade(trade1);
    }
    if (trade2 != null) {
      position.addTrade(trade2);
    }
    position.setUniqueId(UniqueId.of("Position", uid));
    return position;
  }
View Full Code Here

    SimplePortfolio portfolio = new SimplePortfolio(id("portfolio"), "portfolio");
    SimplePortfolioNode root = new SimplePortfolioNode(id("root"), "root");
    SimplePortfolioNode node1 = new SimplePortfolioNode(id("node1"), "node1");
    SimplePortfolioNode node2 = new SimplePortfolioNode(id("node2"), "node2");
    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

  }

  @Test
  public void testPositionWithUnlocatableSecurityIsIgnored() {

    Position posn = new SimplePosition(BigDecimal.ONE, ExternalId.of("SEC_ID", "9999"));
    assertEquals(_aggregator.classifyPosition(posn), "N/A");
  }
View Full Code Here

TOP

Related Classes of com.opengamma.core.position.impl.SimplePosition

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.