Examples of IborIndexConvention


Examples of com.opengamma.financial.convention.IborIndexConvention

        : now.toLocalDate();

    DepositConvention cashConvention = null;
    VanillaIborLegConvention floatLegConvention = null;
    SwapFixedLegConvention fixLegConvention = null;
    IborIndexConvention liborConvention = null;

    final int nNodes = specification.getNodes().size();
    final double[] marketDataForCurve = new double[nNodes];
    final ISDAInstrumentTypes[] instruments = new ISDAInstrumentTypes[nNodes];
    final Period[] tenors = new Period[nNodes];
    int k = 0;
    for (final CurveNodeWithIdentifier node : specification.getNodes()) {
      final Double marketData = snapshot.getDataPoint(node.getIdentifier());
      if (marketData == null) {
        throw new OpenGammaRuntimeException("Could not get market data for " + node.getIdentifier());
      }
      marketDataForCurve[k] = marketData;
      tenors[k] = node.getCurveNode().getResolvedMaturity().getPeriod();
      if (node.getCurveNode() instanceof CashNode) {
        instruments[k] = ISDAInstrumentTypes.MoneyMarket;
        final ExternalId cashConventionId = ((CashNode) node.getCurveNode()).getConvention();
        if (cashConvention == null) {
          cashConvention = conventionSource.getConvention(DepositConvention.class, cashConventionId);
        } else if (!cashConvention.getExternalIdBundle().contains(cashConventionId)) {
          throw new OpenGammaRuntimeException("Got 2 types of cash convention: " + cashConvention.getExternalIdBundle() + " " + cashConventionId);
        }
      } else if (node.getCurveNode() instanceof SwapNode) {
        instruments[k] = ISDAInstrumentTypes.Swap;
        final ExternalId payConventionId = ((SwapNode) node.getCurveNode()).getPayLegConvention();
        final Convention payConvention = conventionSource.getConvention(payConventionId);
        if (payConvention == null) {
          throw new OpenGammaRuntimeException("Convention '" + payConventionId + "' not found");
        }
        final ExternalId receiveConventionId = ((SwapNode) node.getCurveNode()).getReceiveLegConvention();
        final Convention receiveConvention = conventionSource.getConvention(receiveConventionId);
        if (receiveConvention == null) {
          throw new OpenGammaRuntimeException("Convention '" + receiveConventionId + "' not found");
        }
        if (payConvention instanceof VanillaIborLegConvention) {  // float leg
          if (floatLegConvention == null) {
            floatLegConvention = (VanillaIborLegConvention) payConvention;
          } else if (!floatLegConvention.getExternalIdBundle().contains(payConventionId)) {
            throw new OpenGammaRuntimeException("Got 2 types of float leg convention: " + payConvention.getExternalIdBundle() + " " + payConventionId);
          }
        } else if (payConvention instanceof SwapFixedLegConvention) {
          if (fixLegConvention == null) {
            fixLegConvention = (SwapFixedLegConvention) payConvention;
          } else if (!fixLegConvention.getExternalIdBundle().contains(payConventionId)) {
            throw new OpenGammaRuntimeException("Got 2 types of fixed leg convention: " + payConvention.getExternalIdBundle() + " " + payConventionId);
          }
        } else {
          throw new OpenGammaRuntimeException("Unexpected swap convention type: " + payConvention);
        }
        if (receiveConvention instanceof VanillaIborLegConvention) {  // float leg
          if (floatLegConvention == null) {
            floatLegConvention = (VanillaIborLegConvention) receiveConvention;
          } else if (!floatLegConvention.getExternalIdBundle().contains(receiveConventionId)) {
            throw new OpenGammaRuntimeException("Got 2 types of float leg convention: " + receiveConvention.getExternalIdBundle() + " " + receiveConventionId);
          }
        } else if (receiveConvention instanceof SwapFixedLegConvention) {
          if (fixLegConvention == null) {
            fixLegConvention = (SwapFixedLegConvention) receiveConvention;
          } else if (!fixLegConvention.getExternalIdBundle().contains(receiveConventionId)) {
            throw new OpenGammaRuntimeException("Got 2 types of fixed leg convention: " + receiveConvention.getExternalIdBundle() + " " + receiveConventionId);
          }
        } else {
          throw new OpenGammaRuntimeException("Unexpected swap convention type: " + receiveConvention);
        }
      } else {
        throw new OpenGammaRuntimeException("Can't handle node type " + node.getCurveNode().getClass().getSimpleName() + " at node " + node);
      }
      k++;
    }

    ArgumentChecker.notNull(cashConvention, "Cash convention");
    ArgumentChecker.notNull(floatLegConvention, "Floating leg convention");
    ArgumentChecker.notNull(fixLegConvention, "Fixed leg convention");
    liborConvention = conventionSource.getConvention(IborIndexConvention.class, floatLegConvention.getIborIndexConvention());
    ArgumentChecker.notNull(liborConvention, floatLegConvention.getIborIndexConvention().toString());

    final ISDACompliantYieldCurve yieldCurve = ISDACompliantYieldCurveBuild.build(spotDate, spotDate, instruments, tenors, marketDataForCurve, cashConvention.getDayCount(),
        fixLegConvention.getDayCount(), fixLegConvention.getPaymentTenor().getPeriod(), ACT_365, liborConvention.getBusinessDayConvention());

    final ValueProperties properties = desiredValue.getConstraints().copy()
        .with(ISDAFunctionConstants.ISDA_CURVE_DATE, spotDate.toString())
        .get();
