@Test
  public void multiThreadedSecurityRequest() throws Exception {

    ExternalIdBundle apvKey =
        ExternalIdBundle.of(ExternalSchemes.bloombergTickerSecurityId(APV_EQUITY_OPTION_TICKER));
    ExternalIdBundle spxKey =
        ExternalIdBundle.of(ExternalSchemes.bloombergTickerSecurityId(SPX_INDEX_OPTION_TICKER));
    ExternalIdBundle aaplKey =
        ExternalIdBundle.of(ExternalSchemes.bloombergTickerSecurityId(AAPL_EQUITY_TICKER));
    ExternalIdBundle attKey =
        ExternalIdBundle.of(ExternalSchemes.bloombergTickerSecurityId(ATT_EQUITY_TICKER));

    ExecutorService pool = Executors.newFixedThreadPool(4);
    List<Future<Security>> apvresults = new ArrayList<Future<Security>>();
    List<Future<Security>> spxresults = new ArrayList<Future<Security>>();
    List<Future<Security>> aaplresults = new ArrayList<Future<Security>>();
    List<Future<Security>> attresults = new ArrayList<Future<Security>>();

    for (int i = 0; i < 10; i++) {
      apvresults.add(pool.submit(new BSMGetSecurityCallable(apvKey)));
      spxresults.add(pool.submit(new BSMGetSecurityCallable(spxKey)));
      aaplresults.add(pool.submit(new BSMGetSecurityCallable(aaplKey)));
      attresults.add(pool.submit(new BSMGetSecurityCallable(attKey)));
    }

    for (Future<Security> future : apvresults) {
      // Check that each one didn't throw an exception and returns the expected
      // APV security
      Security sec = future.get();
      assertAmericanVanillaEquityOptionSecurity(EXPECTED_APVL_EQUITYOPTION_SEC, sec);
    }

    for (Future<Security> future : spxresults) {
      // Check that each one didn't throw an exception and returns the expected
      // SPX security
      Security sec = future.get();
      assertEuropeanVanillaEquityIndexOptionSecurity(EXPECTED_SPX_INDEXOPTION_SEC, sec);
    }

    for (Future<Security> future : aaplresults) {
      // Check that each one didn't throw an exception and returns the expected
      // AAPL security
      Security sec = future.get();
      assertEquitySecurity(EXPECTED_AAPL_EQUITY_SEC, sec);
    }

    for (Future<Security> future : attresults) {
      // Check that each one didn't throw an exception and returns the expected
      // AT&T security
      Security sec = future.get();
      assertEquitySecurity(EXPECTED_ATT_EQUITY_SEC, sec);
    }
  }
 static {
   s_ref.setExternalIdBundle(
       ExternalId.of(ExternalSchemes.BLOOMBERG_INDEX_FAMILY, "ICE LIBOR USD").toBundle());
   SortedMap<Tenor, ExternalId> entries = new TreeMap<>();
   entries.put(Tenor.ON, ExternalSchemes.bloombergTickerSecurityId("US00O/N Index"));
   entries.put(Tenor.THREE_MONTHS, ExternalSchemes.bloombergTickerSecurityId("US0003M Index"));
   entries.put(Tenor.SIX_MONTHS, ExternalSchemes.bloombergTickerSecurityId("US0006M Index"));
   entries.put(Tenor.NINE_MONTHS, ExternalSchemes.bloombergTickerSecurityId("US0009M Index"));
   entries.put(Tenor.TWELVE_MONTHS, ExternalSchemes.bloombergTickerSecurityId("US0012M Index"));
   s_ref.setMembers(entries);
   s_ref.setName("ICE LIBOR USD");
   s_ref.addAttribute("Test", "Value");
 }
 @Test
 public void invalidSecurity() throws Exception {
   ExternalIdBundle invalidKey =
       ExternalIdBundle.of(ExternalSchemes.bloombergTickerSecurityId("INVALID"));
   Security sec = _securityProvider.getSecurity(invalidKey);
   assertNull(sec);
 }
 @Test
 public void invalidSecurities() throws Exception {
   ExternalIdBundle invalidKey =
       ExternalIdBundle.of(ExternalSchemes.bloombergTickerSecurityId("INVALID"));
   Map<ExternalIdBundle, Security> securities =
       _securityProvider.getSecurities(ImmutableSet.of(invalidKey));
   assertNotNull(securities);
   assertTrue(securities.isEmpty());
 }
 @Test(enabled = false)
 public void currencyFuture() throws Exception {
   ExternalIdBundle id =
       ExternalIdBundle.of(ExternalSchemes.bloombergTickerSecurityId("LNM0 Curncy"));
   Security audUsd = _securityProvider.getSecurity(id);
   assertNotNull(audUsd);
   assertTrue(audUsd instanceof FXFutureSecurity);
   assertSecurity(EXPECTED_AUDUSD_FUTURE_SEC, audUsd);
 }
 /**
  * Returns AAPL equity security for testing
  *
  * @return the equity security
  */
 public static EquitySecurity getEquitySecurity() {
   EquitySecurity equitySecurity =
       new EquitySecurity("NASDAQ/NGS (GLOBAL SELECT MARKET)", "XNGS", "APPLE INC", Currency.USD);
   equitySecurity.addExternalId(ExternalSchemes.bloombergTickerSecurityId("AAPL US Equity"));
   equitySecurity.addExternalId(ExternalSchemes.bloombergBuidSecurityId("EQ0010169500001000"));
   equitySecurity.addExternalId(ExternalSchemes.cusipSecurityId("037833100"));
   equitySecurity.addExternalId(ExternalSchemes.isinSecurityId("US0378331005"));
   equitySecurity.addExternalId(ExternalSchemes.sedol1SecurityId("2046251"));
   equitySecurity.setShortName("AAPL");
   equitySecurity.setName("APPLE INC");
   equitySecurity.setGicsCode(GICSCode.of("45202010"));
   return equitySecurity;
 }
 private HistoricalTimeSeriesInfoDocument loadTimeSeries(ExternalIdBundle idBundle) {
   ReferenceDataProvider referenceDataProvider =
       ((BloombergToolContext) getToolContext()).getBloombergReferenceDataProvider();
   if (idBundle.getExternalId(ExternalSchemes.BLOOMBERG_BUID) == null
       && idBundle.getExternalId(ExternalSchemes.BLOOMBERG_TICKER) != null) {
     // For some reason loading some series by TICKER fails, but BUID works
     BiMap<String, ExternalIdBundle> map =
         BloombergDataUtils.convertToBloombergBuidKeys(
             Collections.singleton(idBundle), referenceDataProvider);
     if (map.size() != 1) {
       throw new OpenGammaRuntimeException("Failed to get buid");
     }
     for (String key : map.keySet()) {
       ReferenceDataResult buidResult =
           referenceDataProvider.getFields(
               Collections.singleton(key),
               Collections.singleton(BloombergConstants.FIELD_ID_BBG_UNIQUE));
       String buid =
           buidResult
               .getResult(key)
               .getFieldData()
               .getString(BloombergConstants.FIELD_ID_BBG_UNIQUE);
       idBundle = idBundle.withExternalId(ExternalSchemes.bloombergTickerSecurityId(buid));
     }
   }
   ExternalIdBundle searchBundle =
       idBundle.withoutScheme(
           ExternalSchemes
               .ISIN); // For things which move country, e.g. ISIN(VALE5 BZ Equity) == ISIN(RIODF
   // US Equity)
   Map<ExternalId, UniqueId> timeSeries =
       getToolContext()
           .getHistoricalTimeSeriesLoader()
           .addTimeSeries(
               searchBundle.getExternalIds(),
               "CMPL",
               "PX_LAST",
               LocalDate.now().minusYears(1),
               null);
   if (timeSeries.size() != 1) {
     throw new OpenGammaRuntimeException(
         "Failed to load time series " + idBundle + " " + timeSeries);
   }
   for (UniqueId uid : timeSeries.values()) {
     return getToolContext().getHistoricalTimeSeriesMaster().get(uid);
   }
   throw new OpenGammaRuntimeException("Unexpected state");
 }
 @Test(groups = {"bbgSecurityFutureTests"})
 public void euroBondFuture() throws Exception {
   ExternalIdBundle euroBund =
       ExternalIdBundle.of(ExternalSchemes.bloombergTickerSecurityId("RXA Comdty"));
   Security bond = _securityProvider.getSecurity(euroBund);
   assertNotNull(bond);
   assertTrue(bond instanceof BondFutureSecurity);
   BondFutureSecurity euroBondFuture = (BondFutureSecurity) bond;
   assertEquals("FUTURE", euroBondFuture.getSecurityType());
   assertEquals("Bond", euroBondFuture.getContractCategory());
   assertEquals(EUR, euroBondFuture.getCurrency());
   String displayName = euroBondFuture.getName();
   assertNotNull(displayName);
   assertTrue(displayName.contains("EURO-BUND FUTURE"));
   Expiry expiry = euroBondFuture.getExpiry();
   assertNotNull(expiry);
   assertTrue(expiry.toInstant().isAfter(getTodayInstant()));
   assertEquals("XEUR", euroBondFuture.getTradingExchange());
   assertEquals("XEUR", euroBondFuture.getSettlementExchange());
   // assert identifiers are set
   Collection<ExternalId> identifiers = euroBondFuture.getExternalIdBundle().getExternalIds();
   assertNotNull(identifiers);
   assertTrue(identifiers.size() >= EXPECTED_IDENTIFICATION_SCHEME.length);
   ExternalIdBundle identifierBundle = ExternalIdBundle.of(identifiers);
   for (ExternalScheme expectedIDScheme : EXPECTED_IDENTIFICATION_SCHEME) {
     assertNotNull(identifierBundle.getExternalId(expectedIDScheme));
   }
   // assert deliverables are not empty
   Collection<BondFutureDeliverable> basket = euroBondFuture.getBasket();
   assertNotNull(basket);
   for (BondFutureDeliverable bondFutureDeliverable : basket) {
     ExternalIdBundle bundle = bondFutureDeliverable.getIdentifiers();
     assertNotNull(bundle);
     assertNotNull(bundle.getExternalId(ExternalSchemes.BLOOMBERG_BUID));
     assertTrue(bondFutureDeliverable.getConversionFactor() > 0);
   }
 }
