final double notional = 1000000 * (1 + random.nextInt(50));
final ExternalId underlyingId = TICKERS.get(tenor);
if (underlyingId == null) {
throw new OpenGammaRuntimeException("Could not get swap rate ticker for " + tenor);
}
final CapFloorSecurity security = new CapFloorSecurity(TRADE_DATE.atStartOfDay(ZoneOffset.UTC), maturityDate, notional, underlyingId, strike, PeriodFrequency.SEMI_ANNUAL,
Currency.USD, ACT_360, payer, cap, false);
security.setName("USD " + FORMAT.format(notional / 1000000) + (cap ? "MM cap " : "MM floor ") + "@ " + FORMAT.format(strike) +
(payer ? "%, pay " : "%, receive ") + tenor.getPeriod().normalized().getYears() + "Y ISDA fixing" +
" (" + TRADE_DATE.toString() + " - " + maturityDate.toLocalDate().toString() + ")");
security.addExternalId(ExternalId.of(ID_SCHEME, GUIDGenerator.generate().toString()));
return security;
}