/**
   * Adds conventions for deposits, implied deposits and cash.
   *
   * @param conventionMaster The convention master, not null
   */
  public static synchronized void addFixedIncomeInstrumentConventions(
      final ConventionBundleMaster conventionMaster) {
    ArgumentChecker.notNull(conventionMaster, "convention master");
    final BusinessDayConvention following = BusinessDayConventions.FOLLOWING;
    final BusinessDayConvention modified = BusinessDayConventions.MODIFIED_FOLLOWING;
    final DayCount act360 = DayCounts.ACT_360;
    final DayCount act365 = DayCounts.ACT_365;
    final Frequency quarterly =
        SimpleFrequencyFactory.INSTANCE.getFrequency(Frequency.QUARTERLY_NAME);
    final ExternalId kr = ExternalSchemes.financialRegionId("KR");

    final ConventionBundleMasterUtils utils = new ConventionBundleMasterUtils(conventionMaster);

    for (int i = 1; i < 3; i++) {
      final String dayDepositName = "KRW DEPOSIT " + i + "d";
      final ExternalId dayBbgDeposit = bloombergTickerSecurityId("KWDR" + i + "T Curncy");
      final ExternalId daySimpleDeposit = simpleNameSecurityId(dayDepositName);
      final String weekDepositName = "KRW DEPOSIT " + i + "w";
      final ExternalId weekBbgDeposit = bloombergTickerSecurityId("KWDR" + i + "Z Curncy");
      final ExternalId weekSimpleDeposit = simpleNameSecurityId(weekDepositName);
      utils.addConventionBundle(
          ExternalIdBundle.of(dayBbgDeposit, daySimpleDeposit),
          dayDepositName,
          act360,
          following,
          Period.ofDays(i),
          0,
          false,
          kr);
      utils.addConventionBundle(
          ExternalIdBundle.of(weekBbgDeposit, weekSimpleDeposit),
          weekDepositName,
          act360,
          following,
          Period.ofDays(i * 7),
          0,
          false,
          kr);
    }

    for (int i = 1; i < 12; i++) {
      final String depositName = "KRW DEPOSIT " + i + "m";
      final ExternalId bbgDeposit =
          bloombergTickerSecurityId("KWDR" + BBG_MONTH_CODES[i - 1] + " Curncy");
      final ExternalId simpleDeposit = simpleNameSecurityId(depositName);
      final String impliedDepositName = "KRW IMPLIED DEPOSIT " + i + "m";
      final ExternalId tullettImpliedDeposit =
          tullettPrebonSecurityId("AMIDPKRWSPT" + (i < 10 ? "0" : "") + i + "M");
      final ExternalId simpleImpliedDeposit = simpleNameSecurityId(impliedDepositName);
      utils.addConventionBundle(
          ExternalIdBundle.of(bbgDeposit, simpleDeposit),
          depositName,
          act360,
          following,
          Period.ofMonths(i),
          0,
          false,
          kr);
      utils.addConventionBundle(
          ExternalIdBundle.of(tullettImpliedDeposit, simpleImpliedDeposit),
          impliedDepositName,
          act360,
          following,
          Period.ofMonths(i),
          0,
          false,
          kr);
    }

    for (int i = 1; i < 5; i++) {
      if (i == 1) {
        final String depositName = "KRW IMPLIED DEPOSIT 1y";
        final ExternalId tullettImpliedDeposit = tullettPrebonSecurityId("AMIDPKRWSPT12M");
        final ExternalId simpleImpliedDeposit = simpleNameSecurityId(depositName);
        utils.addConventionBundle(
            ExternalIdBundle.of(tullettImpliedDeposit, simpleImpliedDeposit),
            depositName,
            act360,
            following,
            Period.ofYears(1),
            0,
            false,
            kr);
      }
      final String depositName = "KRW DEPOSIT " + i + "y";
      final ExternalId bbgDeposit = bloombergTickerSecurityId("KWDR" + i + " Curncy");
      final ExternalId simpleDeposit = simpleNameSecurityId(depositName);
      utils.addConventionBundle(
          ExternalIdBundle.of(bbgDeposit, simpleDeposit),
          depositName,
          act360,
          following,
          Period.ofYears(i),
          0,
          false,
          kr);
    }

    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("KWCDC Curncy"),
            bloombergTickerSecurityId("KWCDC Index"),
            simpleNameSecurityId("KRW SWAP FIXING 3m")),
        "KRW SWAP FIXING 3m",
        act365,
        modified,
        Period.ofMonths(3),
        0,
        false,
        kr);
    utils.addConventionBundle(
        ExternalIdBundle.of(simpleNameSecurityId("KRW_SWAP")),
        "KRW_SWAP",
        act365,
        modified,
        quarterly,
        2,
        kr,
        act365,
        modified,
        quarterly,
        2,
        simpleNameSecurityId("KRW SWAP FIXING 3m"),
        kr,
        true);
  }
