@Override public void collectCurrencies(ImmutableSet.Builder<Currency> builder) { builder.add(currency); for (RatePaymentPeriod paymentPeriod : paymentPeriods) { builder.add(paymentPeriod.getCurrency()); paymentPeriod.getFxReset().ifPresent(fxr -> builder.add(fxr.getReferenceCurrency())); } paymentEvents.forEach(ev -> builder.add(ev.getCurrency())); }
CashFlows cashFlowEventsInternal(ResolvedSwapLeg leg, RatesProvider provider) { ImmutableList.Builder<CashFlow> builder = ImmutableList.builder(); for (SwapPaymentEvent event : leg.getPaymentEvents()) { if (!event.getPaymentDate().isBefore(provider.getValuationDate())) { double forecastValue = paymentEventPricer.forecastValue(event, provider); if (forecastValue != 0d) { Currency currency = event.getCurrency(); LocalDate paymentDate = event.getPaymentDate(); double discountFactor = provider.discountFactor(currency, paymentDate); CashFlow singleCashFlow = CashFlow.ofForecastValue(paymentDate, currency, forecastValue, discountFactor); builder.add(singleCashFlow); } } } return CashFlows.of(builder.build()); }