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);