Esempio n. 2
0
  public static synchronized void addFixedIncomeInstrumentConventions(
      final ConventionBundleMaster conventionMaster) {
    Validate.notNull(conventionMaster, "convention master");
    final BusinessDayConvention modified =
        BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention("Modified Following");
    final BusinessDayConvention following =
        BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention("Following");
    final DayCount act360 = DayCountFactory.INSTANCE.getDayCount("Actual/360");
    final DayCount act365 = DayCountFactory.INSTANCE.getDayCount("Actual/365");
    final Frequency annual = SimpleFrequencyFactory.INSTANCE.getFrequency(Frequency.ANNUAL_NAME);
    final Frequency semiAnnual =
        SimpleFrequencyFactory.INSTANCE.getFrequency(Frequency.SEMI_ANNUAL_NAME);
    final Frequency quarterly =
        SimpleFrequencyFactory.INSTANCE.getFrequency(Frequency.QUARTERLY_NAME);
    final ExternalId ca = ExternalSchemes.financialRegionId("CA");

    final ConventionBundleMasterUtils utils = new ConventionBundleMasterUtils(conventionMaster);
    // TODO looked at BSYM and the codes seem right but need to check
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CD00O/N Index"), simpleNameSecurityId("CAD LIBOR O/N")),
        "CAD LIBOR O/N",
        act360,
        following,
        Period.ofDays(1),
        0,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CD00S/N Index"), simpleNameSecurityId("CAD LIBOR S/N")),
        "CAD LIBOR S/N",
        act360,
        following,
        Period.ofDays(1),
        0,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CD00T/N Index"), simpleNameSecurityId("CAD LIBOR T/N")),
        "CAD LIBOR T/N",
        act360,
        following,
        Period.ofDays(1),
        0,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CD0001W Index"), simpleNameSecurityId("CAD LIBOR 1w")),
        "CAD LIBOR 1w",
        act360,
        following,
        Period.ofDays(1),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CD0002W Index"), simpleNameSecurityId("CAD LIBOR 2w")),
        "CAD LIBOR 2w",
        act360,
        following,
        Period.ofDays(1),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CD0001M Index"), simpleNameSecurityId("CAD LIBOR 1m")),
        "CAD LIBOR 1m",
        act360,
        following,
        Period.ofMonths(1),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CD0002M Index"), simpleNameSecurityId("CAD LIBOR 2m")),
        "CAD LIBOR 2m",
        act360,
        following,
        Period.ofMonths(2),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CD0003M Index"), simpleNameSecurityId("CAD LIBOR 3m")),
        "CAD LIBOR 3m",
        act360,
        following,
        Period.ofMonths(3),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CD0004M Index"), simpleNameSecurityId("CAD LIBOR 4m")),
        "CAD LIBOR 4m",
        act360,
        following,
        Period.ofMonths(4),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CD0005M Index"), simpleNameSecurityId("CAD LIBOR 5m")),
        "CAD LIBOR 5m",
        act360,
        following,
        Period.ofMonths(5),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CD0006M Index"), simpleNameSecurityId("CAD LIBOR 6m")),
        "CAD LIBOR 6m",
        act360,
        following,
        Period.ofMonths(6),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CD0007M Index"), simpleNameSecurityId("CAD LIBOR 7m")),
        "CAD LIBOR 7m",
        act360,
        following,
        Period.ofMonths(7),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CD0008M Index"), simpleNameSecurityId("CAD LIBOR 8m")),
        "CAD LIBOR 8m",
        act360,
        following,
        Period.ofMonths(8),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CD0009M Index"), simpleNameSecurityId("CAD LIBOR 9m")),
        "CAD LIBOR 9m",
        act360,
        following,
        Period.ofMonths(9),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CD0010M Index"), simpleNameSecurityId("CAD LIBOR 10m")),
        "CAD LIBOR 10m",
        act360,
        following,
        Period.ofMonths(10),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CD0011M Index"), simpleNameSecurityId("CAD LIBOR 11m")),
        "CAD LIBOR 11m",
        act360,
        following,
        Period.ofMonths(11),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CD0012M Index"), simpleNameSecurityId("CAD LIBOR 12m")),
        "CAD LIBOR 12m",
        act360,
        following,
        Period.ofMonths(12),
        2,
        false,
        ca);

    // TODO need to check that these are right for deposit rates
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDDR1T Curncy"), simpleNameSecurityId("CAD DEPOSIT 1d")),
        "CAD DEPOSIT 1d",
        act365,
        following,
        Period.ofDays(1),
        0,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDDR2T Curncy"), simpleNameSecurityId("CAD DEPOSIT 2d")),
        "CAD DEPOSIT 2d",
        act365,
        following,
        Period.ofDays(1),
        0,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDDR3T Curncy"), simpleNameSecurityId("CAD DEPOSIT 3d")),
        "CAD DEPOSIT 3d",
        act365,
        following,
        Period.ofDays(1),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDDR1Z Curncy"), simpleNameSecurityId("CAD DEPOSIT 1w")),
        "CAD DEPOSIT 1w",
        act365,
        following,
        Period.ofDays(7),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDDR2Z Curncy"), simpleNameSecurityId("CAD DEPOSIT 2w")),
        "CAD DEPOSIT 2w",
        act365,
        following,
        Period.ofDays(14),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDDR3Z Curncy"), simpleNameSecurityId("CAD DEPOSIT 3w")),
        "CAD DEPOSIT 3w",
        act365,
        following,
        Period.ofDays(21),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDDRA Curncy"), simpleNameSecurityId("CAD DEPOSIT 1m")),
        "CAD DEPOSIT 1m",
        act365,
        following,
        Period.ofMonths(1),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDDRB Curncy"), simpleNameSecurityId("CAD DEPOSIT 2m")),
        "CAD DEPOSIT 2m",
        act365,
        following,
        Period.ofMonths(2),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDDRC Curncy"), simpleNameSecurityId("CAD DEPOSIT 3m")),
        "CAD DEPOSIT 3m",
        act365,
        following,
        Period.ofMonths(3),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDDRD Curncy"), simpleNameSecurityId("CAD DEPOSIT 4m")),
        "CAD DEPOSIT 4m",
        act365,
        following,
        Period.ofMonths(4),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDDRE Curncy"), simpleNameSecurityId("CAD DEPOSIT 5m")),
        "CAD DEPOSIT 5m",
        act365,
        following,
        Period.ofMonths(5),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDDRF Curncy"), simpleNameSecurityId("CAD DEPOSIT 6m")),
        "CAD DEPOSIT 6m",
        act365,
        following,
        Period.ofMonths(6),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDDRG Curncy"), simpleNameSecurityId("CAD DEPOSIT 7m")),
        "CAD DEPOSIT 7m",
        act365,
        following,
        Period.ofMonths(7),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDDRH Curncy"), simpleNameSecurityId("CAD DEPOSIT 8m")),
        "CAD DEPOSIT 8m",
        act365,
        following,
        Period.ofMonths(8),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDDRI Curncy"), simpleNameSecurityId("CAD DEPOSIT 9m")),
        "CAD DEPOSIT 9m",
        act365,
        following,
        Period.ofMonths(9),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDDRJ Curncy"), simpleNameSecurityId("CAD DEPOSIT 10m")),
        "CAD DEPOSIT 10m",
        act365,
        following,
        Period.ofMonths(10),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDDRK Curncy"), simpleNameSecurityId("CAD DEPOSIT 11m")),
        "CAD DEPOSIT 11m",
        act365,
        following,
        Period.ofMonths(11),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDDR1 Curncy"), simpleNameSecurityId("CAD DEPOSIT 1y")),
        "CAD DEPOSIT 1y",
        act365,
        following,
        Period.ofYears(1),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDDR2 Curncy"), simpleNameSecurityId("CAD DEPOSIT 2y")),
        "CAD DEPOSIT 2y",
        act365,
        following,
        Period.ofYears(2),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDDR3 Curncy"), simpleNameSecurityId("CAD DEPOSIT 3y")),
        "CAD DEPOSIT 3y",
        act365,
        following,
        Period.ofYears(3),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDDR4 Curncy"), simpleNameSecurityId("CAD DEPOSIT 4y")),
        "CAD DEPOSIT 4y",
        act365,
        following,
        Period.ofYears(4),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDDR5 Curncy"), simpleNameSecurityId("CAD DEPOSIT 5y")),
        "CAD DEPOSIT 5y",
        act365,
        following,
        Period.ofYears(5),
        2,
        false,
        ca);
    // TODO check daycount
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDOR01 Index"),
            bloombergTickerSecurityId("CDOR01 RBC Index"),
            simpleNameSecurityId("CDOR 1m")),
        "CDOR 1m",
        act365,
        following,
        Period.ofMonths(1),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDOR02 Index"),
            bloombergTickerSecurityId("CDOR02 RBC Index"),
            simpleNameSecurityId("CDOR 2m")),
        "CDOR 2m",
        act365,
        following,
        Period.ofMonths(2),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDOR03 Index"),
            bloombergTickerSecurityId("CDOR03 RBC Index"),
            simpleNameSecurityId("CDOR 3m")),
        "CDOR 3m",
        act365,
        following,
        Period.ofMonths(3),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDOR06 Index"),
            bloombergTickerSecurityId("CDOR06 RBC Index"),
            simpleNameSecurityId("CDOR 6m")),
        "CDOR 6m",
        act365,
        following,
        Period.ofMonths(6),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CDOR12 Index"),
            bloombergTickerSecurityId("CDOR12 RBC Index"),
            simpleNameSecurityId("CDOR 12m")),
        "CDOR 12m",
        act365,
        following,
        Period.ofMonths(12),
        2,
        false,
        ca);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("CAONREPO Index"),
            simpleNameSecurityId("RBC OVERNIGHT REPO")),
        "RBC OVERNIGHT REPO",
        act365,
        following,
        Period.ofDays(1),
        0,
        false,
        ca,
        0);

    utils.addConventionBundle(
        ExternalIdBundle.of(simpleNameSecurityId("CAD_SWAP")),
        "CAD_SWAP",
        act365,
        modified,
        semiAnnual,
        0,
        ca,
        act365,
        modified,
        quarterly,
        0,
        simpleNameSecurityId("CDOR 3m"),
        ca,
        true);
    utils.addConventionBundle(
        ExternalIdBundle.of(simpleNameSecurityId("CAD_1Y_SWAP")),
        "CAD_1Y_SWAP",
        act365,
        modified,
        annual,
        0,
        ca,
        act365,
        modified,
        quarterly,
        0,
        simpleNameSecurityId("CDOR 3m"),
        ca,
        true);

    // Overnight Index Swap Convention have additional flag, publicationLag
    final Integer publicationLag = 1;
    utils.addConventionBundle(
        ExternalIdBundle.of(simpleNameSecurityId("CAD_OIS_SWAP")),
        "CAD_OIS_SWAP",
        act365,
        modified,
        annual,
        0,
        ca,
        act365,
        modified,
        annual,
        0,
        simpleNameSecurityId("RBC OVERNIGHT REPO"),
        ca,
        true,
        publicationLag);

    // TODO check the following details - copied from old CAD_FRA
    utils.addConventionBundle(
        ExternalIdBundle.of(simpleNameSecurityId("CAD_3M_FRA")),
        "CAD_3M_FRA",
        act365,
        following,
        quarterly,
        2,
        ca,
        act365,
        following,
        quarterly,
        2,
        simpleNameSecurityId("CDOR 3m"),
        ca,
        false);
    utils.addConventionBundle(
        ExternalIdBundle.of(simpleNameSecurityId("USD_6M_FRA")),
        "USD_6M_FRA",
        act365,
        following,
        semiAnnual,
        2,
        ca,
        act365,
        following,
        semiAnnual,
        2,
        simpleNameSecurityId("CDOR 6m"),
        ca,
        false);
    utils.addConventionBundle(
        ExternalIdBundle.of(simpleNameSecurityId("CAD_FRA")),
        "CAD_FRA",
        act365,
        following,
        quarterly,
        2,
        ca,
        act365,
        following,
        quarterly,
        2,
        simpleNameSecurityId("CDOR 3m"),
        ca,
        false);

    // TODO according to my information:
    // "Floating leg compounded quarterly at CDOR Flat paid semi-annually or annually for 1y"
    // Don't know how we're going to put that in
  }
  /**
   * Parses the specified file to populate the master.
   *
   * @param in the input reader to read, not closed, not null
   */
  public void parse(Reader in) {
    String name = null;
    try {
      Map<String, ManageableRegion> regions = new HashMap<String, ManageableRegion>();
      Map<UniqueId, Set<String>> subRegions = new HashMap<UniqueId, Set<String>>();

      // open CSV file
      @SuppressWarnings("resource")
      CSVReader reader = new CSVReader(in);
      List<String> columns = Arrays.asList(reader.readNext());

      // identify columns
      final int nameColumnIdx = columns.indexOf(NAME_COLUMN);
      final int formalNameColumnIdx = columns.indexOf(FORMAL_NAME_COLUMN);
      final int classificationColumnIdx = columns.indexOf(CLASSIFICATION_COLUMN);
      final int sovereignityColumnIdx = columns.indexOf(SOVEREIGNITY_COLUMN);
      final int countryColumnIdx = columns.indexOf(ISO_COUNTRY_2_COLUMN);
      final int currencyColumnIdx = columns.indexOf(ISO_CURRENCY_3_COLUMN);
      final int subRegionsColumnIdx = columns.indexOf(SUB_REGIONS_COLUMN);

      // parse
      String[] row = null;
      while ((row = reader.readNext()) != null) {
        name = row[nameColumnIdx].trim(); // the primary key
        String fullName = StringUtils.trimToNull(row[formalNameColumnIdx]);
        if (fullName == null) {
          fullName = name;
        }
        RegionClassification classification =
            RegionClassification.valueOf(row[classificationColumnIdx].trim());
        String sovereignity = StringUtils.trimToNull(row[sovereignityColumnIdx]);
        String countryISO = StringUtils.trimToNull(row[countryColumnIdx]);
        String currencyISO = StringUtils.trimToNull(row[currencyColumnIdx]);
        Set<String> rowSubRegions =
            new HashSet<String>(Arrays.asList(row[subRegionsColumnIdx].split(";")));
        rowSubRegions = trim(rowSubRegions);

        ManageableRegion region = new ManageableRegion();
        region.setClassification(classification);
        region.setName(name);
        region.setFullName(fullName);
        if (countryISO != null) {
          region.setCountry(Country.of(countryISO));
          region.addExternalId(ExternalSchemes.financialRegionId(countryISO)); // TODO: looks odd
        }
        if (currencyISO != null) {
          region.setCurrency(Currency.of(currencyISO));
        }
        if (sovereignity != null) {
          ManageableRegion parent = regions.get(sovereignity);
          if (parent == null) {
            throw new OpenGammaRuntimeException(
                "Cannot find parent '" + sovereignity + "'  for '" + name + "'");
          }
          region.getParentRegionIds().add(parent.getUniqueId());
        }
        for (Entry<UniqueId, Set<String>> entry : subRegions.entrySet()) {
          if (entry.getValue().remove(name)) {
            region.getParentRegionIds().add(entry.getKey());
          }
        }

        // store
        RegionDocument doc = getRegionMaster().add(new RegionDocument(region));
        if (rowSubRegions.size() > 0) {
          subRegions.put(doc.getUniqueId(), rowSubRegions);
        }
        regions.put(name, region);
      }
      for (Set<String> set : subRegions.values()) {
        if (set.size() > 0) {
          throw new OpenGammaRuntimeException("Cannot find children: " + set);
        }
      }

    } catch (Exception ex) {
      String detail = (name != null ? " while processing " + name : "");
      throw new OpenGammaRuntimeException(
          "Cannot open region data file (or file I/O problem)" + detail, ex);
    }
  }