/**
 * Tests the fields of an equity index. This test is intended to pick up any changes before
 * databases are affected.
 */
@Test(groups = TestGroup.UNIT)
public class EquityIndexTest {
  /** The index name */
  private static final String NAME = "BOND INDEX";
  /** The index description */
  private static final String DESCRIPTION = "BOND INDEX DESCRIPTION";
  /** The first index member */
  private static final ExternalIdBundle ID1 =
      ExternalIdBundle.of(ExternalSchemes.bloombergTickerSecurityId("A"));
  /** The second index member */
  private static final ExternalIdBundle ID2 =
      ExternalIdBundle.of(ExternalSchemes.bloombergTickerSecurityId("B"));
  /** The components */
  private static final List<EquityIndexComponent> COMPONENTS =
      Arrays.asList(
          new EquityIndexComponent(ID1, new BigDecimal(0.7)),
          new EquityIndexComponent(ID2, new BigDecimal(0.3)));
  /** The weighting type */
  private static final IndexWeightingType WEIGHTING_TYPE = IndexWeightingType.EQUAL;
  /** The index */
  private static final EquityIndex INDEX_NO_DESCRIPTION =
      new EquityIndex(NAME, COMPONENTS, WEIGHTING_TYPE);
  /** The index */
  private static final EquityIndex INDEX_WITH_DESCRIPTION =
      new EquityIndex(NAME, DESCRIPTION, COMPONENTS, WEIGHTING_TYPE);

