Package com.opengamma.financial.currency

Examples of com.opengamma.financial.currency.CurrencyPair


    if (receiveCurveObject == null) {
      throw new OpenGammaRuntimeException("Could not get " + _receiveCurveName + " curve");
    }
    // TODO: The convention is only looked up here so that we can convert the spot rate; would be better to request the spot rate using the correct currency pair in the first place
    final CurrencyPairs currencyPairs = OpenGammaExecutionContext.getCurrencyPairsSource(executionContext).getCurrencyPairs(CurrencyPairs.DEFAULT_CURRENCY_PAIRS);
    final CurrencyPair currencyPair = currencyPairs.getCurrencyPair(payCurrency, receiveCurrency);
    final Currency currencyBase = currencyPair.getBase();
    final Object spotObject = inputs.getValue(ValueRequirementNames.SPOT_RATE);
    if (spotObject == null) {
      throw new OpenGammaRuntimeException("Could not get market data for spot rate");
    }
    double spot = (Double) spotObject;
View Full Code Here


   * @param currency2 The second currency.
   * @param currencyPairs The currency pairs.
   * @return The indicator.
   */
  public static boolean isInBaseQuoteOrder(final Currency currency1, final Currency currency2, final CurrencyPairs currencyPairs) {
    final CurrencyPair currencyPair = currencyPairs.getCurrencyPair(currency1, currency2);
    if (currencyPair.getBase().equals(currency1)) {
      return true;
    }
    return false;
  }
View Full Code Here

  public void readPairs() throws IOException {
    CurrencyPairsConfigDocumentLoader loader = new CurrencyPairsConfigDocumentLoader(null, null, null);
    String eurUsdStr = "EUR/USD";
    String gbpUsdStr = "GBP/USD";
    String usdCadStr = "USD/CAD";
    CurrencyPair eurUsd = CurrencyPair.parse(eurUsdStr);
    CurrencyPair gbpUsd = CurrencyPair.parse(gbpUsdStr);
    CurrencyPair usdCad = CurrencyPair.parse(usdCadStr);
    BufferedReader reader = new BufferedReader(new StringReader(eurUsdStr + "\n" + gbpUsdStr + "\n" + usdCadStr));
    ImmutableSet<CurrencyPair> pairs = ImmutableSet.of(eurUsd, gbpUsd, usdCad);
    AssertJUnit.assertEquals(pairs, loader.readPairs(reader));
  }
View Full Code Here

TOP

Related Classes of com.opengamma.financial.currency.CurrencyPair

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.