Esempio n. 4
0
  public static synchronized void addFixedIncomeInstrumentConventions(
      final ConventionBundleMaster conventionMaster) {
    ArgumentChecker.notNull(conventionMaster, "convention master");
    final BusinessDayConvention following =
        BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention("Following");
    final DayCount act360 = DayCountFactory.INSTANCE.getDayCount("Actual/360");
    final ExternalId sg = ExternalSchemes.financialRegionId("TR");

    final ConventionBundleMasterUtils utils = new ConventionBundleMasterUtils(conventionMaster);

    // TODO need to check that these are right for deposit rates
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("TYDR1T Curncy"), simpleNameSecurityId("TRY DEPOSIT 1d")),
        "TRY DEPOSIT 1d",
        act360,
        following,
        Period.ofDays(1),
        0,
        false,
        sg);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("TYDR2T Curncy"), simpleNameSecurityId("TRY DEPOSIT 2d")),
        "TRY DEPOSIT 2d",
        act360,
        following,
        Period.ofDays(1),
        0,
        false,
        sg);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("TYDR3T Curncy"), simpleNameSecurityId("TRY DEPOSIT 3d")),
        "TRY DEPOSIT 3d",
        act360,
        following,
        Period.ofDays(1),
        2,
        false,
        sg);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("TYDR1Z Curncy"), simpleNameSecurityId("TRY DEPOSIT 1w")),
        "TRY DEPOSIT 1w",
        act360,
        following,
        Period.ofDays(7),
        2,
        false,
        sg);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("TYDR2Z Curncy"), simpleNameSecurityId("TRY DEPOSIT 2w")),
        "TRY DEPOSIT 2w",
        act360,
        following,
        Period.ofDays(14),
        2,
        false,
        sg);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("TYDR3Z Curncy"), simpleNameSecurityId("TRY DEPOSIT 3w")),
        "TRY DEPOSIT 3w",
        act360,
        following,
        Period.ofDays(21),
        2,
        false,
        sg);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("TYDRA Curncy"), simpleNameSecurityId("TRY DEPOSIT 1m")),
        "TRY DEPOSIT 1m",
        act360,
        following,
        Period.ofMonths(1),
        2,
        false,
        sg);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("TYDRB Curncy"), simpleNameSecurityId("TRY DEPOSIT 2m")),
        "TRY DEPOSIT 2m",
        act360,
        following,
        Period.ofMonths(2),
        2,
        false,
        sg);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("TYDRC Curncy"), simpleNameSecurityId("TRY DEPOSIT 3m")),
        "TRY DEPOSIT 3m",
        act360,
        following,
        Period.ofMonths(3),
        2,
        false,
        sg);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("TYDRD Curncy"), simpleNameSecurityId("TRY DEPOSIT 4m")),
        "TRY DEPOSIT 4m",
        act360,
        following,
        Period.ofMonths(4),
        2,
        false,
        sg);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("TYDRE Curncy"), simpleNameSecurityId("TRY DEPOSIT 5m")),
        "TRY DEPOSIT 5m",
        act360,
        following,
        Period.ofMonths(5),
        2,
        false,
        sg);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("TYDRF Curncy"), simpleNameSecurityId("TRY DEPOSIT 6m")),
        "TRY DEPOSIT 6m",
        act360,
        following,
        Period.ofMonths(6),
        2,
        false,
        sg);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("TYDRG Curncy"), simpleNameSecurityId("TRY DEPOSIT 7m")),
        "TRY DEPOSIT 7m",
        act360,
        following,
        Period.ofMonths(7),
        2,
        false,
        sg);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("TYDRH Curncy"), simpleNameSecurityId("TRY DEPOSIT 8m")),
        "TRY DEPOSIT 8m",
        act360,
        following,
        Period.ofMonths(8),
        2,
        false,
        sg);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("TYDRI Curncy"), simpleNameSecurityId("TRY DEPOSIT 9m")),
        "TRY DEPOSIT 9m",
        act360,
        following,
        Period.ofMonths(9),
        2,
        false,
        sg);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("TYDRJ Curncy"), simpleNameSecurityId("TRY DEPOSIT 10m")),
        "TRY DEPOSIT 10m",
        act360,
        following,
        Period.ofMonths(10),
        2,
        false,
        sg);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("TYDRK Curncy"), simpleNameSecurityId("TRY DEPOSIT 11m")),
        "TRY DEPOSIT 11m",
        act360,
        following,
        Period.ofMonths(11),
        2,
        false,
        sg);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("TYDR1 Curncy"), simpleNameSecurityId("TRY DEPOSIT 1y")),
        "TRY DEPOSIT 1y",
        act360,
        following,
        Period.ofYears(1),
        2,
        false,
        sg);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("TYDR2 Curncy"), simpleNameSecurityId("TRY DEPOSIT 2y")),
        "TRY DEPOSIT 2y",
        act360,
        following,
        Period.ofYears(2),
        2,
        false,
        sg);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("TYDR3 Curncy"), simpleNameSecurityId("TRY DEPOSIT 3y")),
        "TRY DEPOSIT 3y",
        act360,
        following,
        Period.ofYears(3),
        2,
        false,
        sg);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("TYDR4 Curncy"), simpleNameSecurityId("TRY DEPOSIT 4y")),
        "TRY DEPOSIT 4y",
        act360,
        following,
        Period.ofYears(4),
        2,
        false,
        sg);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            bloombergTickerSecurityId("TYDR5 Curncy"), simpleNameSecurityId("TRY DEPOSIT 5y")),
        "TRY DEPOSIT 5y",
        act360,
        following,
        Period.ofYears(5),
        2,
        false,
        sg);
  }
