Package com.opengamma.util.money

Examples of com.opengamma.util.money.Currency


    _cubeDefinitionSource = cubeDefinitionSource;
  }

  @Override
  VolatilityCubeKey getKey(ValueSpecification spec) {
    Currency currency = Currency.parse(spec.getTargetSpecification().getUniqueId().getValue());
    String cube = getSingleProperty(spec, ValuePropertyNames.CUBE);
    return new VolatilityCubeKey(currency, cube);
  }
View Full Code Here


    return matrix;
  }

  public static CurrencyMatrix createSyntheticConversionMatrix(final CurrencyPairs currencies) {
    final SimpleCurrencyMatrix matrix = new SimpleCurrencyMatrix();
    final Currency commonCross = Currency.USD;
    for (final CurrencyPair pair : currencies.getPairs()) {
      if (commonCross.equals(pair.getBase()) || commonCross.equals(pair.getCounter())) {
        matrix.setLiveData(pair.getCounter(), pair.getBase(),
            new ValueRequirement(MarketDataRequirementNames.MARKET_VALUE, ComputationTargetType.PRIMITIVE, ExternalId.of(ExternalSchemes.OG_SYNTHETIC_TICKER.getName(), pair.getBase().getCode() +
                pair.getCounter().getCode())));
      }
    }
    for (final CurrencyPair pair : currencies.getPairs()) {
      if (!commonCross.equals(pair.getBase()) && !commonCross.equals(pair.getCounter())) {
        matrix.setCrossConversion(pair.getCounter(), pair.getBase(), commonCross);
      }
    }
    dumpMatrix(matrix);
    return matrix;
View Full Code Here

  public static CurrencyPair parse(String pairStr) {
    ArgumentChecker.notNull(pairStr, "pairStr");
    if (pairStr.length() != 7) {
      throw new IllegalArgumentException("Currency pair format must be AAA/BBB");
    }
    Currency base = Currency.of(pairStr.substring(0, 3));
    Currency counter = Currency.of(pairStr.substring(4));
    return new CurrencyPair(base, counter);
  }
View Full Code Here

    return curveSpecConfig.getCashSecurity(tradeDate, tenor);
  }

  @Override
  public CashSecurity createSecurity() {
    final Currency currency = getRandomCurrency();
    final ExternalId region = ExternalSchemes.currencyRegionId(currency);
    final ZonedDateTime start = previousWorkingDay(ZonedDateTime.now().minusDays(getRandom(60) + 7), currency);
    final int length = getRandom(6) + 3;
    final ZonedDateTime maturity = nextWorkingDay(start.plusMonths(length), currency);
    final ConventionBundle convention = getConventionBundleSource().getConventionBundle(ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, currency.getCode() + "_GENERIC_CASH"));
    if (convention == null) {
      return null;
    }
    final DayCount dayCount = convention.getDayCount();
    final ExternalId cashRate = getCashRate(currency, start.toLocalDate(), Tenor.ofMonths(length));
View Full Code Here

    final Map<SwaptionSecurity, SwapSecurity> securities = new LinkedHashMap<>();
    final Random random = new Random(4567);
    for (int i = 0; i < SIZE; i++) {
      Pair<SwaptionSecurity, SwapSecurity> pair = null;
      try {
        final Currency ccy = CCYS[random.nextInt(CCYS.length)];
        final LocalDate tradeDate = getTradeDate(random, ccy);
        final Tenor swaptionExpiry = EXPIRIES[random.nextInt(EXPIRIES.length)];
        final Tenor swapMaturity = MATURITIES[random.nextInt(MATURITIES.length)];
        pair = makeSwaptionAndUnderlying(random, ccy, tradeDate, swaptionExpiry, swapMaturity);
      } catch (final Exception e) {
View Full Code Here

      new BloombergIdentifierProvider(getToolContext().getBloombergReferenceDataProvider()));
    loader.loadTimeSeries(externalIds, "UNKNOWN", "PX_LAST", LocalDate.now().minusYears(1), LocalDate.now());
  }

  private static List<ExternalId> getFXRateFor(final UnorderedCurrencyPair ccys) {
    final Currency firstCurrency = ccys.getFirstCurrency();
    final Currency secondCurrency = ccys.getSecondCurrency();
    final List<ExternalId> tickers = new ArrayList<>();
    tickers.add(ExternalSchemes.bloombergTickerSecurityId(firstCurrency.getCode() + " Curncy"));
    tickers.add(ExternalSchemes.bloombergTickerSecurityId(secondCurrency.getCode() + " Curncy"));
    tickers.add(ExternalSchemes.bloombergTickerSecurityId(firstCurrency.getCode() + secondCurrency.getCode() + " Curncy"));
    tickers.add(ExternalSchemes.bloombergTickerSecurityId(secondCurrency.getCode() + firstCurrency.getCode() + " Curncy"));
    return tickers;
  }
