CryptowatchAdapters { public static CurrencyPair adaptToCurrencyPair(CryptowatchAssetPair pair) { CryptowatchAsset base = pair.getBase(); CryptowatchAsset quote = pair.getQuote(); Currency baseCurrency = Currency.getInstance(base.getSymbol()); Currency counterCurrency = Currency.getInstance(quote.getSymbol()); return new CurrencyPair(baseCurrency, counterCurrency); }  static ExchangeMetaData adaptToExchangeMetaData(
      ExchangeMetaData exchangeMetaData,
      List<CryptowatchAssetPair> assetPairs,
      List<CryptowatchAsset> assets); static CurrencyPair adaptToCurrencyPair(CryptowatchAssetPair pair); static OrderBook adaptToOrderbook(CryptowatchOrderBook book, CurrencyPair currencyPair); static Trades adaptToTrades(
      List<CryptowatchTrade> cryptowatchTrades, CurrencyPair currencyPair); static String adaptCurrencyPair(CurrencyPair pair);  }
@Test public void adaptToCurrencyPair1STBTC() throws IOException { List<CryptowatchAssetPair> cryptowatchAssetPairs = TestUtils.getObject( "/org/knowm/xchange/cryptowatch/marketdata/example-pairs-results.json", CryptowatchAssetPairsResult.class) .getResult(); CryptowatchAssetPair assetPair = cryptowatchAssetPairs.stream() .filter(pair -> pair.getSymbol().equals("1stbtc")) .findFirst() .orElse(null); CurrencyPair currencyPair = CryptowatchAdapters.adaptToCurrencyPair(assetPair); assertNotNull(currencyPair); assertEquals("1ST", currencyPair.base.getCurrencyCode()); assertEquals("BTC", currencyPair.counter.getCurrencyCode()); }
@Test public void adaptToCurrencyPairBTCEUR() throws IOException { List<CryptowatchAssetPair> cryptowatchAssetPairs = TestUtils.getObject( "/org/knowm/xchange/cryptowatch/marketdata/example-pairs-results.json", CryptowatchAssetPairsResult.class) .getResult(); CryptowatchAssetPair assetPair = cryptowatchAssetPairs.stream() .filter(pair -> pair.getSymbol().equals("btceur")) .findFirst() .orElse(null); CurrencyPair currencyPair = CryptowatchAdapters.adaptToCurrencyPair(assetPair); assertNotNull(currencyPair); assertEquals("BTC", currencyPair.base.getCurrencyCode()); assertEquals("EUR", currencyPair.counter.getCurrencyCode()); }