Esempio n. 5
0
  public static synchronized void addFixedIncomeInstrumentConventions(
      final ConventionBundleMaster conventionMaster) {
    Validate.notNull(conventionMaster, "convention master");
    final BusinessDayConvention modified =
        BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention("Modified Following");
    final BusinessDayConvention following =
        BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention("Following");
    final DayCount act360 = DayCountFactory.INSTANCE.getDayCount("Actual/360");
    final DayCount thirty360 = DayCountFactory.INSTANCE.getDayCount("30/360");
    final Frequency quarterly =
        SimpleFrequencyFactory.INSTANCE.getFrequency(Frequency.QUARTERLY_NAME);
    final Frequency semiAnnual =
        SimpleFrequencyFactory.INSTANCE.getFrequency(Frequency.SEMI_ANNUAL_NAME);
    final Frequency annual = SimpleFrequencyFactory.INSTANCE.getFrequency(Frequency.ANNUAL_NAME);
    final ExternalId ch = ExternalSchemes.financialRegionId("CH");

    final ConventionBundleMasterUtils utils = new ConventionBundleMasterUtils(conventionMaster);
    // TODO check that it's actually libor that we need
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SF00O/N Index"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF LIBOR O/N")),
        "CHF LIBOR O/N",
        act360,
        following,
        Period.ofDays(1),
        0,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SF00S/N Index"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF LIBOR S/N")),
        "CHF LIBOR S/N",
        act360,
        following,
        Period.ofDays(1),
        0,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SF00T/N Index"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF LIBOR T/N")),
        "CHF LIBOR T/N",
        act360,
        following,
        Period.ofDays(1),
        0,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SF0001W Index"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF LIBOR 1w")),
        "CHF LIBOR 1w",
        act360,
        following,
        Period.ofDays(7),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SF0002W Index"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF LIBOR 2w")),
        "CHF LIBOR 2w",
        act360,
        following,
        Period.ofDays(14),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SF0001M Index"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF LIBOR 1m")),
        "CHF LIBOR 1m",
        act360,
        following,
        Period.ofMonths(1),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SF0002M Index"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF LIBOR 2m")),
        "CHF LIBOR 2m",
        act360,
        following,
        Period.ofMonths(2),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SF0003M Index"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF LIBOR 3m")),
        "CHF LIBOR 3m",
        act360,
        following,
        Period.ofMonths(3),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SF0004M Index"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF LIBOR 4m")),
        "CHF LIBOR 4m",
        act360,
        following,
        Period.ofMonths(4),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SF0005M Index"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF LIBOR 5m")),
        "CHF LIBOR 5m",
        act360,
        following,
        Period.ofMonths(5),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SF0006M Index"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF LIBOR 6m"),
            ExternalId.of(InMemoryConventionBundleMaster.OG_SYNTHETIC_TICKER, "CHFLIBORP6M")),
        "CHF LIBOR 6m",
        act360,
        following,
        Period.ofMonths(6),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SF0007M Index"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF LIBOR 7m")),
        "CHF LIBOR 7m",
        act360,
        following,
        Period.ofMonths(7),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SF0008M Index"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF LIBOR 8m")),
        "CHF LIBOR 8m",
        act360,
        following,
        Period.ofMonths(8),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SF0009M Index"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF LIBOR 9m")),
        "CHF LIBOR 9m",
        act360,
        following,
        Period.ofMonths(9),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SF0010M Index"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF LIBOR 10m")),
        "CHF LIBOR 10m",
        act360,
        following,
        Period.ofMonths(10),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SF0011M Index"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF LIBOR 11m")),
        "CHF LIBOR 11m",
        act360,
        following,
        Period.ofMonths(11),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SF0012M Index"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF LIBOR 12m")),
        "CHF LIBOR 12m",
        act360,
        following,
        Period.ofMonths(12),
        2,
        false,
        ch);

    // TODO need to check that these are right for deposit rates
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SFDR1T Curncy"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF DEPOSIT 1d")),
        "CHF DEPOSIT 1d",
        act360,
        following,
        Period.ofDays(1),
        0,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SFDR2T Curncy"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF DEPOSIT 2d")),
        "CHF DEPOSIT 2d",
        act360,
        following,
        Period.ofDays(1),
        1,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SFDR3T Curncy"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF DEPOSIT 3d")),
        "CHF DEPOSIT 3d",
        act360,
        following,
        Period.ofDays(1),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SFDR1Z Curncy"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF DEPOSIT 1w")),
        "CHF DEPOSIT 1w",
        act360,
        following,
        Period.ofDays(7),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SFDR2Z Curncy"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF DEPOSIT 2w")),
        "CHF DEPOSIT 2w",
        act360,
        following,
        Period.ofDays(14),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SFDR3Z Curncy"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF DEPOSIT 3w")),
        "CHF DEPOSIT 3w",
        act360,
        following,
        Period.ofDays(21),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SFDRA Curncy"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF DEPOSIT 1m")),
        "CHF DEPOSIT 1m",
        act360,
        following,
        Period.ofMonths(1),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SFDRB Curncy"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF DEPOSIT 2m")),
        "CHF DEPOSIT 2m",
        act360,
        following,
        Period.ofMonths(2),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SFDRC Curncy"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF DEPOSIT 3m")),
        "CHF DEPOSIT 3m",
        act360,
        following,
        Period.ofMonths(3),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SFDRD Curncy"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF DEPOSIT 4m")),
        "CHF DEPOSIT 4m",
        act360,
        following,
        Period.ofMonths(4),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SFDRE Curncy"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF DEPOSIT 5m")),
        "CHF DEPOSIT 5m",
        act360,
        following,
        Period.ofMonths(5),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SFDRF Curncy"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF DEPOSIT 6m")),
        "CHF DEPOSIT 6m",
        act360,
        following,
        Period.ofMonths(6),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SFDRG Curncy"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF DEPOSIT 7m")),
        "CHF DEPOSIT 7m",
        act360,
        following,
        Period.ofMonths(7),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SFDRH Curncy"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF DEPOSIT 8m")),
        "CHF DEPOSIT 8m",
        act360,
        following,
        Period.ofMonths(8),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SFDRI Curncy"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF DEPOSIT 9m")),
        "CHF DEPOSIT 9m",
        act360,
        following,
        Period.ofMonths(9),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SFDRJ Curncy"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF DEPOSIT 10m")),
        "CHF DEPOSIT 10m",
        act360,
        following,
        Period.ofMonths(10),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SFDRK Curncy"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF DEPOSIT 11m")),
        "CHF DEPOSIT 11m",
        act360,
        following,
        Period.ofMonths(11),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SFDR1 Curncy"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF DEPOSIT 1y")),
        "CHF DEPOSIT 1y",
        act360,
        following,
        Period.ofYears(1),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SFDR2 Curncy"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF DEPOSIT 2y")),
        "CHF DEPOSIT 2y",
        act360,
        following,
        Period.ofYears(2),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SFDR3 Curncy"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF DEPOSIT 3y")),
        "CHF DEPOSIT 3y",
        act360,
        following,
        Period.ofYears(3),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SFDR4 Curncy"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF DEPOSIT 4y")),
        "CHF DEPOSIT 4y",
        act360,
        following,
        Period.ofYears(4),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("SFDR5 Curncy"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF DEPOSIT 5y")),
        "CHF DEPOSIT 5y",
        act360,
        following,
        Period.ofYears(5),
        2,
        false,
        ch);

    // TODO check reference rate
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF_SWAP")),
        "CHF_SWAP",
        thirty360,
        modified,
        annual,
        2,
        ch,
        act360,
        modified,
        semiAnnual,
        2,
        ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF LIBOR 6m"),
        ch,
        true);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF_3M_SWAP")),
        "CHF_3M_SWAP",
        thirty360,
        modified,
        annual,
        2,
        ch,
        act360,
        modified,
        quarterly,
        2,
        ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF LIBOR 3m"),
        ch,
        true);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF_6M_SWAP")),
        "CHF_6M_SWAP",
        thirty360,
        modified,
        annual,
        2,
        ch,
        act360,
        modified,
        semiAnnual,
        2,
        ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF LIBOR 6m"),
        ch,
        true);

    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF_3M_FRA")),
        "CHF_3M_FRA",
        thirty360,
        modified,
        annual,
        2,
        ch,
        act360,
        modified,
        quarterly,
        2,
        ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF LIBOR 3m"),
        ch,
        true);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF_6M_FRA")),
        "CHF_6M_FRA",
        thirty360,
        modified,
        annual,
        2,
        ch,
        act360,
        modified,
        semiAnnual,
        2,
        ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF LIBOR 6m"),
        ch,
        true);

    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalId.of(
                InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, IndexType.Libor + "_CHF_P3M")),
        IndexType.Libor + "_CHF_P3M",
        thirty360,
        modified,
        null,
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalId.of(
                InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, IndexType.Libor + "_CHF_P6M")),
        IndexType.Libor + "_CHF_P6M",
        thirty360,
        modified,
        null,
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalId.of(
                InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, IndexType.Euribor + "_CHF_P3M")),
        IndexType.Euribor + "_CHF_P3M",
        thirty360,
        modified,
        null,
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalId.of(
                InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, IndexType.Euribor + "_CHF_P6M")),
        IndexType.Euribor + "_CHF_P6M",
        thirty360,
        modified,
        null,
        2,
        false,
        ch);

    // Overnight Index Swap Convention have additional flag, publicationLag
    final Integer publicationLagON = 0; // TODO CASE PublicationLag CHF - Confirm 0
    // CHF Overnight Index
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalSchemes.bloombergTickerSecurityId("TOISTOIS Index"),
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF TOISTOIS")),
        "CHF TOIS TOIS",
        act360,
        following,
        Period.ofDays(1),
        2,
        false,
        ch,
        publicationLagON);
    // OIS
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF_OIS_SWAP")),
        "CHF_OIS_SWAP",
        act360,
        modified,
        annual,
        2,
        ch,
        act360,
        modified,
        annual,
        2,
        ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF TOISTOIS"),
        ch,
        true,
        publicationLagON);

    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHF_IBOR_INDEX")),
        "CHF_IBOR_INDEX",
        act360,
        following,
        2,
        false);

    // Identifiers for external data
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHFCASHP1D"),
            ExternalId.of(InMemoryConventionBundleMaster.OG_SYNTHETIC_TICKER, "CHFCASHP1D")),
        "CHFCASHP1D",
        act360,
        following,
        Period.ofDays(1),
        0,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHFCASHP1M"),
            ExternalId.of(InMemoryConventionBundleMaster.OG_SYNTHETIC_TICKER, "CHFCASHP1M")),
        "CHFCASHP1M",
        act360,
        modified,
        Period.ofMonths(1),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHFCASHP2M"),
            ExternalId.of(InMemoryConventionBundleMaster.OG_SYNTHETIC_TICKER, "CHFCASHP2M")),
        "CHFCASHP2M",
        act360,
        modified,
        Period.ofMonths(2),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHFCASHP3M"),
            ExternalId.of(InMemoryConventionBundleMaster.OG_SYNTHETIC_TICKER, "CHFCASHP3M")),
        "CHFCASHP3M",
        act360,
        modified,
        Period.ofMonths(3),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHFCASHP4M"),
            ExternalId.of(InMemoryConventionBundleMaster.OG_SYNTHETIC_TICKER, "CHFCASHP4M")),
        "CHFCASHP4M",
        act360,
        modified,
        Period.ofMonths(4),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHFCASHP5M"),
            ExternalId.of(InMemoryConventionBundleMaster.OG_SYNTHETIC_TICKER, "CHFCASHP5M")),
        "CHFCASHP5M",
        act360,
        modified,
        Period.ofMonths(5),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHFCASHP6M"),
            ExternalId.of(InMemoryConventionBundleMaster.OG_SYNTHETIC_TICKER, "CHFCASHP6M")),
        "CHFCASHP6M",
        act360,
        modified,
        Period.ofMonths(6),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHFCASHP7M"),
            ExternalId.of(InMemoryConventionBundleMaster.OG_SYNTHETIC_TICKER, "CHFCASHP7M")),
        "CHFCASHP7M",
        act360,
        modified,
        Period.ofMonths(7),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHFCASHP8M"),
            ExternalId.of(InMemoryConventionBundleMaster.OG_SYNTHETIC_TICKER, "CHFCASHP8M")),
        "CHFCASHP8M",
        act360,
        modified,
        Period.ofMonths(8),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHFCASHP9M"),
            ExternalId.of(InMemoryConventionBundleMaster.OG_SYNTHETIC_TICKER, "CHFCASHP9M")),
        "CHFCASHP9M",
        act360,
        modified,
        Period.ofMonths(9),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHFCASHP10M"),
            ExternalId.of(InMemoryConventionBundleMaster.OG_SYNTHETIC_TICKER, "CHFCASHP10M")),
        "CHFCASHP10M",
        act360,
        modified,
        Period.ofMonths(10),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHFCASHP11M"),
            ExternalId.of(InMemoryConventionBundleMaster.OG_SYNTHETIC_TICKER, "CHFCASHP11M")),
        "CHFCASHP11M",
        act360,
        modified,
        Period.ofMonths(11),
        2,
        false,
        ch);
    utils.addConventionBundle(
        ExternalIdBundle.of(
            ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "CHFCASHP12M"),
            ExternalId.of(InMemoryConventionBundleMaster.OG_SYNTHETIC_TICKER, "CHFCASHP12M")),
        "CHFCASHP12M",
        act360,
        modified,
        Period.ofMonths(12),
        2,
        false,
        ch);
  }