CryptowatchAdapters { public static ExchangeMetaData adaptToExchangeMetaData( ExchangeMetaData exchangeMetaData, List<CryptowatchAssetPair> assetPairs, List<CryptowatchAsset> assets) { Map<CurrencyPair, CurrencyPairMetaData> pairs = new HashMap<>(); Map<Currency, CurrencyMetaData> currencies = new HashMap<>(); if (exchangeMetaData != null) { pairs.putAll(exchangeMetaData.getCurrencyPairs()); currencies.putAll(exchangeMetaData.getCurrencies()); } pairs.putAll( assetPairs.stream() .filter(pair -> !pair.getSymbol().endsWith("futures")) .collect( Collectors.toMap( pair -> adaptToCurrencyPair(pair), pair -> adaptToCurrencyPairMetadata(pairs.get(adaptToCurrencyPair(pair))), (oldValue, newValue) -> newValue))); currencies.putAll( assets.stream() .collect( Collectors.toMap( asset -> adaptToCurrency(asset), asset -> adaptToCurrencyMetadata(currencies.get(adaptToCurrency(asset))), (oldValue, newValue) -> newValue))); return new ExchangeMetaData( pairs, currencies, exchangeMetaData == null ? null : exchangeMetaData.getPublicRateLimits(), exchangeMetaData == null ? null : exchangeMetaData.getPrivateRateLimits(), exchangeMetaData == null ? null : exchangeMetaData.isShareRateLimits()); }  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 adaptToExchangeMetaData() throws Exception { List<CryptowatchAssetPair> cryptowatchAssetPairs = TestUtils.getObject( "/org/knowm/xchange/cryptowatch/marketdata/example-pairs-results.json", CryptowatchAssetPairsResult.class) .getResult(); List<CryptowatchAsset> cryptowatchAssets = TestUtils.getObject( "/org/knowm/xchange/cryptowatch/marketdata/example-assets-results.json", CryptowatchAssetsResult.class) .getResult(); ExchangeMetaData originalExchangeMetaData = new ExchangeMetaData(new HashMap<>(), new HashMap<>(), null, null, null); ExchangeMetaData metaData = CryptowatchAdapters.adaptToExchangeMetaData( originalExchangeMetaData, cryptowatchAssetPairs, cryptowatchAssets); assertNotNull(metaData); assertEquals(2328, metaData.getCurrencyPairs().size()); assertEquals(725, metaData.getCurrencies().size()); }