  /** Tests that the components cannot be null */
  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testNullComponents() {
    new EquityIndex(NAME, DESCRIPTION, null, WEIGHTING_TYPE);
  }

  /** Tests that the components cannot be empty */
  @Test
  public void testEmptyComponents() {
    new EquityIndex(NAME, DESCRIPTION, new ArrayList<EquityIndexComponent>(), WEIGHTING_TYPE);
  }

  /** Tests that the weighting type cannot be null */
  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testNullWeightingType() {
    new EquityIndex(NAME, DESCRIPTION, COMPONENTS, null);
  }

  /** Tests the number of fields in the index. Will pick up additions / removals. */
  @Test
  public void testNumberOfFields() {
    List<Field> fields = IndexTestUtils.getFields(INDEX_NO_DESCRIPTION.getClass());
    assertEquals(15, fields.size());
    fields = IndexTestUtils.getFields(INDEX_WITH_DESCRIPTION.getClass());
    assertEquals(15, fields.size());
  }

  /** Tests that fields are set correctly and that fields that should be null are. */
  @Test
  public void test() {
    assertEquals(NAME, INDEX_NO_DESCRIPTION.getName());
    assertEquals(NAME, INDEX_WITH_DESCRIPTION.getName());
    assertNull(INDEX_NO_DESCRIPTION.getDescription());
    assertEquals(DESCRIPTION, INDEX_WITH_DESCRIPTION.getDescription());
    assertEquals(COMPONENTS, INDEX_NO_DESCRIPTION.getEquityComponents());
    assertEquals(COMPONENTS, INDEX_WITH_DESCRIPTION.getEquityComponents());
    assertEquals(WEIGHTING_TYPE, INDEX_NO_DESCRIPTION.getWeightingType());
    assertEquals(WEIGHTING_TYPE, INDEX_WITH_DESCRIPTION.getWeightingType());
  }
}
  private void addNodes(
      final ManageablePortfolioNode rootNode,
      final String underlying,
      final boolean includeUnderlying,
      final Period[] expiries) {
    final ExternalId ticker = ExternalSchemes.bloombergTickerSecurityId(underlying);
    ManageableSecurity underlyingSecurity = null;
    if (includeUnderlying) {
      underlyingSecurity = getOrLoadEquity(ticker);
    }

    final ExternalIdBundle bundle =
        underlyingSecurity == null
            ? ExternalIdBundle.of(ticker)
            : underlyingSecurity.getExternalIdBundle();
    final HistoricalTimeSeriesInfoDocument timeSeriesInfo = getOrLoadTimeSeries(ticker, bundle);
    final double estimatedCurrentStrike = getOrLoadMostRecentPoint(timeSeriesInfo);
    final Set<ExternalId> optionChain = getOptionChain(ticker);

    // TODO: reuse positions/nodes?
    final String longName = underlyingSecurity == null ? "" : underlyingSecurity.getName();
    final String formattedName =
        MessageFormatter.format("[{}] {}", underlying, longName).getMessage();
    final ManageablePortfolioNode equityNode = new ManageablePortfolioNode(formattedName);

    final BigDecimal underlyingAmount =
        VALUE_OF_UNDERLYING.divide(
            BigDecimal.valueOf(estimatedCurrentStrike), BigDecimal.ROUND_HALF_EVEN);

    if (includeUnderlying) {
      addPosition(equityNode, underlyingAmount, ticker);
    }

    final TreeMap<LocalDate, Set<BloombergTickerParserEQOption>> optionsByExpiry =
        new TreeMap<LocalDate, Set<BloombergTickerParserEQOption>>();
    for (final ExternalId optionTicker : optionChain) {
      s_logger.debug("Got option {}", optionTicker);

      final BloombergTickerParserEQOption optionInfo =
          BloombergTickerParserEQOption.getOptionParser(optionTicker);
      s_logger.debug("Got option info {}", optionInfo);

      final LocalDate key = optionInfo.getExpiry();
      Set<BloombergTickerParserEQOption> set = optionsByExpiry.get(key);
      if (set == null) {
        set = new HashSet<BloombergTickerParserEQOption>();
        optionsByExpiry.put(key, set);
      }
      set.add(optionInfo);
    }
    final Set<ExternalId> tickersToLoad = new HashSet<ExternalId>();

    final BigDecimal expiryCount = BigDecimal.valueOf(expiries.length);
    final BigDecimal defaultAmountAtExpiry =
        underlyingAmount.divide(expiryCount, BigDecimal.ROUND_DOWN);
    final BigDecimal spareAmountAtExpiry = defaultAmountAtExpiry.add(BigDecimal.ONE);
    int spareCount =
        underlyingAmount.subtract(defaultAmountAtExpiry.multiply(expiryCount)).intValue();

    for (final Period bucketPeriod : expiries) {
      final ManageablePortfolioNode bucketNode =
          new ManageablePortfolioNode(bucketPeriod.toString().substring(1));

      final LocalDate nowish =
          LocalDate.now()
              .withDayOfMonth(
                  20); // This avoids us picking different options every time this script is run
      final LocalDate targetExpiry = nowish.plus(bucketPeriod);
      final LocalDate chosenExpiry = optionsByExpiry.floorKey(targetExpiry);
      if (chosenExpiry == null) {
        s_logger.info("No options for {} on {}", targetExpiry, underlying);
        continue;
      }
      s_logger.info(
          "Using time {} for bucket {} ({})",
          new Object[] {chosenExpiry, bucketPeriod, targetExpiry});

      final Set<BloombergTickerParserEQOption> optionsAtExpiry = optionsByExpiry.get(chosenExpiry);
      final TreeMap<Double, Pair<BloombergTickerParserEQOption, BloombergTickerParserEQOption>>
          optionsByStrike = new TreeMap<>();
      for (final BloombergTickerParserEQOption option : optionsAtExpiry) {
        //        s_logger.info("option {}", option);
        final double key = option.getStrike();
        Pair<BloombergTickerParserEQOption, BloombergTickerParserEQOption> pair =
            optionsByStrike.get(key);
        if (pair == null) {
          pair = Pair.of(null, null);
        }
        if (option.getOptionType() == OptionType.CALL) {
          pair = Pair.of(option, pair.getSecond());
        } else {
          pair = Pair.of(pair.getFirst(), option);
        }
        optionsByStrike.put(key, pair);
      }

      // cascading collar?
      final BigDecimal amountAtExpiry =
          spareCount-- > 0 ? spareAmountAtExpiry : defaultAmountAtExpiry;

      s_logger.info(" est strike {}", estimatedCurrentStrike);
      final Double[] strikes = optionsByStrike.keySet().toArray(new Double[0]);

      int strikeIndex = Arrays.binarySearch(strikes, estimatedCurrentStrike);
      if (strikeIndex < 0) {
        strikeIndex = -(1 + strikeIndex);
      }
      s_logger.info(
          "strikes length {} index {} strike of index {}",
          new Object[] {
            Integer.valueOf(strikes.length),
            Integer.valueOf(strikeIndex),
            Double.valueOf(strikes[strikeIndex])
          });

      int minIndex = strikeIndex - _numOptions;
      minIndex = Math.max(0, minIndex);
      int maxIndex = strikeIndex + _numOptions;
      maxIndex = Math.min(strikes.length - 1, maxIndex);

      s_logger.info("min {} max {}", Integer.valueOf(minIndex), Integer.valueOf(maxIndex));
      final StringBuffer sb = new StringBuffer("strikes: [");
      for (int j = minIndex; j <= maxIndex; j++) {
        sb.append(" ");
        sb.append(strikes[j]);
      }
      sb.append(" ]");
      s_logger.info(sb.toString());

      // Short Calls
      final ArrayList<Pair<BloombergTickerParserEQOption, BloombergTickerParserEQOption>> calls =
          new ArrayList<Pair<BloombergTickerParserEQOption, BloombergTickerParserEQOption>>();
      for (int j = minIndex; j < strikeIndex; j++) {
        final Pair<BloombergTickerParserEQOption, BloombergTickerParserEQOption> pair =
            optionsByStrike.get(strikes[j]);
        if (pair == null) {
          throw new OpenGammaRuntimeException("no pair for strike" + strikes[j]);
        }
        calls.add(pair);
      }
      spreadOptions(
          bucketNode,
          calls,
          OptionType.CALL,
          -1,
          tickersToLoad,
          amountAtExpiry,
          includeUnderlying,
          calls.size());

      // Long Puts
      final ArrayList<Pair<BloombergTickerParserEQOption, BloombergTickerParserEQOption>> puts =
          new ArrayList<Pair<BloombergTickerParserEQOption, BloombergTickerParserEQOption>>();
      for (int j = strikeIndex + 1; j <= maxIndex; j++) {
        final Pair<BloombergTickerParserEQOption, BloombergTickerParserEQOption> pair =
            optionsByStrike.get(strikes[j]);
        if (pair == null) {
          throw new OpenGammaRuntimeException("no pair for strike" + strikes[j]);
        }
        puts.add(pair);
      }
      spreadOptions(
          bucketNode,
          puts,
          OptionType.PUT,
          1,
          tickersToLoad,
          amountAtExpiry,
          includeUnderlying,
          puts.size());

      if (bucketNode.getChildNodes().size() + bucketNode.getPositionIds().size() > 0) {
        equityNode.addChildNode(bucketNode); // Avoid generating empty nodes
      }
    }

    for (final ExternalId optionTicker : tickersToLoad) {
      final ManageableSecurity loaded = getOrLoadSecurity(optionTicker);
      if (loaded == null) {
        throw new OpenGammaRuntimeException("Unexpected option type " + loaded);
      }

      // TODO [LAPANA-29] Should be able to do this for index options too
      if (includeUnderlying) {
        try {
          final HistoricalTimeSeriesInfoDocument loadedTs =
              getOrLoadTimeSeries(optionTicker, loaded.getExternalIdBundle());
          if (loadedTs == null) {
            throw new OpenGammaRuntimeException("Failed to get time series for " + loaded);
          }
        } catch (final Exception ex) {
          s_logger.info("Failed to get time series for " + loaded, ex);
        }
      }
    }

    if (equityNode.getPositionIds().size() + equityNode.getChildNodes().size() > 0) {
      rootNode.addChildNode(equityNode);
    }
  }
