Package com.opengamma.id

Examples of com.opengamma.id.ExternalId


  private static ExternalId getSwapRateFor(final ConfigSource configSource, final Currency ccy, final LocalDate tradeDate, final Tenor tenor) {
    final CurveSpecificationBuilderConfiguration curveSpecConfig = configSource.getSingle(CurveSpecificationBuilderConfiguration.class, "DEFAULT_" + ccy.getCode(), VersionCorrection.LATEST);
    if (curveSpecConfig == null) {
      throw new OpenGammaRuntimeException("No curve spec builder configuration for DEFAULT_" + ccy.getCode());
    }
    ExternalId swapSecurity;
    if (ccy.equals(Currency.USD)) {
      // Standard (i.e. matches convention) floating leg tenor for USD is 3M
      swapSecurity = curveSpecConfig.getSwap3MSecurity(tradeDate, tenor);
    } else {
      // Standard (i.e. matches convention) floating leg tenor for CHF, JPY, GBP, EUR is 6M
View Full Code Here


   */
  public static ExternalId getRegion(final Security security) {
    if (security instanceof FinancialSecurity) {
      final FinancialSecurity finSec = (FinancialSecurity) security;

      final ExternalId regionId = finSec.accept(new FinancialSecurityVisitorSameValueAdapter<ExternalId>(null) {

        @Override
        public ExternalId visitGovernmentBondSecurity(final GovernmentBondSecurity security) {
          return ExternalId.of(ExternalSchemes.ISO_COUNTRY_ALPHA2, security.getIssuerDomicile());
        }
View Full Code Here

   */
  public static ExternalId getExchange(final Security security) {
    if (security instanceof FinancialSecurity) {
      final FinancialSecurity finSec = (FinancialSecurity) security;

      final ExternalId regionId = finSec.accept(new FinancialSecurityVisitorSameValueAdapter<ExternalId>(null) {
        @Override
        public ExternalId visitEquityBarrierOptionSecurity(final EquityBarrierOptionSecurity security) {
          return ExternalId.of(ExternalSchemes.ISO_MIC, security.getExchange());
        }

View Full Code Here

      final DayCount dayCount = DayCountFactory.INSTANCE.getDayCount(message.getString(DAY_COUNT_FIELD));
      final BusinessDayConvention businessDayConvention = BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention(message.getString(BUSINESS_DAY_CONVENTION_FIELD));
      final int settlementDays = message.getInt(SETTLEMENT_DAYS_FIELD);
      final boolean isEOM = message.getBoolean(IS_EOM_FIELD);
      final Currency currency = Currency.of(message.getString(CURRENCY_FIELD));
      final ExternalId regionCalendar = deserializer.fieldValueToObject(ExternalId.class, message.getByName(REGION_FIELD));
      final StubType stubType = StubType.valueOf(message.getString(STUB_TYPE_FIELD));
      final boolean exchangeNotional = message.getBoolean(EXCHANGE_NOTIONAL_FIELD);
      final int paymentLag = message.getInt(PAYMENT_LAG_FIELD);
      final SwapFixedLegConvention convention = new SwapFixedLegConvention(name, externalIdBundle, paymentTenor, dayCount, businessDayConvention, currency,
          regionCalendar, settlementDays, isEOM, stubType, exchangeNotional, paymentLag);
View Full Code Here

    @Override
    public SwapIndexConvention buildObject(final FudgeDeserializer deserializer, final FudgeMsg message) {
      final String name = message.getString(NAME_FIELD);
      final ExternalIdBundle externalIdBundle = deserializer.fieldValueToObject(ExternalIdBundle.class, message.getByName(EXTERNAL_ID_BUNDLE_FIELD));
      final LocalTime fixingTime = LocalTime.parse(message.getString(FIXING_TIME_FIELD));
      final ExternalId receiveLegConvention = deserializer.fieldValueToObject(ExternalId.class, message.getByName(SWAP_CONVENTION_FIELD));
      final SwapIndexConvention convention = new SwapIndexConvention(name, externalIdBundle, fixingTime, receiveLegConvention);
      final FudgeField uniqueIdMsg = message.getByName(UNIQUE_ID_FIELD);
      if (uniqueIdMsg != null) {
        convention.setUniqueId(deserializer.fieldValueToObject(UniqueId.class, uniqueIdMsg));
      }
View Full Code Here

   * @return the position, not null
   */
  protected ManageablePosition createPosition(BondSecurity security) {
    s_logger.info("Creating position {}", security);
    int shares = (RandomUtils.nextInt(490) + 10) * 10;
    ExternalId buid = security.getExternalIdBundle().getExternalId(ExternalSchemes.BLOOMBERG_BUID);
    ExternalIdBundle bundle;
    if (buid != null) {
      bundle = ExternalIdBundle.of(buid);
    } else {
      bundle = security.getExternalIdBundle();
View Full Code Here

    @Override
    public FRANode buildObject(final FudgeDeserializer deserializer, final FudgeMsg message) {
      final String curveNodeIdMapperName = message.getString(CURVE_MAPPER_ID_FIELD);
      final Tenor fixingStart = Tenor.of(Period.parse(message.getString(FIXING_START_FIELD)));
      final Tenor fixingEnd = Tenor.of(Period.parse(message.getString(FIXING_END_FIELD)));
      final ExternalId conventionId = deserializer.fieldValueToObject(ExternalId.class, message.getByName(CONVENTION_ID_FIELD));
      if (message.hasField(NAME_FIELD)) {
        final String name = message.getString(NAME_FIELD);
        return new FRANode(fixingStart, fixingEnd, conventionId, curveNodeIdMapperName, name);
      }
      return new FRANode(fixingStart, fixingEnd, conventionId, curveNodeIdMapperName);
View Full Code Here

    @Override
    public FXForwardNode buildObject(final FudgeDeserializer deserializer, final FudgeMsg message) {
      final Tenor startTenor = Tenor.of(Period.parse(message.getString(START_TENOR_FIELD)));
      final Tenor maturityTenor = Tenor.of(Period.parse(message.getString(MATURITY_TENOR_FIELD)));
      final ExternalId fxForwardConvention = deserializer.fieldValueToObject(ExternalId.class, message.getByName(CONVENTION_FIELD));
      final Currency payCurrency = Currency.of(message.getString(PAY_CURRENCY_FIELD));
      final Currency receiveCurrency = Currency.of(message.getString(RECEIVE_CURRENCY_FIELD));
      final String curveNodeIdMapperName = message.getString(CURVE_MAPPER_ID_FIELD);
      if (message.hasField(NAME_FIELD)) {
        final String name = message.getString(NAME_FIELD);
View Full Code Here

      @Override
      public EnergyFutureBean visitEnergyFutureSecurity(
        EnergyFutureSecurity security) {
        final EnergyFutureBean bean = createCommodityFutureBean(new EnergyFutureBean(), security);
        ExternalId underlying = security.getUnderlyingId();
        if (underlying != null) {
          bean.setUnderlying(externalIdToExternalIdBean(underlying));
        }
        return bean;
      }

      @Override
      public ForeignExchangeFutureBean visitFXFutureSecurity(
        FXFutureSecurity security) {
        final ForeignExchangeFutureBean bean = createFutureBean(new ForeignExchangeFutureBean(), security);
        bean.setNumerator(secMasterSession
          .getOrCreateCurrencyBean(security.getNumerator()
            .getCode()));
        bean.setDenominator(secMasterSession
          .getOrCreateCurrencyBean(security.getDenominator()
            .getCode()));
        bean.setUnitNumber(security.getMultiplicationFactor());
        return bean;
      }

      @Override
      public InterestRateFutureBean visitInterestRateFutureSecurity(
        InterestRateFutureSecurity security) {
        final InterestRateFutureBean bean = createFutureBean(new InterestRateFutureBean(), security);
        bean.setUnderlying(externalIdToExternalIdBean(security.getUnderlyingId()));
        return bean;
      }

      @Override
      public MetalFutureBean visitMetalFutureSecurity(
        MetalFutureSecurity security) {
        final MetalFutureBean bean = createCommodityFutureBean(new MetalFutureBean(), security);
        ExternalId underlying = security.getUnderlyingId();
        if (underlying != null) {
          bean.setUnderlying(externalIdToExternalIdBean(security.getUnderlyingId()));
        }
        return bean;
      }
View Full Code Here

    public RateFutureNode buildObject(final FudgeDeserializer deserializer, final FudgeMsg message) {
      final int futureNumber = message.getInt(FUTURE_NUMBER_FIELD);
      final Tenor startTenor = Tenor.of(Period.parse(message.getString(START_TENOR_FIELD)));
      final Tenor futureTenor = Tenor.of(Period.parse(message.getString(FUTURE_TENOR_FIELD)));
      final Tenor underlyingTenor = Tenor.of(Period.parse(message.getString(UNDERLYING_TENOR_FIELD)));
      final ExternalId futureConvention = deserializer.fieldValueToObject(ExternalId.class, message.getByName(FUTURE_CONVENTION_FIELD));
      final ExternalId underlyingConvention = deserializer.fieldValueToObject(ExternalId.class, message.getByName(UNDERLYING_CONVENTION_FIELD));
      final String curveNodeIdMapperName = message.getString(CURVE_MAPPER_ID_FIELD);
      if (message.hasField(NAME_FIELD)) {
        final String name = message.getString(NAME_FIELD);
        return new RateFutureNode(futureNumber, startTenor, futureTenor, underlyingTenor, futureConvention, underlyingConvention, curveNodeIdMapperName, name);
      }
View Full Code Here

TOP

Related Classes of com.opengamma.id.ExternalId

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.