Пример #1
0
 public static String[] getCurveNamesForSecurity(
     final FinancialSecurity security, final String[] curveNames, final Frequency resetFrequency) {
   final InterestRateInstrumentType type =
       InterestRateInstrumentType.getInstrumentTypeFromSecurity(security);
   final String fundingCurveName = curveNames[0];
   final String forward1CurveName = curveNames.length > 1 ? curveNames[1] : fundingCurveName;
   final String forward2CurveName = curveNames.length == 3 ? curveNames[2] : forward1CurveName;
   switch (type) {
     case SWAP_FIXED_IBOR:
       if (resetFrequency.getConventionName().equals(Frequency.QUARTERLY_NAME)) {
         return new String[] {fundingCurveName, forward1CurveName};
       } else if (resetFrequency.getConventionName().equals(Frequency.SEMI_ANNUAL_NAME)) {
         return new String[] {fundingCurveName, forward2CurveName};
       }
       return new String[] {fundingCurveName, forward1CurveName};
     case SWAP_FIXED_IBOR_WITH_SPREAD:
       return new String[] {fundingCurveName, forward1CurveName};
     case SWAP_IBOR_IBOR:
       return new String[] {fundingCurveName, forward1CurveName, forward2CurveName};
     case CASH:
       return new String[] {fundingCurveName};
     case FRA:
       return new String[] {fundingCurveName, forward1CurveName};
     case IR_FUTURE:
       return new String[] {fundingCurveName, forward1CurveName};
     case COUPON_BOND:
       return new String[] {fundingCurveName, fundingCurveName};
     case SWAP_FIXED_CMS:
       return new String[] {fundingCurveName, forward1CurveName};
     case SWAP_IBOR_CMS:
       return new String[] {fundingCurveName, forward1CurveName};
     case SWAP_CMS_CMS:
       return new String[] {fundingCurveName, forward1CurveName};
     case BOND_FUTURE:
       return new String[] {fundingCurveName, fundingCurveName};
     case SWAP_FIXED_OIS:
       return new String[] {fundingCurveName, fundingCurveName};
     default:
       throw new OpenGammaRuntimeException(
           "Could not find " + type + " in security instrument list");
   }
 }
Пример #2
0
 // TODO This method should be replaced when we have calculation configurations
 public static String[] getCurveNamesForSecurity(
     final FinancialSecurity security,
     final String fundingCurveName,
     final String forwardCurveName) {
   final InterestRateInstrumentType type =
       InterestRateInstrumentType.getInstrumentTypeFromSecurity(security);
   switch (type) {
     case SWAP_FIXED_IBOR:
       return new String[] {fundingCurveName, forwardCurveName};
     case SWAP_FIXED_IBOR_WITH_SPREAD:
       return new String[] {fundingCurveName, forwardCurveName};
     case SWAP_IBOR_IBOR:
       return new String[] {fundingCurveName, forwardCurveName, forwardCurveName};
     case CASH:
       return new String[] {fundingCurveName};
     case FRA:
       return new String[] {fundingCurveName, forwardCurveName};
     case IR_FUTURE:
       return new String[] {fundingCurveName, forwardCurveName};
     case COUPON_BOND:
       return new String[] {fundingCurveName, fundingCurveName};
     case SWAP_FIXED_CMS:
       return new String[] {fundingCurveName, forwardCurveName};
     case SWAP_IBOR_CMS:
       return new String[] {fundingCurveName, forwardCurveName};
     case SWAP_CMS_CMS:
       return new String[] {fundingCurveName, forwardCurveName};
     case BOND_FUTURE:
       return new String[] {fundingCurveName, fundingCurveName};
     case SWAP_FIXED_OIS:
       return new String[] {fundingCurveName, fundingCurveName};
     default:
       throw new OpenGammaRuntimeException(
           "Could not find " + type + " in security instrument list");
   }
 }