Package com.opengamma.financial.convention

Examples of com.opengamma.financial.convention.DefaultConventionBundleSource


  }

  private Set<ExternalId> getInitialRateExternalIds(final Set<Currency> currencies) {
    final ConventionBundleMaster cbm = new InMemoryConventionBundleMaster();
    final DefaultConventionBundleSource cbs = new DefaultConventionBundleSource(cbm);
    final Set<ExternalId> externalInitialRateId = newHashSet();
    for (final Currency currency : currencies) {
      for (final String swapType : new String[]{"SWAP", "3M_SWAP", "6M_SWAP"}) {
        final String product = currency.getCode() + "_" + swapType;
        final ConventionBundle convention = cbs.getConventionBundle(ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, product));
        if (convention != null) {
          final ExternalId initialRate = convention.getSwapFloatingLegInitialRate();
          final ConventionBundle realIdConvention = cbs.getConventionBundle(initialRate);
          externalInitialRateId.add(realIdConvention.getIdentifiers().getExternalId(ExternalSchemes.BLOOMBERG_TICKER));
        } else {
          s_logger.info("No convention for {} product", product);
        }
      }
View Full Code Here


        curveNodesExternalIds);
  }

  private Set<ExternalId> getInitialRateExternalIds(final Set<Currency> currencies) {
    final ConventionBundleMaster cbm = new InMemoryConventionBundleMaster();
    final DefaultConventionBundleSource cbs = new DefaultConventionBundleSource(cbm);
    final Set<ExternalId> externalInitialRateId = newHashSet();
    for (final Currency currency : currencies) {
      for (final String swapType : new String[]{"SWAP", "3M_SWAP", "6M_SWAP"}) {
        final String product = currency.getCode() + "_" + swapType;
        final ConventionBundle convention = cbs.getConventionBundle(ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, product));
        if (convention != null) {
          final ExternalId initialRate = convention.getSwapFloatingLegInitialRate();
          final ConventionBundle realIdConvention = cbs.getConventionBundle(initialRate);
          if (realIdConvention != null) {
            externalInitialRateId.add(realIdConvention.getIdentifiers().getExternalId(ExternalSchemes.BLOOMBERG_TICKER));
          } else {
            s_logger.error("No convention for {}", initialRate.toString());
          }
View Full Code Here

   
    setSecurityLoader(remoteComponentFactory.getSecurityLoader(classifierPreferences));
    setHistoricalTimeSeriesLoader(remoteComponentFactory.getHistoricalTimeSeriesLoader(classifierPreferences));
   
    // this may need customizing per-project
    setConventionBundleSource(new DefaultConventionBundleSource(new InMemoryConventionBundleMaster()));
   
    setFunctionConfigSource(remoteComponentFactory.getFunctionConfigurationSource(classifierPreferences));
  }
View Full Code Here

public class InMemoryConventionBundleMasterTest {

  @Test
  public void testRepository() {
    final ConventionBundleMaster repo = new InMemoryConventionBundleMaster();
    final ConventionBundleSource source = new DefaultConventionBundleSource(repo);
    final BusinessDayConvention modified = BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention("Modified Following");
    final BusinessDayConvention following = BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention("Following");
    final DayCount actact = DayCountFactory.INSTANCE.getDayCount("Actual/360");

    final ConventionBundle conventions = source.getConventionBundle(ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "USD LIBOR O/N"));
    AssertJUnit.assertEquals("USD LIBOR O/N", conventions.getName());
    AssertJUnit.assertEquals("US00O/N Index", conventions.getIdentifiers().getValue(ExternalSchemes.BLOOMBERG_TICKER));
    AssertJUnit.assertEquals("USD LIBOR O/N", conventions.getIdentifiers().getValue(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME));
    final UniqueId uidON = conventions.getUniqueId();
    AssertJUnit.assertEquals(InMemoryConventionBundleMaster.IN_MEMORY_UNIQUE_SCHEME.getName(), uidON.getScheme());
    AssertJUnit.assertEquals(actact, conventions.getDayCount());
    AssertJUnit.assertEquals(following, conventions.getBusinessDayConvention());
    AssertJUnit.assertEquals(0, (int) conventions.getSettlementDays());

    final ConventionBundle conventions2 = source.getConventionBundle(ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "USD LIBOR 3m"));
    AssertJUnit.assertEquals("USD LIBOR 3m", conventions2.getName());
    AssertJUnit.assertEquals("US0003M Index", conventions2.getIdentifiers().getValue(ExternalSchemes.BLOOMBERG_TICKER));
    AssertJUnit.assertEquals("USD LIBOR 3m", conventions2.getIdentifiers().getValue(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME));
    final UniqueId uid3M = conventions2.getUniqueId ();
    AssertJUnit.assertEquals(InMemoryConventionBundleMaster.IN_MEMORY_UNIQUE_SCHEME.getName(), uid3M.getScheme ());
View Full Code Here

   *
   * @param repo  the component repository, only used to register secondary items like lifecycle, not null
   * @return the convention bundle source, not null
   */
  protected ConventionBundleSource createConventionBundleSource(ComponentRepository repo) {
    return new DefaultConventionBundleSource(createConventionBundleMaster(repo));
  }
View Full Code Here

TOP

Related Classes of com.opengamma.financial.convention.DefaultConventionBundleSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.