static InstrumentDerivative getDerivative(
     final FinancialSecurity security,
     final ZonedDateTime now,
     final HistoricalTimeSeriesBundle timeSeries,
     final String[] curveNames,
     final InstrumentDefinition<?> definition,
     final FixedIncomeConverterDataProvider definitionConverter) {
   final InstrumentDerivative derivative;
   if (security instanceof SwapSecurity) {
     final SwapSecurity swapSecurity = (SwapSecurity) security;
     final InterestRateInstrumentType type = SwapSecurityUtils.getSwapType(swapSecurity);
     if (type == InterestRateInstrumentType.SWAP_FIXED_IBOR
         || type == InterestRateInstrumentType.SWAP_FIXED_IBOR_WITH_SPREAD
         || type == InterestRateInstrumentType.SWAP_FIXED_OIS) {
       final Frequency resetFrequency;
       if (swapSecurity.getPayLeg() instanceof FloatingInterestRateLeg) {
         resetFrequency = ((FloatingInterestRateLeg) swapSecurity.getPayLeg()).getFrequency();
       } else {
         resetFrequency = ((FloatingInterestRateLeg) swapSecurity.getReceiveLeg()).getFrequency();
       }
       derivative =
           definitionConverter.convert(
               security,
               definition,
               now,
               FixedIncomeInstrumentCurveExposureHelper.getCurveNamesForSecurity(
                   security, curveNames, resetFrequency),
               timeSeries);
     } else {
       derivative =
           definitionConverter.convert(
               security,
               definition,
               now,
               FixedIncomeInstrumentCurveExposureHelper.getCurveNamesForSecurity(
                   security, curveNames),
               timeSeries);
     }
   } else {
     derivative =
         definitionConverter.convert(
             security,
             definition,
             now,
             FixedIncomeInstrumentCurveExposureHelper.getCurveNamesForSecurity(
                 security, curveNames),
             timeSeries);
   }
   return derivative;
 }
 @Override
 public boolean canApplyTo(
     final FunctionCompilationContext context, final ComputationTarget target) {
   final Security security = target.getSecurity();
   if (security instanceof SwapSecurity) {
     if (!InterestRateInstrumentType.isFixedIncomeInstrumentType((SwapSecurity) security)) {
       return false;
     }
     final InterestRateInstrumentType type =
         SwapSecurityUtils.getSwapType((SwapSecurity) security);
     if ((type != InterestRateInstrumentType.SWAP_FIXED_CMS)
         && (type != InterestRateInstrumentType.SWAP_CMS_CMS)
         && (type != InterestRateInstrumentType.SWAP_IBOR_CMS)) {
       return false;
     }
   }
   return true;
 }