}
private Double getSwapRate(final Currency ccy, final LocalDate tradeDate, final Tenor maturity) {
final HistoricalTimeSeriesSource historicalSource = getToolContext().getHistoricalTimeSeriesSource();
final MasterConfigSource configSource = new MasterConfigSource(getToolContext().getConfigMaster());
final ExternalId swapRateForMaturityIdentifier = getSwapRateFor(configSource, ccy, tradeDate, maturity);
if (swapRateForMaturityIdentifier == null) {
throw new OpenGammaRuntimeException("Couldn't get swap rate identifier for " + ccy + " [" + maturity + "]" + " from " + tradeDate);
}
final HistoricalTimeSeries fixedRateSeries = historicalSource.getHistoricalTimeSeries("PX_LAST",
swapRateForMaturityIdentifier.toBundle(), HistoricalTimeSeriesRatingFieldNames.DEFAULT_CONFIG_NAME, tradeDate.minusDays(30), true, tradeDate, true);
if (fixedRateSeries == null) {
throw new OpenGammaRuntimeException("Time series for " + swapRateForMaturityIdentifier + " was null");
}
if (fixedRateSeries.getTimeSeries().isEmpty()) {
throw new OpenGammaRuntimeException("Time series for " + swapRateForMaturityIdentifier + " was empty");