Пример #11
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);
  }
  /**
   * Get US bond future security for testing
   *
   * @return the bond future security
   */
  public static BondFutureSecurity getBondFutureSecurity() {
    Expiry expiry =
        new Expiry(
            ZonedDateTime.of(LocalDateTime.of(2010, Month.JUNE, 21, 19, 0), ZoneOffset.UTC),
            ExpiryAccuracy.MIN_HOUR_DAY_MONTH_YEAR);
    Set<BondFutureDeliverable> basket = new HashSet<BondFutureDeliverable>();
    basket.add(
        new BondFutureDeliverable(
            ExternalIdBundle.of(ExternalSchemes.bloombergBuidSecurityId("GV912810EV6")), 1.0858));
    basket.add(
        new BondFutureDeliverable(
            ExternalIdBundle.of(ExternalSchemes.bloombergBuidSecurityId("GV912810FB9")), 1.0132));
    basket.add(
        new BondFutureDeliverable(
            ExternalIdBundle.of(ExternalSchemes.bloombergBuidSecurityId("GV912810PX0")), 0.7984));
    basket.add(
        new BondFutureDeliverable(
            ExternalIdBundle.of(ExternalSchemes.bloombergBuidSecurityId("GV912810FG8")), 0.9169));
    basket.add(
        new BondFutureDeliverable(
            ExternalIdBundle.of(ExternalSchemes.bloombergBuidSecurityId("GV912810QD3")), 0.7771));
    basket.add(
        new BondFutureDeliverable(
            ExternalIdBundle.of(ExternalSchemes.bloombergBuidSecurityId("GV912810FF0")), 0.9174));
    basket.add(
        new BondFutureDeliverable(
            ExternalIdBundle.of(ExternalSchemes.bloombergBuidSecurityId("GV912810PW2")), 0.7825));
    basket.add(
        new BondFutureDeliverable(
            ExternalIdBundle.of(ExternalSchemes.bloombergBuidSecurityId("GV912810FE3")), 0.9454));
    basket.add(
        new BondFutureDeliverable(
            ExternalIdBundle.of(ExternalSchemes.bloombergBuidSecurityId("GV912810QH4")), 0.7757));
    basket.add(
        new BondFutureDeliverable(
            ExternalIdBundle.of(ExternalSchemes.bloombergBuidSecurityId("GV912810PU6")), 0.8675));
    basket.add(
        new BondFutureDeliverable(
            ExternalIdBundle.of(ExternalSchemes.bloombergBuidSecurityId("GV912810EX2")), 1.0765));
    basket.add(
        new BondFutureDeliverable(
            ExternalIdBundle.of(ExternalSchemes.bloombergBuidSecurityId("GV912810FT0")), 0.8054));
    basket.add(
        new BondFutureDeliverable(
            ExternalIdBundle.of(ExternalSchemes.bloombergBuidSecurityId("GV912810FJ2")), 1.0141));
    basket.add(
        new BondFutureDeliverable(
            ExternalIdBundle.of(ExternalSchemes.bloombergBuidSecurityId("GV912810PT9")), 0.8352));
    basket.add(
        new BondFutureDeliverable(
            ExternalIdBundle.of(ExternalSchemes.bloombergBuidSecurityId("GV912810QE1")), 0.8109));
    basket.add(
        new BondFutureDeliverable(
            ExternalIdBundle.of(ExternalSchemes.bloombergBuidSecurityId("GV912810FP8")), 0.9268));
    basket.add(
        new BondFutureDeliverable(
            ExternalIdBundle.of(ExternalSchemes.bloombergBuidSecurityId("GV912810QA9")), 0.6606));
    basket.add(
        new BondFutureDeliverable(
            ExternalIdBundle.of(ExternalSchemes.bloombergBuidSecurityId("GV912810FM5")), 1.0286));
    basket.add(
        new BondFutureDeliverable(
            ExternalIdBundle.of(ExternalSchemes.bloombergBuidSecurityId("GV912810EY0")), 1.0513));
    basket.add(
        new BondFutureDeliverable(
            ExternalIdBundle.of(ExternalSchemes.bloombergBuidSecurityId("GV912810QB7")), 0.7616));
    basket.add(
        new BondFutureDeliverable(
            ExternalIdBundle.of(ExternalSchemes.bloombergBuidSecurityId("GV912810QC5")), 0.795));
    basket.add(
        new BondFutureDeliverable(
            ExternalIdBundle.of(ExternalSchemes.bloombergBuidSecurityId("GV912810EZ7")), 1.0649));
    basket.add(
        new BondFutureDeliverable(
            ExternalIdBundle.of(ExternalSchemes.bloombergBuidSecurityId("GV912810EW4")), 1.0));
    basket.add(
        new BondFutureDeliverable(
            ExternalIdBundle.of(ExternalSchemes.bloombergBuidSecurityId("GV912810FA1")), 1.0396));

    BondFutureSecurity sec =
        new BondFutureSecurity(
            expiry,
            "XCBT",
            "XCBT",
            Currency.USD,
            1000,
            basket,
            LocalDate.of(2010, 6, 01).atStartOfDay(ZoneOffset.UTC),
            LocalDate.of(2010, 6, 01).atStartOfDay(ZoneOffset.UTC),
            "Bond");
    sec.setName("US LONG BOND(CBT) Jun10");
    Set<ExternalId> identifiers = new HashSet<ExternalId>();
    identifiers.add(ExternalSchemes.bloombergBuidSecurityId("IX8530684-0"));
    identifiers.add(ExternalSchemes.cusipSecurityId("USM10"));
    identifiers.add(ExternalSchemes.bloombergTickerSecurityId("USM10 Comdty"));
    sec.setExternalIdBundle(ExternalIdBundle.of(identifiers));
    return sec;
  }