View Full Code Here

Examples of com.opengamma.financial.convention.IborIndexConvention

                throw new OpenGammaRuntimeException("Convention " + ibor.getConvention() + " was null");
              }
              if (!(convention instanceof IborIndexConvention)) {
                throw new OpenGammaRuntimeException("Expecting convention of type IborIndexConvention; have " + convention.getClass());
              }
              final IborIndexConvention iborIndexConvention = (IborIndexConvention) convention;
              final int spotLag = iborIndexConvention.getSettlementDays();
              iborIndex.add(new IborIndex(iborIndexConvention.getCurrency(), ibor.getTenor().getPeriod(), spotLag, iborIndexConvention.getDayCount(),
                  iborIndexConvention.getBusinessDayConvention(), iborIndexConvention.isIsEOM(), iborIndexConvention.getName()));
            } else if (type instanceof OvernightCurveTypeConfiguration) {
              final OvernightCurveTypeConfiguration overnight = (OvernightCurveTypeConfiguration) type;
              final Convention convention = conventionSource.getConvention(overnight.getConvention());
              if (convention == null) {
                throw new OpenGammaRuntimeException("Convention " + overnight.getConvention() + " was null");
View Full Code Here

Examples of com.opengamma.financial.convention.IborIndexConvention

      // there's a convention link in the security.
      final InterestRateFutureConvention convention = conventionSource.getConvention(InterestRateFutureConvention.class, ExternalId.of(SCHEME_NAME, EURODOLLAR_FUTURE));
      if (convention == null) {
        throw new OpenGammaRuntimeException("Could not get interest rate future convention with id " + ExternalId.of(SCHEME_NAME, EURODOLLAR_FUTURE));
      }
      final IborIndexConvention iborIndexConvention = conventionSource.getConvention(IborIndexConvention.class, convention.getIndexConvention());
      final Period period = Period.ofMonths(3); //TODO
      final int spotLag = iborIndexConvention.getSettlementDays();
      final IborIndex iborIndex = new IborIndex(currency, period, spotLag, iborIndexConvention.getDayCount(),
          iborIndexConvention.getBusinessDayConvention(), iborIndexConvention.isIsEOM(), iborIndexConvention.getName());
      final BlackSTIRFuturesSmileProvider blackData = new BlackSTIRFuturesSmileProvider(data, volatilitySurface.getSurface(), iborIndex);
      return blackData;
    }
View Full Code Here

Examples of com.opengamma.financial.convention.IborIndexConvention

    protected BlackSmileCapProviderInterface getBlackSurface(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final FXMatrix fxMatrix) {
      final ConventionSource conventionSource = OpenGammaExecutionContext.getConventionSource(executionContext);
      final CapFloorSecurity security = (CapFloorSecurity) target.getTrade().getSecurity();
      final Currency currency = FinancialSecurityUtils.getCurrency(security);
      final String iborConventionName = getConventionName(currency, IBOR);
      final IborIndexConvention iborIndexConvention = conventionSource.getConvention(IborIndexConvention.class, ExternalId.of(SCHEME_NAME, iborConventionName));
      if (iborIndexConvention == null) {
        throw new OpenGammaRuntimeException("Could not get ibor index convention with the identifier " + ExternalId.of(SCHEME_NAME, iborConventionName));
      }
      final Frequency freqIbor = security.getFrequency();
      final Period tenorIbor = getTenor(freqIbor);
      final int spotLag = iborIndexConvention.getSettlementDays();
      final IborIndex iborIndex = new IborIndex(currency, tenorIbor, spotLag, iborIndexConvention.getDayCount(),
          iborIndexConvention.getBusinessDayConvention(), iborIndexConvention.isIsEOM(), iborIndexConvention.getName());
      final MulticurveProviderInterface data = getMergedProviders(inputs, fxMatrix);
      final VolatilitySurface volatilitySurface = (VolatilitySurface) inputs.getValue(INTERPOLATED_VOLATILITY_SURFACE);
      final BlackSmileCapParameters parameters = new BlackSmileCapParameters(volatilitySurface.getSurface(), iborIndex);
      final BlackSmileCapProvider blackData = new BlackSmileCapProvider(data, parameters);
      return blackData;
View Full Code Here

Examples of com.opengamma.financial.convention.IborIndexConvention

              } catch (final IllegalArgumentException e) {
                throw new OpenGammaRuntimeException("Cannot handle reference type " + reference + " for discounting curves");
              }
            } else if (type instanceof IborCurveTypeConfiguration) {
              final IborCurveTypeConfiguration ibor = (IborCurveTypeConfiguration) type;
              final IborIndexConvention iborIndexConvention = conventionSource.getConvention(IborIndexConvention.class, ibor.getConvention());
              if (iborIndexConvention == null) {
                throw new OpenGammaRuntimeException("Ibor index convention called " + ibor.getConvention() + " was null");
              }
              final int spotLag = iborIndexConvention.getSettlementDays();
              iborIndex.add(new IborIndex(iborIndexConvention.getCurrency(), ibor.getTenor().getPeriod(), spotLag, iborIndexConvention.getDayCount(),
                  iborIndexConvention.getBusinessDayConvention(), iborIndexConvention.isIsEOM(), iborIndexConvention.getName()));
            } else if (type instanceof OvernightCurveTypeConfiguration) {
              final OvernightCurveTypeConfiguration overnight = (OvernightCurveTypeConfiguration) type;
              final OvernightIndexConvention overnightConvention = conventionSource.getConvention(OvernightIndexConvention.class, overnight.getConvention());
              if (overnightConvention == null) {
                throw new OpenGammaRuntimeException("Overnight convention called " + overnight.getConvention() + " was null");
View Full Code Here

Examples of com.opengamma.financial.convention.IborIndexConvention

              } catch (final IllegalArgumentException e) {
                throw new OpenGammaRuntimeException("Cannot handle reference type " + reference + " for discounting curves");
              }
            } else if (type instanceof IborCurveTypeConfiguration) {
              final IborCurveTypeConfiguration ibor = (IborCurveTypeConfiguration) type;
              final IborIndexConvention iborIndexConvention = conventionSource.getConvention(IborIndexConvention.class, ibor.getConvention());
              if (iborIndexConvention == null) {
                throw new OpenGammaRuntimeException("Ibor index convention called " + ibor.getConvention() + " was null");
              }
              final int spotLag = iborIndexConvention.getSettlementDays();
              iborIndex.add(new IborIndex(iborIndexConvention.getCurrency(), ibor.getTenor().getPeriod(), spotLag, iborIndexConvention.getDayCount(),
                  iborIndexConvention.getBusinessDayConvention(), iborIndexConvention.isIsEOM(), iborIndexConvention.getName()));
            } else if (type instanceof OvernightCurveTypeConfiguration) {
              final OvernightCurveTypeConfiguration overnight = (OvernightCurveTypeConfiguration) type;
              final OvernightIndexConvention overnightConvention = conventionSource.getConvention(OvernightIndexConvention.class, overnight.getConvention());
              if (overnightConvention == null) {
                throw new OpenGammaRuntimeException("Overnight convention called " + overnight.getConvention() + " was null");
View Full Code Here

Examples of com.opengamma.financial.convention.IborIndexConvention

  private static final DayCount ACT_365 = DayCountFactory.INSTANCE.getDayCount("Actual/365");
  private static final ExternalId GB = ExternalSchemes.financialRegionId("GB");

  public static synchronized void addFixedIncomeInstrumentConventions(final InMemoryConventionMaster conventionMaster) {
    final String liborConventionName = getConventionName(Currency.GBP, LIBOR);
    final Convention liborIndex = new IborIndexConvention(liborConventionName, getIds(Currency.GBP, LIBOR), ACT_365, MODIFIED_FOLLOWING, 0, true, Currency.GBP,
        LocalTime.of(11, 00), "GB", GB, GB, "");
   
    // Convention add
    conventionMaster.add(liborIndex);
  }
View Full Code Here

Examples of com.opengamma.financial.convention.IborIndexConvention

    final String priceIndexName = getConventionName(Currency.USD, PRICE_INDEX);
    final String swapIndexConventionName = getConventionName(Currency.USD, SWAP_INDEX);
    final ExternalId liborConventionId = ExternalId.of(SCHEME_NAME, liborConventionName);
    final ExternalId overnightConventionId = ExternalId.of(SCHEME_NAME, overnightConventionName);
    final ExternalId priceIndexId = ExternalId.of(SCHEME_NAME, priceIndexName);
    final Convention liborConvention = new IborIndexConvention(liborConventionName, getIds(Currency.USD, LIBOR), ACT_360, MODIFIED_FOLLOWING, 2, true, Currency.USD,
        LocalTime.of(11, 00), "US", NYLON, US, "");
    final Convention overnightConvention = new OvernightIndexConvention(overnightConventionName, getIds(Currency.USD, OVERNIGHT), ACT_360, 1, Currency.USD, US);
   
    // Deposit
    final DepositConvention depositConvention = new DepositConvention(depositConventionName, getIds(Currency.USD, DEPOSIT), ACT_360, MODIFIED_FOLLOWING, 2, true, Currency.USD, US);
View Full Code Here

Examples of com.opengamma.financial.convention.IborIndexConvention

    final String onIndexName = getConventionName(Currency.AUD, OVERNIGHT);
    final ExternalId onIndexId = ExternalId.of(SCHEME_NAME, onIndexName);
    final Convention onIndex = new OvernightIndexConvention(onIndexName, getIds(Currency.AUD, OVERNIGHT), ACT_365, 0, Currency.AUD, AU);
    // Index BBSW
    final String bbswConventionName = getConventionName(Currency.AUD, BBSW);
    final Convention bbswIndex = new IborIndexConvention(bbswConventionName, getIds(Currency.AUD, BBSW), ACT_365, MODIFIED_FOLLOWING, 2, true, Currency.AUD,
        LocalTime.of(11, 00), "AU", AU, AU, "");
    final ExternalId bbswConventionId = ExternalId.of(SCHEME_NAME, bbswConventionName);
    // Deposit
    final String depositONConventionName = getConventionName(Currency.AUD, DEPOSIT_ON);
    final DepositConvention depositONConvention = new DepositConvention(depositONConventionName, getIds(Currency.AUD, DEPOSIT_ON), ACT_365, FOLLOWING, 0, false, Currency.AUD, AU);
View Full Code Here

Examples of com.opengamma.financial.convention.IborIndexConvention

    assertEquals(convention, cycleObject(FXSpotConvention.class, convention));
  }

  @Test
  public void testIborIndexConvention() {
    final IborIndexConvention convention = new IborIndexConvention("EUR Deposit", ExternalIdBundle.of(InMemoryConventionBundleMaster.simpleNameSecurityId("EUR Deposit")),
        DayCountFactory.INSTANCE.getDayCount("Act/365"), BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention("Following"), 2, true,
        Currency.EUR, LocalTime.of(11, 0), "EU", ExternalId.of("Test", "EU"), ExternalId.of("Test", "EU"), "Page");
    convention.setUniqueId(UniqueId.of("Test", "1234567"));
    assertEquals(convention, cycleObject(IborIndexConvention.class, convention));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.