return manageablePosition;
}
private ManageableTrade convertTrade(Trade trade, Security security) {
ManageableTrade manageableTrade = new ManageableTrade(trade.getQuantity(),
security.getExternalIdBundle(),
trade.getTradeDate(),
null,
trade.getCounterparty().toExternalId());
ExternalId externalId = trade.getExternalSystemId().toExternalId();
_xmlExternalIdValidator.validateExternalId(externalId, trade.getId());
manageableTrade.setProviderId(externalId);
for (AdditionalCashflow cashflow : nullCheckIterable(trade.getAdditionalCashflows())) {
if (cashflow.getCashflowType() == AdditionalCashflow.CashflowType.PREMIUM) {
MonetaryAmount monetaryAmount = cashflow.getMonetaryAmount();
manageableTrade.setPremium(monetaryAmount.getAmount().doubleValue());
manageableTrade.setPremiumCurrency(monetaryAmount.getCurrency());
manageableTrade.setPremiumDate(cashflow.getCashflowDate());
}
}
manageableTrade.setAttributes(trade.getAdditionalAttributes());
return manageableTrade;
}