ManageableSecurity savedUnderlying = getSecurityMaster().add(new SecurityDocument(underlying)).getSecurity();
security = buildSecurity(securityData, savedUnderlying);
}
ManageableSecurity savedSecurity = getSecurityMaster().add(new SecurityDocument(security)).getSecurity();
ManageableTrade trade = buildTrade(tradeData);
trade.setSecurityLink(new ManageableSecurityLink(savedSecurity.getUniqueId()));
ManageablePosition position = new ManageablePosition();
position.setQuantity(BigDecimal.ONE);
position.setSecurityLink(new ManageableSecurityLink(trade.getSecurityLink()));
position.setTrades(Lists.newArrayList(trade));
ManageablePosition savedPosition = getPositionMaster().add(new PositionDocument(position)).getPosition();
ManageableTrade savedTrade = savedPosition.getTrades().get(0);
PortfolioSearchRequest searchRequest = new PortfolioSearchRequest();