diff --git a/pricenode/src/main/java/bisq/price/spot/ExchangeRateProvider.java b/pricenode/src/main/java/bisq/price/spot/ExchangeRateProvider.java index 85dc7d71da4..b753bc8bfd4 100644 --- a/pricenode/src/main/java/bisq/price/spot/ExchangeRateProvider.java +++ b/pricenode/src/main/java/bisq/price/spot/ExchangeRateProvider.java @@ -56,11 +56,11 @@ */ public abstract class ExchangeRateProvider extends PriceProvider> { - private static final Set supportedCryptoCurrencies = CurrencyUtil.getAllSortedCryptoCurrencies().stream() + public static final Set SUPPORTED_CRYPTO_CURRENCIES = CurrencyUtil.getAllSortedCryptoCurrencies().stream() .map(TradeCurrency::getCode) .collect(Collectors.toSet()); - private static final Set supportedFiatCurrencies = CurrencyUtil.getAllSortedFiatCurrencies().stream() + public static final Set SUPPORTED_FIAT_CURRENCIES = CurrencyUtil.getAllSortedFiatCurrencies().stream() .map(TradeCurrency::getCode) .collect(Collectors.toSet()); @@ -116,13 +116,13 @@ protected Set doGet(Class exchangeClass) { // Find the desired fiat pairs (pair format is BTC-FIAT) List desiredFiatPairs = allCurrencyPairsOnExchange.stream() .filter(cp -> cp.base.equals(Currency.BTC)) - .filter(cp -> supportedFiatCurrencies.contains(cp.counter.getCurrencyCode())) + .filter(cp -> SUPPORTED_FIAT_CURRENCIES.contains(cp.counter.getCurrencyCode())) .collect(Collectors.toList()); // Find the desired altcoin pairs (pair format is ALT-BTC) List desiredCryptoPairs = allCurrencyPairsOnExchange.stream() .filter(cp -> cp.counter.equals(Currency.BTC)) - .filter(cp -> supportedCryptoCurrencies.contains(cp.base.getCurrencyCode())) + .filter(cp -> SUPPORTED_CRYPTO_CURRENCIES.contains(cp.base.getCurrencyCode())) .collect(Collectors.toList()); // Retrieve in bulk all tickers offered by the exchange diff --git a/pricenode/src/test/java/bisq/price/AbstractExchangeRateProviderTest.java b/pricenode/src/test/java/bisq/price/AbstractExchangeRateProviderTest.java index 47855f0be5d..8bf1f2d78d9 100644 --- a/pricenode/src/test/java/bisq/price/AbstractExchangeRateProviderTest.java +++ b/pricenode/src/test/java/bisq/price/AbstractExchangeRateProviderTest.java @@ -48,25 +48,19 @@ private void checkProviderCurrencyPairs(Set retrievedExchangeRates .map(ExchangeRate::getCurrency) .collect(Collectors.toSet()); - Set supportedCryptoCurrencies = CurrencyUtil.getAllSortedCryptoCurrencies().stream() - .map(TradeCurrency::getCode) - .collect(Collectors.toSet()); - - Set supportedFiatCurrencies = CurrencyUtil.getAllSortedFiatCurrencies().stream() - .map(TradeCurrency::getCode) - .collect(Collectors.toSet()); - - Set supportedFiatCurrenciesRetrieved = supportedFiatCurrencies.stream() + Set supportedFiatCurrenciesRetrieved = ExchangeRateProvider.SUPPORTED_FIAT_CURRENCIES.stream() .filter(f -> retrievedRatesCurrencies.contains(f)) .collect(Collectors.toCollection(TreeSet::new)); log.info("Retrieved rates for supported fiat currencies: " + supportedFiatCurrenciesRetrieved); - Set supportedCryptoCurrenciesRetrieved = supportedCryptoCurrencies.stream() + Set supportedCryptoCurrenciesRetrieved = ExchangeRateProvider.SUPPORTED_CRYPTO_CURRENCIES.stream() .filter(c -> retrievedRatesCurrencies.contains(c)) .collect(Collectors.toCollection(TreeSet::new)); log.info("Retrieved rates for supported altcoins: " + supportedCryptoCurrenciesRetrieved); - Set supportedCurrencies = Sets.union(supportedCryptoCurrencies, supportedFiatCurrencies); + Set supportedCurrencies = Sets.union( + ExchangeRateProvider.SUPPORTED_CRYPTO_CURRENCIES, + ExchangeRateProvider.SUPPORTED_FIAT_CURRENCIES); Set unsupportedCurrencies = Sets.difference(retrievedRatesCurrencies, supportedCurrencies); assertTrue("Retrieved exchange rates contain unsupported currencies: " + unsupportedCurrencies,