return null;
}
// look up the rate timeseries identifier out of the bundle
final ExternalId tsIdentifier = getTimeSeriesIdentifier(liborConvention);
// look up the value on our chosen trade date
final HistoricalTimeSeries initialRateSeries = getHistoricalSource().getHistoricalTimeSeries(MarketDataRequirementNames.MARKET_VALUE, tsIdentifier.toBundle(), null, tradeDate.toLocalDate(),
true, tradeDate.toLocalDate(), true);
if (initialRateSeries == null || initialRateSeries.getTimeSeries().isEmpty()) {
s_logger.error("couldn't get series for {} on {}", tsIdentifier, tradeDate);
return null;
}
Double initialRate = initialRateSeries.getTimeSeries().getEarliestValue();
// get the identifier for the swap rate for the maturity we're interested in (assuming the fixed rate will be =~ swap rate)
final ExternalId swapRateForMaturityIdentifier = getSwapRateFor(ccy, tradeDate.toLocalDate(), maturity, forward);
if (swapRateForMaturityIdentifier == null) {
s_logger.error("Couldn't get swap rate identifier for {} [{}] from {}", new Object[] {ccy, maturity, tradeDate });
return null;
}
final HistoricalTimeSeries fixedRateSeries = getHistoricalSource().getHistoricalTimeSeries(MarketDataRequirementNames.MARKET_VALUE, swapRateForMaturityIdentifier.toBundle(),
null, tradeDate.toLocalDate(), true,
tradeDate.toLocalDate(), true);
if (fixedRateSeries == null) {
s_logger.error("can't find time series for {} on {}", swapRateForMaturityIdentifier, tradeDate);
return null;
}
Double fixedRate = (fixedRateSeries.getTimeSeries().getEarliestValue() + getRandom().nextDouble()) / 100d;
Double notional = (double) getRandom(100000) * 1000;
ZonedDateTime maturityDate = forwardDate.plus(maturity.getPeriod());
String counterparty = "CParty";
SwapLeg fixedLeg = new FixedInterestRateLeg(swapConvention.getSwapFixedLegDayCount(),
swapConvention.getSwapFixedLegFrequency(),