super(securityDefinition);
}
@Override
protected ManageableSecurity createSecurity() {
FutureSecurityDefinition defn = getSecurityDefinition();
ExternalId underlyingId = defn.getUnderlyingId().toExternalId();
Expiry expiry = new Expiry(defn.getFutureExpiry().atDay(1).atStartOfDay(ZoneOffset.UTC), ExpiryAccuracy.MONTH_YEAR);
String exchange = defn.getExchange();
Currency currency = defn.getCurrency();
int pointValue = defn.getPointValue();
String settlementExchange = defn.getSettlementExchange();
ZonedDateTime settlementDate = defn.getSettlementDate().atStartOfDay(ZoneOffset.UTC);
switch (defn.getFutureType()) {
case EQUITY_DIVIDEND_FUTURE:
return new EquityIndexDividendFutureSecurity(
expiry,
exchange,
settlementExchange,
currency,
pointValue,
settlementDate,
underlyingId,
defn.getFutureCategory());
case EQUITY_INDEX_FUTURE:
throw new PortfolioParsingException("EquityIndexFuture is not yet supported");
default:
// The xml validation should prevent this from happening
throw new PortfolioParsingException("Unrecognised listed option type: " + defn.getFutureType());
}
}