View Full Code Here

  }

  private FXForwardSecurity makeFXForward(final Random random, final UnorderedCurrencyPair ccys, final LocalDate tradeDate, final Tenor maturity) {
    final ZonedDateTime forwardDate = tradeDate.plus(maturity.getPeriod()).atStartOfDay().atZone(ZoneOffset.UTC);
    final double payAmount, receiveAmount;
    final Currency payCurrency, receiveCurrency;
    final double forwardRate;
    if (random.nextBoolean()) {
      payCurrency = ccys.getFirstCurrency();
      receiveCurrency = ccys.getSecondCurrency();
      final double spot = getSpotRate(CurrencyPair.of(payCurrency, receiveCurrency), tradeDate);
View Full Code Here

    return swapSecurity;
  }

  @Override
  public ForwardSwapSecurity createSecurity() {
    final Currency ccy = getRandomCurrency();
    final ZonedDateTime now = ZonedDateTime.now();
    final ZonedDateTime tradeDate = previousWorkingDay(now.minusDays(getRandom(getDaysTrading())), ccy);
    final Tenor forward = getRandom(FORWARDS);
    final ZonedDateTime forwardDate = nextWorkingDay(now.plus(forward.getPeriod()), ccy);
    ConventionBundle swapConvention = getConventionBundleSource().getConventionBundle(ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, ccy.getCode() + "_SWAP"));
    if (swapConvention == null) {
      s_logger.error("Couldn't get swap convention for {}", ccy.getCode());
      return null;
    }
    final Tenor maturity = getRandom(TENORS);
    // get the convention of the identifier of the initial rate
    ConventionBundle liborConvention = getConventionBundleSource().getConventionBundle(swapConvention.getSwapFloatingLegInitialRate());
View Full Code Here

  }

  @Override
  public SecurityEntryData buildObject(FudgeDeserializer deserializer, FudgeMsg msg) {
    ExternalId id = ExternalId.parse(msg.getString(EXTERNAL_ID_FIELD_NAME));
    Currency currency = Currency.of(msg.getString(CURRENCY_FIELD_NAME));
    LocalDate maturityDate = msg.getValue(LocalDate.class, MATURITY_DATE_FIELD_NAME);
    ExternalId factorSetId = ExternalId.parse(msg.getString(FACTOR_SET_EXTERNAL_ID_FIELD_NAME));
   
    SecurityEntryData data = new SecurityEntryData(id, currency, maturityDate, factorSetId);
    return data;
View Full Code Here

  public double forwardDeltaTheoretical(final ForexOptionDigital optionForex, final YieldCurveBundle curves) {
    ArgumentChecker.notNull(curves, "Curves");
    ArgumentChecker.isTrue(curves instanceof SmileDeltaTermStructureDataBundle, "Yield curve bundle should contain smile data");
    final SmileDeltaTermStructureDataBundle smile = (SmileDeltaTermStructureDataBundle) curves;
    final double paymentTime = optionForex.getUnderlyingForex().getPaymentTime();
    final Currency domesticCcy;
    final Currency foreignCcy;
    final double strike;
    final String foreignCurveName;
    final String domesticCurveName;
    boolean isCall;
    if (optionForex.payDomestic()) {
View Full Code Here

TOP

Related Classes of com.opengamma.util.money.Currency

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.