From 1c05e5d9902d0ff69780365a0c5fa392c070fefd Mon Sep 17 00:00:00 2001 From: jmacxx <47253594+jmacxx@users.noreply.github.com> Date: Tue, 22 Jun 2021 14:40:09 -0500 Subject: [PATCH] PriceNode: exclude currencies via config --- build.gradle | 1 + .../bisq/price/spot/ExchangeRateProvider.java | 59 +++++++++++--- .../bisq/price/spot/providers/BTCMarkets.java | 5 +- .../bisq/price/spot/providers/Binance.java | 5 +- .../bisq/price/spot/providers/Bitbay.java | 5 +- .../price/spot/providers/BitcoinAverage.java | 5 +- .../bisq/price/spot/providers/Bitfinex.java | 5 +- .../bisq/price/spot/providers/Bitflyer.java | 5 +- .../bisq/price/spot/providers/Bitstamp.java | 5 +- .../bisq/price/spot/providers/CoinGecko.java | 11 +-- .../price/spot/providers/CoinMarketCap.java | 5 +- .../bisq/price/spot/providers/Coinone.java | 5 +- .../price/spot/providers/Coinpaprika.java | 7 +- .../java/bisq/price/spot/providers/Exmo.java | 5 +- .../java/bisq/price/spot/providers/Huobi.java | 5 +- .../spot/providers/IndependentReserve.java | 5 +- .../bisq/price/spot/providers/Kraken.java | 5 +- .../java/bisq/price/spot/providers/Luno.java | 5 +- .../price/spot/providers/MercadoBitcoin.java | 5 +- .../bisq/price/spot/providers/Paribu.java | 5 +- .../bisq/price/spot/providers/Poloniex.java | 5 +- .../bisq/price/spot/providers/Quoine.java | 5 +- .../src/main/resources/application.properties | 2 + .../AbstractExchangeRateProviderTest.java | 12 +-- .../price/spot/ExchangeRateServiceTest.java | 80 ++++++++++++++++++- .../price/spot/providers/BTCMarketsTest.java | 4 +- .../price/spot/providers/BinanceTest.java | 4 +- .../bisq/price/spot/providers/BitbayTest.java | 4 +- .../price/spot/providers/BitfinexTest.java | 4 +- .../price/spot/providers/BitflyerTest.java | 4 +- .../price/spot/providers/BitstampTest.java | 4 +- .../price/spot/providers/CoinGeckoTest.java | 4 +- .../price/spot/providers/CoinoneTest.java | 4 +- .../price/spot/providers/CoinpaprikaTest.java | 4 +- .../bisq/price/spot/providers/ExmoTest.java | 4 +- .../bisq/price/spot/providers/HuobiTest.java | 4 +- .../providers/IndependentReserveTest.java | 4 +- .../bisq/price/spot/providers/KrakenTest.java | 4 +- .../bisq/price/spot/providers/LunoTest.java | 4 +- .../spot/providers/MercadoBitcoinTest.java | 4 +- .../bisq/price/spot/providers/ParibuTest.java | 4 +- .../price/spot/providers/PoloniexTest.java | 4 +- .../bisq/price/spot/providers/QuoineTest.java | 4 +- 43 files changed, 251 insertions(+), 83 deletions(-) diff --git a/build.gradle b/build.gradle index 34dea2431c..ee043f5c80 100644 --- a/build.gradle +++ b/build.gradle @@ -536,6 +536,7 @@ configure(project(':pricenode')) { testRuntime("org.junit.jupiter:junit-jupiter-engine:$jupiterVersion") testCompileOnly "org.projectlombok:lombok:$lombokVersion" testAnnotationProcessor "org.projectlombok:lombok:$lombokVersion" + testCompile "org.mockito:mockito-core:$mockitoVersion" } test { diff --git a/pricenode/src/main/java/bisq/price/spot/ExchangeRateProvider.java b/pricenode/src/main/java/bisq/price/spot/ExchangeRateProvider.java index b15cd5faed..4af9e886b9 100644 --- a/pricenode/src/main/java/bisq/price/spot/ExchangeRateProvider.java +++ b/pricenode/src/main/java/bisq/price/spot/ExchangeRateProvider.java @@ -33,11 +33,14 @@ import org.knowm.xchange.service.marketdata.MarketDataService; import org.knowm.xchange.service.marketdata.params.CurrencyPairsParam; import org.knowm.xchange.service.marketdata.params.Params; +import org.springframework.core.env.Environment; + import java.time.Duration; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Date; @@ -59,21 +62,55 @@ import java.util.stream.Stream; */ public abstract class ExchangeRateProvider extends PriceProvider> { - public static final Set SUPPORTED_CRYPTO_CURRENCIES = CurrencyUtil.getAllSortedCryptoCurrencies().stream() - .map(TradeCurrency::getCode) - .collect(Collectors.toSet()); - - public static final Set SUPPORTED_FIAT_CURRENCIES = CurrencyUtil.getAllSortedFiatCurrencies().stream() - .map(TradeCurrency::getCode) - .collect(Collectors.toSet()); - + private static Set SUPPORTED_CRYPTO_CURRENCIES = new HashSet<>(); + private static Set SUPPORTED_FIAT_CURRENCIES = new HashSet<>(); private final String name; private final String prefix; + private final Environment env; - public ExchangeRateProvider(String name, String prefix, Duration refreshInterval) { + public ExchangeRateProvider(Environment env, String name, String prefix, Duration refreshInterval) { super(refreshInterval); this.name = name; this.prefix = prefix; + this.env = env; + } + + public Set getSupportedFiatCurrencies() { + if (SUPPORTED_FIAT_CURRENCIES.size() == 0) { // one-time initialization + List excludedFiatCurrencies = + Arrays.asList(env.getProperty("bisq.price.fiatcurrency.excluded", "") + .toUpperCase().trim().split("\\s*,\\s*")); + String validatedExclusionList = excludedFiatCurrencies.stream() + .filter(ccy -> ccy.length() > 0) + .filter(CurrencyUtil::isFiatCurrency) + .collect(Collectors.toList()).toString(); + SUPPORTED_FIAT_CURRENCIES = CurrencyUtil.getAllSortedFiatCurrencies().stream() + .map(TradeCurrency::getCode) + .filter(ccy -> !validatedExclusionList.contains(ccy.toUpperCase())) + .collect(Collectors.toSet()); + log.info("fiat currencies excluded: {}", validatedExclusionList); + log.info("fiat currencies supported: {}", SUPPORTED_FIAT_CURRENCIES.size()); + } + return SUPPORTED_FIAT_CURRENCIES; + } + + public Set getSupportedCryptoCurrencies() { + if (SUPPORTED_CRYPTO_CURRENCIES.size() == 0) { // one-time initialization + List excludedCryptoCurrencies = + Arrays.asList(env.getProperty("bisq.price.cryptocurrency.excluded", "") + .toUpperCase().trim().split("\\s*,\\s*")); + String validatedExclusionList = excludedCryptoCurrencies.stream() + .filter(ccy -> ccy.length() > 0) + .filter(CurrencyUtil::isCryptoCurrency) + .collect(Collectors.toList()).toString(); + SUPPORTED_CRYPTO_CURRENCIES = CurrencyUtil.getAllSortedCryptoCurrencies().stream() + .map(TradeCurrency::getCode) + .filter(ccy -> !validatedExclusionList.contains(ccy.toUpperCase())) + .collect(Collectors.toSet()); + log.info("crypto currencies excluded: {}", validatedExclusionList); + log.info("crypto currencies supported: {}", SUPPORTED_CRYPTO_CURRENCIES.size()); + } + return SUPPORTED_CRYPTO_CURRENCIES; } public String getName() { @@ -119,13 +156,13 @@ public abstract class ExchangeRateProvider extends PriceProvider desiredFiatPairs = allCurrencyPairsOnExchange.stream() .filter(cp -> cp.base.equals(Currency.BTC)) - .filter(cp -> SUPPORTED_FIAT_CURRENCIES.contains(cp.counter.getCurrencyCode())) + .filter(cp -> getSupportedFiatCurrencies().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 -> SUPPORTED_CRYPTO_CURRENCIES.contains(cp.base.getCurrencyCode())) + .filter(cp -> getSupportedCryptoCurrencies().contains(cp.base.getCurrencyCode())) .collect(Collectors.toList()); // Retrieve in bulk all tickers offered by the exchange diff --git a/pricenode/src/main/java/bisq/price/spot/providers/BTCMarkets.java b/pricenode/src/main/java/bisq/price/spot/providers/BTCMarkets.java index 41efdbd58e..e9b8e84335 100644 --- a/pricenode/src/main/java/bisq/price/spot/providers/BTCMarkets.java +++ b/pricenode/src/main/java/bisq/price/spot/providers/BTCMarkets.java @@ -22,6 +22,7 @@ import bisq.price.spot.ExchangeRateProvider; import org.knowm.xchange.btcmarkets.BTCMarketsExchange; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import java.time.Duration; @@ -31,8 +32,8 @@ import java.util.Set; @Component class BTCMarkets extends ExchangeRateProvider { - public BTCMarkets() { - super("BTCMARKETS", "btcmarkets", Duration.ofMinutes(1)); + public BTCMarkets(Environment env) { + super(env, "BTCMARKETS", "btcmarkets", Duration.ofMinutes(1)); } @Override diff --git a/pricenode/src/main/java/bisq/price/spot/providers/Binance.java b/pricenode/src/main/java/bisq/price/spot/providers/Binance.java index c94107d1ea..d630b80813 100644 --- a/pricenode/src/main/java/bisq/price/spot/providers/Binance.java +++ b/pricenode/src/main/java/bisq/price/spot/providers/Binance.java @@ -22,6 +22,7 @@ import bisq.price.spot.ExchangeRateProvider; import org.knowm.xchange.binance.BinanceExchange; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import java.time.Duration; @@ -31,8 +32,8 @@ import java.util.Set; @Component class Binance extends ExchangeRateProvider { - public Binance() { - super("BINANCE", "binance", Duration.ofMinutes(1)); + public Binance(Environment env) { + super(env, "BINANCE", "binance", Duration.ofMinutes(1)); } @Override diff --git a/pricenode/src/main/java/bisq/price/spot/providers/Bitbay.java b/pricenode/src/main/java/bisq/price/spot/providers/Bitbay.java index 32e82b377f..d9b42ce1f9 100644 --- a/pricenode/src/main/java/bisq/price/spot/providers/Bitbay.java +++ b/pricenode/src/main/java/bisq/price/spot/providers/Bitbay.java @@ -22,6 +22,7 @@ import bisq.price.spot.ExchangeRateProvider; import org.knowm.xchange.bitbay.BitbayExchange; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import java.time.Duration; @@ -31,8 +32,8 @@ import java.util.Set; @Component class Bitbay extends ExchangeRateProvider { - public Bitbay() { - super("BITBAY", "bitbay", Duration.ofMinutes(1)); + public Bitbay(Environment env) { + super(env, "BITBAY", "bitbay", Duration.ofMinutes(1)); } @Override diff --git a/pricenode/src/main/java/bisq/price/spot/providers/BitcoinAverage.java b/pricenode/src/main/java/bisq/price/spot/providers/BitcoinAverage.java index b5b04ad09e..db33f9da70 100644 --- a/pricenode/src/main/java/bisq/price/spot/providers/BitcoinAverage.java +++ b/pricenode/src/main/java/bisq/price/spot/providers/BitcoinAverage.java @@ -20,6 +20,7 @@ package bisq.price.spot.providers; import bisq.price.spot.ExchangeRate; import bisq.price.spot.ExchangeRateProvider; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import java.time.Duration; @@ -34,12 +35,12 @@ import java.util.Set; @Component class BitcoinAverage extends ExchangeRateProvider { - public BitcoinAverage() { + public BitcoinAverage(Environment env) { // Simulate a deactivated BitcoinAverage provider // We still need the class to exist and be registered as a provider though, // because the returned data structure must contain the "btcAverageTs" key // for backward compatibility with Bisq clients which hardcode that key - super("BA", "btcAverage", Duration.ofMinutes(100)); + super(env, "BA", "btcAverage", Duration.ofMinutes(100)); } /** diff --git a/pricenode/src/main/java/bisq/price/spot/providers/Bitfinex.java b/pricenode/src/main/java/bisq/price/spot/providers/Bitfinex.java index e958d52232..cc8f62f395 100644 --- a/pricenode/src/main/java/bisq/price/spot/providers/Bitfinex.java +++ b/pricenode/src/main/java/bisq/price/spot/providers/Bitfinex.java @@ -22,6 +22,7 @@ import bisq.price.spot.ExchangeRateProvider; import org.knowm.xchange.bitfinex.BitfinexExchange; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import java.time.Duration; @@ -31,8 +32,8 @@ import java.util.Set; @Component class Bitfinex extends ExchangeRateProvider { - public Bitfinex() { - super("BITFINEX", "bitfinex", Duration.ofMinutes(1)); + public Bitfinex(Environment env) { + super(env, "BITFINEX", "bitfinex", Duration.ofMinutes(1)); } @Override diff --git a/pricenode/src/main/java/bisq/price/spot/providers/Bitflyer.java b/pricenode/src/main/java/bisq/price/spot/providers/Bitflyer.java index e5a78f7849..c2532847fb 100644 --- a/pricenode/src/main/java/bisq/price/spot/providers/Bitflyer.java +++ b/pricenode/src/main/java/bisq/price/spot/providers/Bitflyer.java @@ -22,6 +22,7 @@ import bisq.price.spot.ExchangeRateProvider; import org.knowm.xchange.bitflyer.BitflyerExchange; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import java.time.Duration; @@ -31,8 +32,8 @@ import java.util.Set; @Component class Bitflyer extends ExchangeRateProvider { - public Bitflyer() { - super("BITFLYER", "bitflyer", Duration.ofMinutes(1)); + public Bitflyer(Environment env) { + super(env, "BITFLYER", "bitflyer", Duration.ofMinutes(1)); } @Override diff --git a/pricenode/src/main/java/bisq/price/spot/providers/Bitstamp.java b/pricenode/src/main/java/bisq/price/spot/providers/Bitstamp.java index ed130aa15d..798f6aa95c 100644 --- a/pricenode/src/main/java/bisq/price/spot/providers/Bitstamp.java +++ b/pricenode/src/main/java/bisq/price/spot/providers/Bitstamp.java @@ -22,6 +22,7 @@ import bisq.price.spot.ExchangeRateProvider; import org.knowm.xchange.bitstamp.BitstampExchange; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import java.time.Duration; @@ -31,8 +32,8 @@ import java.util.Set; @Component class Bitstamp extends ExchangeRateProvider { - public Bitstamp() { - super("BITSTAMP", "bitstamp", Duration.ofMinutes(1)); + public Bitstamp(Environment env) { + super(env, "BITSTAMP", "bitstamp", Duration.ofMinutes(1)); } @Override diff --git a/pricenode/src/main/java/bisq/price/spot/providers/CoinGecko.java b/pricenode/src/main/java/bisq/price/spot/providers/CoinGecko.java index aaed910696..556001fc37 100644 --- a/pricenode/src/main/java/bisq/price/spot/providers/CoinGecko.java +++ b/pricenode/src/main/java/bisq/price/spot/providers/CoinGecko.java @@ -22,6 +22,7 @@ import bisq.price.spot.ExchangeRateProvider; import bisq.price.util.coingecko.CoinGeckoMarketData; import org.springframework.core.ParameterizedTypeReference; +import org.springframework.core.env.Environment; import org.springframework.http.RequestEntity; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; @@ -44,8 +45,8 @@ class CoinGecko extends ExchangeRateProvider { private final RestTemplate restTemplate = new RestTemplate(); - public CoinGecko() { - super("COINGECKO", "coingecko", Duration.ofMinutes(1)); + public CoinGecko(Environment env) { + super(env, "COINGECKO", "coingecko", Duration.ofMinutes(1)); } @Override @@ -56,8 +57,8 @@ class CoinGecko extends ExchangeRateProvider { Set result = new HashSet(); - Predicate isDesiredFiatPair = t -> SUPPORTED_FIAT_CURRENCIES.contains(t.getKey()); - Predicate isDesiredCryptoPair = t -> SUPPORTED_CRYPTO_CURRENCIES.contains(t.getKey()); + Predicate isDesiredFiatPair = t -> getSupportedFiatCurrencies().contains(t.getKey()); + Predicate isDesiredCryptoPair = t -> getSupportedCryptoCurrencies().contains(t.getKey()); getMarketData().getRates().entrySet().stream() .filter(isDesiredFiatPair.or(isDesiredCryptoPair)) @@ -65,7 +66,7 @@ class CoinGecko extends ExchangeRateProvider { .forEach((key, ticker) -> { boolean useInverseRate = false; - if (SUPPORTED_CRYPTO_CURRENCIES.contains(key)) { + if (getSupportedCryptoCurrencies().contains(key)) { // Use inverse rate for alts, because the API returns the // conversion rate in the opposite direction than what we need // API returns the BTC/Alt rate, we need the Alt/BTC rate diff --git a/pricenode/src/main/java/bisq/price/spot/providers/CoinMarketCap.java b/pricenode/src/main/java/bisq/price/spot/providers/CoinMarketCap.java index 39239c9e97..d18ee649c7 100644 --- a/pricenode/src/main/java/bisq/price/spot/providers/CoinMarketCap.java +++ b/pricenode/src/main/java/bisq/price/spot/providers/CoinMarketCap.java @@ -20,6 +20,7 @@ package bisq.price.spot.providers; import bisq.price.spot.ExchangeRate; import bisq.price.spot.ExchangeRateProvider; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import java.time.Duration; @@ -33,8 +34,8 @@ import java.util.Set; @Component class CoinMarketCap extends ExchangeRateProvider { - public CoinMarketCap() { - super("CMC", "coinmarketcap", Duration.ofMinutes(5)); // large data structure, so don't request it too often + public CoinMarketCap(Environment env) { + super(env, "CMC", "coinmarketcap", Duration.ofMinutes(5)); // large data structure, so don't request it too often } /** diff --git a/pricenode/src/main/java/bisq/price/spot/providers/Coinone.java b/pricenode/src/main/java/bisq/price/spot/providers/Coinone.java index 6ae54aef25..bf12575673 100644 --- a/pricenode/src/main/java/bisq/price/spot/providers/Coinone.java +++ b/pricenode/src/main/java/bisq/price/spot/providers/Coinone.java @@ -22,6 +22,7 @@ import bisq.price.spot.ExchangeRateProvider; import org.knowm.xchange.coinone.CoinoneExchange; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import java.time.Duration; @@ -31,8 +32,8 @@ import java.util.Set; @Component class Coinone extends ExchangeRateProvider { - public Coinone() { - super("COINONE", "coinone", Duration.ofMinutes(1)); + public Coinone(Environment env) { + super(env, "COINONE", "coinone", Duration.ofMinutes(1)); } @Override diff --git a/pricenode/src/main/java/bisq/price/spot/providers/Coinpaprika.java b/pricenode/src/main/java/bisq/price/spot/providers/Coinpaprika.java index ca0c1e9a79..0b91d72be0 100644 --- a/pricenode/src/main/java/bisq/price/spot/providers/Coinpaprika.java +++ b/pricenode/src/main/java/bisq/price/spot/providers/Coinpaprika.java @@ -22,6 +22,7 @@ import bisq.price.spot.ExchangeRateProvider; import bisq.price.util.coinpaprika.CoinpaprikaMarketData; import org.springframework.core.ParameterizedTypeReference; +import org.springframework.core.env.Environment; import org.springframework.http.RequestEntity; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; @@ -55,8 +56,8 @@ class Coinpaprika extends ExchangeRateProvider { "INR, MYR, NOK, PKR, SEK, TWD, ZAR, VND, BOB, COP, PEN, ARS, ISK") .replace(" ", ""); // Strip any spaces - public Coinpaprika() { - super("COINPAPRIKA", "coinpaprika", Duration.ofMinutes(1)); + public Coinpaprika(Environment env) { + super(env, "COINPAPRIKA", "coinpaprika", Duration.ofMinutes(1)); } @Override @@ -67,7 +68,7 @@ class Coinpaprika extends ExchangeRateProvider { Set result = new HashSet(); - Predicate isDesiredFiatPair = t -> SUPPORTED_FIAT_CURRENCIES.contains(t.getKey()); + Predicate isDesiredFiatPair = t -> getSupportedFiatCurrencies().contains(t.getKey()); getMarketData().getQuotes().entrySet().stream() .filter(isDesiredFiatPair) diff --git a/pricenode/src/main/java/bisq/price/spot/providers/Exmo.java b/pricenode/src/main/java/bisq/price/spot/providers/Exmo.java index 51d0daf5b9..8b7c804648 100644 --- a/pricenode/src/main/java/bisq/price/spot/providers/Exmo.java +++ b/pricenode/src/main/java/bisq/price/spot/providers/Exmo.java @@ -22,6 +22,7 @@ import bisq.price.spot.ExchangeRateProvider; import org.knowm.xchange.exmo.ExmoExchange; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import java.time.Duration; @@ -31,9 +32,9 @@ import java.util.Set; @Component class Exmo extends ExchangeRateProvider { - public Exmo() { + public Exmo(Environment env) { // API rate limit = 10 calls / second from the same IP ( see https://exmo.com/en/api ) - super("EXMO", "exmo", Duration.ofMinutes(1)); + super(env, "EXMO", "exmo", Duration.ofMinutes(1)); } @Override diff --git a/pricenode/src/main/java/bisq/price/spot/providers/Huobi.java b/pricenode/src/main/java/bisq/price/spot/providers/Huobi.java index 9514aa0cda..cd2f429628 100644 --- a/pricenode/src/main/java/bisq/price/spot/providers/Huobi.java +++ b/pricenode/src/main/java/bisq/price/spot/providers/Huobi.java @@ -22,6 +22,7 @@ import bisq.price.spot.ExchangeRateProvider; import org.knowm.xchange.huobi.HuobiExchange; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import java.time.Duration; @@ -31,8 +32,8 @@ import java.util.Set; @Component class Huobi extends ExchangeRateProvider { - public Huobi() { - super("HUOBI", "huobi", Duration.ofMinutes(1)); + public Huobi(Environment env) { + super(env, "HUOBI", "huobi", Duration.ofMinutes(1)); } @Override diff --git a/pricenode/src/main/java/bisq/price/spot/providers/IndependentReserve.java b/pricenode/src/main/java/bisq/price/spot/providers/IndependentReserve.java index d0d6c9604c..db1b881c22 100644 --- a/pricenode/src/main/java/bisq/price/spot/providers/IndependentReserve.java +++ b/pricenode/src/main/java/bisq/price/spot/providers/IndependentReserve.java @@ -22,6 +22,7 @@ import bisq.price.spot.ExchangeRateProvider; import org.knowm.xchange.independentreserve.IndependentReserveExchange; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import java.time.Duration; @@ -31,8 +32,8 @@ import java.util.Set; @Component class IndependentReserve extends ExchangeRateProvider { - public IndependentReserve() { - super("IndependentReserve", "independentreserve", Duration.ofMinutes(1)); + public IndependentReserve(Environment env) { + super(env, "IndependentReserve", "independentreserve", Duration.ofMinutes(1)); } @Override diff --git a/pricenode/src/main/java/bisq/price/spot/providers/Kraken.java b/pricenode/src/main/java/bisq/price/spot/providers/Kraken.java index d28645cfdb..0d1d2adc8c 100644 --- a/pricenode/src/main/java/bisq/price/spot/providers/Kraken.java +++ b/pricenode/src/main/java/bisq/price/spot/providers/Kraken.java @@ -22,6 +22,7 @@ import bisq.price.spot.ExchangeRateProvider; import org.knowm.xchange.kraken.KrakenExchange; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import java.time.Duration; @@ -31,8 +32,8 @@ import java.util.Set; @Component class Kraken extends ExchangeRateProvider { - public Kraken() { - super("KRAKEN", "kraken", Duration.ofMinutes(1)); + public Kraken(Environment env) { + super(env, "KRAKEN", "kraken", Duration.ofMinutes(1)); } @Override diff --git a/pricenode/src/main/java/bisq/price/spot/providers/Luno.java b/pricenode/src/main/java/bisq/price/spot/providers/Luno.java index b642fc47ce..451f6ba864 100644 --- a/pricenode/src/main/java/bisq/price/spot/providers/Luno.java +++ b/pricenode/src/main/java/bisq/price/spot/providers/Luno.java @@ -22,6 +22,7 @@ import bisq.price.spot.ExchangeRateProvider; import org.knowm.xchange.luno.LunoExchange; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import java.time.Duration; @@ -31,8 +32,8 @@ import java.util.Set; @Component class Luno extends ExchangeRateProvider { - public Luno() { - super("LUNO", "luno", Duration.ofMinutes(1)); + public Luno(Environment env) { + super(env, "LUNO", "luno", Duration.ofMinutes(1)); } @Override diff --git a/pricenode/src/main/java/bisq/price/spot/providers/MercadoBitcoin.java b/pricenode/src/main/java/bisq/price/spot/providers/MercadoBitcoin.java index d790dd4327..7ecbbb20a6 100644 --- a/pricenode/src/main/java/bisq/price/spot/providers/MercadoBitcoin.java +++ b/pricenode/src/main/java/bisq/price/spot/providers/MercadoBitcoin.java @@ -22,6 +22,7 @@ import bisq.price.spot.ExchangeRateProvider; import org.knowm.xchange.mercadobitcoin.MercadoBitcoinExchange; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import java.time.Duration; @@ -31,8 +32,8 @@ import java.util.Set; @Component class MercadoBitcoin extends ExchangeRateProvider { - public MercadoBitcoin() { - super("MercadoBitcoin", "mercadobitcoin", Duration.ofMinutes(1)); + public MercadoBitcoin(Environment env) { + super(env, "MercadoBitcoin", "mercadobitcoin", Duration.ofMinutes(1)); } @Override diff --git a/pricenode/src/main/java/bisq/price/spot/providers/Paribu.java b/pricenode/src/main/java/bisq/price/spot/providers/Paribu.java index b9929a62df..8498aff68e 100644 --- a/pricenode/src/main/java/bisq/price/spot/providers/Paribu.java +++ b/pricenode/src/main/java/bisq/price/spot/providers/Paribu.java @@ -22,6 +22,7 @@ import bisq.price.spot.ExchangeRateProvider; import org.knowm.xchange.paribu.ParibuExchange; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import java.time.Duration; @@ -31,8 +32,8 @@ import java.util.Set; @Component class Paribu extends ExchangeRateProvider { - public Paribu() { - super("PARIBU", "paribu", Duration.ofMinutes(1)); + public Paribu(Environment env) { + super(env, "PARIBU", "paribu", Duration.ofMinutes(1)); } @Override diff --git a/pricenode/src/main/java/bisq/price/spot/providers/Poloniex.java b/pricenode/src/main/java/bisq/price/spot/providers/Poloniex.java index 5d5e2be6c4..6664e7ea3a 100644 --- a/pricenode/src/main/java/bisq/price/spot/providers/Poloniex.java +++ b/pricenode/src/main/java/bisq/price/spot/providers/Poloniex.java @@ -22,6 +22,7 @@ import bisq.price.spot.ExchangeRateProvider; import org.knowm.xchange.poloniex.PoloniexExchange; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import java.time.Duration; @@ -31,8 +32,8 @@ import java.util.Set; @Component class Poloniex extends ExchangeRateProvider { - public Poloniex() { - super("POLO", "poloniex", Duration.ofMinutes(1)); + public Poloniex(Environment env) { + super(env, "POLO", "poloniex", Duration.ofMinutes(1)); } @Override diff --git a/pricenode/src/main/java/bisq/price/spot/providers/Quoine.java b/pricenode/src/main/java/bisq/price/spot/providers/Quoine.java index e04a76798b..745181727f 100644 --- a/pricenode/src/main/java/bisq/price/spot/providers/Quoine.java +++ b/pricenode/src/main/java/bisq/price/spot/providers/Quoine.java @@ -22,6 +22,7 @@ import bisq.price.spot.ExchangeRateProvider; import org.knowm.xchange.quoine.QuoineExchange; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import java.time.Duration; @@ -31,8 +32,8 @@ import java.util.Set; @Component class Quoine extends ExchangeRateProvider { - public Quoine() { - super("QUOINE", "quoine", Duration.ofMinutes(1)); + public Quoine(Environment env) { + super(env, "QUOINE", "quoine", Duration.ofMinutes(1)); } @Override diff --git a/pricenode/src/main/resources/application.properties b/pricenode/src/main/resources/application.properties index 07107b430c..bba1a31c88 100644 --- a/pricenode/src/main/resources/application.properties +++ b/pricenode/src/main/resources/application.properties @@ -7,3 +7,5 @@ bisq.price.mining.providers.mempoolHostname.2=mempool.emzy.de bisq.price.mining.providers.mempoolHostname.3=mempool.ninja bisq.price.mining.providers.mempoolHostname.4=mempool.bisq.services # bisq.price.mining.providers.mempoolHostname.5=someHostOrIP +bisq.price.fiatcurrency.excluded=LBP,ARS +bisq.price.cryptocurrency.excluded= diff --git a/pricenode/src/test/java/bisq/price/AbstractExchangeRateProviderTest.java b/pricenode/src/test/java/bisq/price/AbstractExchangeRateProviderTest.java index a459dc68b4..911f45439d 100644 --- a/pricenode/src/test/java/bisq/price/AbstractExchangeRateProviderTest.java +++ b/pricenode/src/test/java/bisq/price/AbstractExchangeRateProviderTest.java @@ -30,7 +30,7 @@ public abstract class AbstractExchangeRateProviderTest { // Sanity checks assertTrue(retrievedExchangeRates.size() > 0); - checkProviderCurrencyPairs(retrievedExchangeRates); + checkProviderCurrencyPairs(exchangeProvider, retrievedExchangeRates); } /** @@ -40,24 +40,24 @@ public abstract class AbstractExchangeRateProviderTest { * * @param retrievedExchangeRates Exchange rates retrieved from the provider */ - private void checkProviderCurrencyPairs(Set retrievedExchangeRates) { + private void checkProviderCurrencyPairs(ExchangeRateProvider exchangeProvider, Set retrievedExchangeRates) { Set retrievedRatesCurrencies = retrievedExchangeRates.stream() .map(ExchangeRate::getCurrency) .collect(Collectors.toSet()); - Set supportedFiatCurrenciesRetrieved = ExchangeRateProvider.SUPPORTED_FIAT_CURRENCIES.stream() + Set supportedFiatCurrenciesRetrieved = exchangeProvider.getSupportedFiatCurrencies().stream() .filter(f -> retrievedRatesCurrencies.contains(f)) .collect(Collectors.toCollection(TreeSet::new)); log.info("Retrieved rates for supported fiat currencies: " + supportedFiatCurrenciesRetrieved); - Set supportedCryptoCurrenciesRetrieved = ExchangeRateProvider.SUPPORTED_CRYPTO_CURRENCIES.stream() + Set supportedCryptoCurrenciesRetrieved = exchangeProvider.getSupportedCryptoCurrencies().stream() .filter(c -> retrievedRatesCurrencies.contains(c)) .collect(Collectors.toCollection(TreeSet::new)); log.info("Retrieved rates for supported altcoins: " + supportedCryptoCurrenciesRetrieved); Set supportedCurrencies = Sets.union( - ExchangeRateProvider.SUPPORTED_CRYPTO_CURRENCIES, - ExchangeRateProvider.SUPPORTED_FIAT_CURRENCIES); + exchangeProvider.getSupportedCryptoCurrencies(), + exchangeProvider.getSupportedFiatCurrencies()); Set unsupportedCurrencies = Sets.difference(retrievedRatesCurrencies, supportedCurrencies); assertTrue("Retrieved exchange rates contain unsupported currencies: " + unsupportedCurrencies, diff --git a/pricenode/src/test/java/bisq/price/spot/ExchangeRateServiceTest.java b/pricenode/src/test/java/bisq/price/spot/ExchangeRateServiceTest.java index fefb3c85bf..04a1658cd9 100644 --- a/pricenode/src/test/java/bisq/price/spot/ExchangeRateServiceTest.java +++ b/pricenode/src/test/java/bisq/price/spot/ExchangeRateServiceTest.java @@ -17,6 +17,11 @@ package bisq.price.spot; +import bisq.core.locale.CurrencyUtil; + +import org.springframework.core.env.Environment; +import org.springframework.core.env.StandardEnvironment; + import com.google.common.collect.Sets; import org.apache.commons.lang3.RandomStringUtils; @@ -46,10 +51,9 @@ import org.junit.jupiter.api.Test; import static java.lang.Thread.sleep; import static java.util.Arrays.asList; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; + +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.*; public class ExchangeRateServiceTest { @@ -156,6 +160,72 @@ public class ExchangeRateServiceTest { assertNotEquals(0L, retrievedData.get(dummyProvider2.getPrefix() + "Ts")); } + /** + * Tests the scenario when currencies are excluded from the PriceNode feed via configuration settings + */ + @Test + public void getAllMarketPrices_withMultipleProviders_excludedCurrencyCodes() { + String excludedCcyString = "LBP,USD,EUR"; + Environment mockedEnvironment = mock(Environment.class); + when(mockedEnvironment.getProperty(eq("bisq.price.fiatcurrency.excluded"), anyString())).thenReturn(excludedCcyString); + + class MockedExchangeRateProvider extends ExchangeRateProvider { + MockedExchangeRateProvider() { + super(mockedEnvironment, "ExchangeName", "EXCH", Duration.ofDays(1)); + } + + @Override + public boolean isRunning() { + return true; + } + + @Override + public Set doGet() { + HashSet exchangeRates = new HashSet<>(); + // Simulate rates for all the supported ccys + for (String rateCurrencyCode : getSupportedFiatCurrencies()) { + exchangeRates.add(new ExchangeRate( + rateCurrencyCode, + RandomUtils.nextDouble(1, 1000), // random price + System.currentTimeMillis(), + getName())); // ExchangeRateProvider name + } + return exchangeRates; + } + } + + Logger exchangeRateProviderLogger; + String LIST_APPENDER_NAME2 = "testListAppender2"; + exchangeRateProviderLogger = (Logger) LoggerFactory.getLogger(MockedExchangeRateProvider.class); + ListAppender listAppender2 = new ListAppender<>(); + listAppender2.setName(LIST_APPENDER_NAME2); + listAppender2.start(); + exchangeRateProviderLogger.addAppender(listAppender2); + + // we request rates for all currencies, and check that: + // (a) the provider supplies more currency rates than the number of currencies we are trying to exclude (sanity test), + // (b) the number of missing currency rates equals the number of currencies we told PriceNode to exclude, + // (c) none of the rates supplied are for an excluded currency. + + Set excludedFiatCurrencies = new HashSet<>(asList(excludedCcyString.split(","))); + MockedExchangeRateProvider mockedExchangeRateProvider = new MockedExchangeRateProvider(); + Set exchangeRates = mockedExchangeRateProvider.doGet(); + assertTrue(exchangeRates.size() > excludedFiatCurrencies.size()); + int numSortedFiatCurrencies = CurrencyUtil.getAllSortedFiatCurrencies().size(); + int numCurrenciesFromProvider = mockedExchangeRateProvider.getSupportedFiatCurrencies().size(); + int missingCurrencyCount = numSortedFiatCurrencies - numCurrenciesFromProvider; + assertEquals(missingCurrencyCount, excludedFiatCurrencies.size()); + for (ExchangeRate exchangeRate : exchangeRates) { + assertFalse(excludedCcyString.contains(exchangeRate.getCurrency())); + } + List logsList = ((ListAppender) exchangeRateProviderLogger.getAppender(LIST_APPENDER_NAME2)).list; + assertEquals(3, logsList.size()); + assertEquals(Level.INFO, logsList.get(1).getLevel()); + assertTrue(logsList.get(0).getFormattedMessage().endsWith("will refresh every PT24H")); + assertTrue(logsList.get(1).getFormattedMessage().endsWith("fiat currencies excluded: [LBP, USD, EUR]")); + assertTrue(logsList.get(2).getFormattedMessage().endsWith("fiat currencies supported: " + numCurrenciesFromProvider)); + } + /** * Performs generic sanity checks on the response format and contents. * @@ -259,6 +329,7 @@ public class ExchangeRateServiceTest { */ private ExchangeRateProvider buildDummyExchangeRateProvider(int numberOfRatesAvailable) { ExchangeRateProvider dummyProvider = new ExchangeRateProvider( + new StandardEnvironment(), "ExchangeName-" + getRandomAlphaNumericString(5), "EXCH-" + getRandomAlphaNumericString(3), Duration.ofDays(1)) { @@ -298,6 +369,7 @@ public class ExchangeRateServiceTest { private ExchangeRateProvider buildDummyExchangeRateProvider(Set rateCurrencyCodes) { ExchangeRateProvider dummyProvider = new ExchangeRateProvider( + new StandardEnvironment(), "ExchangeName-" + getRandomAlphaNumericString(5), "EXCH-" + getRandomAlphaNumericString(3), Duration.ofDays(1)) { diff --git a/pricenode/src/test/java/bisq/price/spot/providers/BTCMarketsTest.java b/pricenode/src/test/java/bisq/price/spot/providers/BTCMarketsTest.java index 1bd1278e56..511273aa3f 100644 --- a/pricenode/src/test/java/bisq/price/spot/providers/BTCMarketsTest.java +++ b/pricenode/src/test/java/bisq/price/spot/providers/BTCMarketsTest.java @@ -19,6 +19,8 @@ package bisq.price.spot.providers; import bisq.price.AbstractExchangeRateProviderTest; +import org.springframework.core.env.StandardEnvironment; + import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; @@ -28,7 +30,7 @@ public class BTCMarketsTest extends AbstractExchangeRateProviderTest { @Test public void doGet_successfulCall() { - doGet_successfulCall(new BTCMarkets()); + doGet_successfulCall(new BTCMarkets(new StandardEnvironment())); } } diff --git a/pricenode/src/test/java/bisq/price/spot/providers/BinanceTest.java b/pricenode/src/test/java/bisq/price/spot/providers/BinanceTest.java index 2a72e67a71..e99520203f 100644 --- a/pricenode/src/test/java/bisq/price/spot/providers/BinanceTest.java +++ b/pricenode/src/test/java/bisq/price/spot/providers/BinanceTest.java @@ -19,6 +19,8 @@ package bisq.price.spot.providers; import bisq.price.AbstractExchangeRateProviderTest; +import org.springframework.core.env.StandardEnvironment; + import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; @@ -28,7 +30,7 @@ public class BinanceTest extends AbstractExchangeRateProviderTest { @Test public void doGet_successfulCall() { - doGet_successfulCall(new Binance()); + doGet_successfulCall(new Binance(new StandardEnvironment())); } } diff --git a/pricenode/src/test/java/bisq/price/spot/providers/BitbayTest.java b/pricenode/src/test/java/bisq/price/spot/providers/BitbayTest.java index fc02ee7a62..7366272e92 100644 --- a/pricenode/src/test/java/bisq/price/spot/providers/BitbayTest.java +++ b/pricenode/src/test/java/bisq/price/spot/providers/BitbayTest.java @@ -19,6 +19,8 @@ package bisq.price.spot.providers; import bisq.price.AbstractExchangeRateProviderTest; +import org.springframework.core.env.StandardEnvironment; + import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; @@ -28,7 +30,7 @@ public class BitbayTest extends AbstractExchangeRateProviderTest { @Test public void doGet_successfulCall() { - doGet_successfulCall(new Bitbay()); + doGet_successfulCall(new Bitbay(new StandardEnvironment())); } } diff --git a/pricenode/src/test/java/bisq/price/spot/providers/BitfinexTest.java b/pricenode/src/test/java/bisq/price/spot/providers/BitfinexTest.java index a653b6484a..e2dfa7019a 100644 --- a/pricenode/src/test/java/bisq/price/spot/providers/BitfinexTest.java +++ b/pricenode/src/test/java/bisq/price/spot/providers/BitfinexTest.java @@ -19,6 +19,8 @@ package bisq.price.spot.providers; import bisq.price.AbstractExchangeRateProviderTest; +import org.springframework.core.env.StandardEnvironment; + import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; @@ -28,7 +30,7 @@ public class BitfinexTest extends AbstractExchangeRateProviderTest { @Test public void doGet_successfulCall() { - doGet_successfulCall(new Bitfinex()); + doGet_successfulCall(new Bitfinex(new StandardEnvironment())); } } diff --git a/pricenode/src/test/java/bisq/price/spot/providers/BitflyerTest.java b/pricenode/src/test/java/bisq/price/spot/providers/BitflyerTest.java index e43d192b36..a722c5d155 100644 --- a/pricenode/src/test/java/bisq/price/spot/providers/BitflyerTest.java +++ b/pricenode/src/test/java/bisq/price/spot/providers/BitflyerTest.java @@ -19,6 +19,8 @@ package bisq.price.spot.providers; import bisq.price.AbstractExchangeRateProviderTest; +import org.springframework.core.env.StandardEnvironment; + import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; @@ -28,7 +30,7 @@ public class BitflyerTest extends AbstractExchangeRateProviderTest { @Test public void doGet_successfulCall() { - doGet_successfulCall(new Bitflyer()); + doGet_successfulCall(new Bitflyer(new StandardEnvironment())); } } diff --git a/pricenode/src/test/java/bisq/price/spot/providers/BitstampTest.java b/pricenode/src/test/java/bisq/price/spot/providers/BitstampTest.java index 69e3cba604..3c41974548 100644 --- a/pricenode/src/test/java/bisq/price/spot/providers/BitstampTest.java +++ b/pricenode/src/test/java/bisq/price/spot/providers/BitstampTest.java @@ -19,6 +19,8 @@ package bisq.price.spot.providers; import bisq.price.AbstractExchangeRateProviderTest; +import org.springframework.core.env.StandardEnvironment; + import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; @@ -28,7 +30,7 @@ public class BitstampTest extends AbstractExchangeRateProviderTest { @Test public void doGet_successfulCall() { - doGet_successfulCall(new Bitstamp()); + doGet_successfulCall(new Bitstamp(new StandardEnvironment())); } } diff --git a/pricenode/src/test/java/bisq/price/spot/providers/CoinGeckoTest.java b/pricenode/src/test/java/bisq/price/spot/providers/CoinGeckoTest.java index 43a1a865c8..86c765dcaf 100644 --- a/pricenode/src/test/java/bisq/price/spot/providers/CoinGeckoTest.java +++ b/pricenode/src/test/java/bisq/price/spot/providers/CoinGeckoTest.java @@ -19,6 +19,8 @@ package bisq.price.spot.providers; import bisq.price.AbstractExchangeRateProviderTest; +import org.springframework.core.env.StandardEnvironment; + import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; @@ -28,7 +30,7 @@ public class CoinGeckoTest extends AbstractExchangeRateProviderTest { @Test public void doGet_successfulCall() { - doGet_successfulCall(new CoinGecko()); + doGet_successfulCall(new CoinGecko(new StandardEnvironment())); } } diff --git a/pricenode/src/test/java/bisq/price/spot/providers/CoinoneTest.java b/pricenode/src/test/java/bisq/price/spot/providers/CoinoneTest.java index c722c188ac..9832118ca0 100644 --- a/pricenode/src/test/java/bisq/price/spot/providers/CoinoneTest.java +++ b/pricenode/src/test/java/bisq/price/spot/providers/CoinoneTest.java @@ -19,6 +19,8 @@ package bisq.price.spot.providers; import bisq.price.AbstractExchangeRateProviderTest; +import org.springframework.core.env.StandardEnvironment; + import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; @@ -28,7 +30,7 @@ public class CoinoneTest extends AbstractExchangeRateProviderTest { @Test public void doGet_successfulCall() { - doGet_successfulCall(new Coinone()); + doGet_successfulCall(new Coinone(new StandardEnvironment())); } } diff --git a/pricenode/src/test/java/bisq/price/spot/providers/CoinpaprikaTest.java b/pricenode/src/test/java/bisq/price/spot/providers/CoinpaprikaTest.java index 27eb4a642b..0bf44241b3 100644 --- a/pricenode/src/test/java/bisq/price/spot/providers/CoinpaprikaTest.java +++ b/pricenode/src/test/java/bisq/price/spot/providers/CoinpaprikaTest.java @@ -19,6 +19,8 @@ package bisq.price.spot.providers; import bisq.price.AbstractExchangeRateProviderTest; +import org.springframework.core.env.StandardEnvironment; + import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; @@ -28,7 +30,7 @@ public class CoinpaprikaTest extends AbstractExchangeRateProviderTest { @Test public void doGet_successfulCall() { - doGet_successfulCall(new Coinpaprika()); + doGet_successfulCall(new Coinpaprika(new StandardEnvironment())); } } diff --git a/pricenode/src/test/java/bisq/price/spot/providers/ExmoTest.java b/pricenode/src/test/java/bisq/price/spot/providers/ExmoTest.java index 68148f45b3..8d980f1c4b 100644 --- a/pricenode/src/test/java/bisq/price/spot/providers/ExmoTest.java +++ b/pricenode/src/test/java/bisq/price/spot/providers/ExmoTest.java @@ -19,6 +19,8 @@ package bisq.price.spot.providers; import bisq.price.AbstractExchangeRateProviderTest; +import org.springframework.core.env.StandardEnvironment; + import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; @@ -28,7 +30,7 @@ public class ExmoTest extends AbstractExchangeRateProviderTest { @Test public void doGet_successfulCall() { - doGet_successfulCall(new Exmo()); + doGet_successfulCall(new Exmo(new StandardEnvironment())); } } diff --git a/pricenode/src/test/java/bisq/price/spot/providers/HuobiTest.java b/pricenode/src/test/java/bisq/price/spot/providers/HuobiTest.java index 2ad87856f8..da5062a807 100644 --- a/pricenode/src/test/java/bisq/price/spot/providers/HuobiTest.java +++ b/pricenode/src/test/java/bisq/price/spot/providers/HuobiTest.java @@ -19,6 +19,8 @@ package bisq.price.spot.providers; import bisq.price.AbstractExchangeRateProviderTest; +import org.springframework.core.env.StandardEnvironment; + import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; @@ -28,7 +30,7 @@ public class HuobiTest extends AbstractExchangeRateProviderTest { @Test public void doGet_successfulCall() { - doGet_successfulCall(new Huobi()); + doGet_successfulCall(new Huobi(new StandardEnvironment())); } } diff --git a/pricenode/src/test/java/bisq/price/spot/providers/IndependentReserveTest.java b/pricenode/src/test/java/bisq/price/spot/providers/IndependentReserveTest.java index ccf7cb8b87..93a43a9cfd 100644 --- a/pricenode/src/test/java/bisq/price/spot/providers/IndependentReserveTest.java +++ b/pricenode/src/test/java/bisq/price/spot/providers/IndependentReserveTest.java @@ -19,6 +19,8 @@ package bisq.price.spot.providers; import bisq.price.AbstractExchangeRateProviderTest; +import org.springframework.core.env.StandardEnvironment; + import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; @@ -28,7 +30,7 @@ public class IndependentReserveTest extends AbstractExchangeRateProviderTest { @Test public void doGet_successfulCall() { - doGet_successfulCall(new IndependentReserve()); + doGet_successfulCall(new IndependentReserve(new StandardEnvironment())); } } diff --git a/pricenode/src/test/java/bisq/price/spot/providers/KrakenTest.java b/pricenode/src/test/java/bisq/price/spot/providers/KrakenTest.java index 6f8a84a5ca..8226c88def 100644 --- a/pricenode/src/test/java/bisq/price/spot/providers/KrakenTest.java +++ b/pricenode/src/test/java/bisq/price/spot/providers/KrakenTest.java @@ -19,6 +19,8 @@ package bisq.price.spot.providers; import bisq.price.AbstractExchangeRateProviderTest; +import org.springframework.core.env.StandardEnvironment; + import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; @@ -28,7 +30,7 @@ public class KrakenTest extends AbstractExchangeRateProviderTest { @Test public void doGet_successfulCall() { - doGet_successfulCall(new Kraken()); + doGet_successfulCall(new Kraken(new StandardEnvironment())); } } diff --git a/pricenode/src/test/java/bisq/price/spot/providers/LunoTest.java b/pricenode/src/test/java/bisq/price/spot/providers/LunoTest.java index eaa9511577..a04c9fb1c5 100644 --- a/pricenode/src/test/java/bisq/price/spot/providers/LunoTest.java +++ b/pricenode/src/test/java/bisq/price/spot/providers/LunoTest.java @@ -19,6 +19,8 @@ package bisq.price.spot.providers; import bisq.price.AbstractExchangeRateProviderTest; +import org.springframework.core.env.StandardEnvironment; + import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; @@ -28,7 +30,7 @@ public class LunoTest extends AbstractExchangeRateProviderTest { @Test public void doGet_successfulCall() { - doGet_successfulCall(new Luno()); + doGet_successfulCall(new Luno(new StandardEnvironment())); } } diff --git a/pricenode/src/test/java/bisq/price/spot/providers/MercadoBitcoinTest.java b/pricenode/src/test/java/bisq/price/spot/providers/MercadoBitcoinTest.java index 92585acb28..56715327d3 100644 --- a/pricenode/src/test/java/bisq/price/spot/providers/MercadoBitcoinTest.java +++ b/pricenode/src/test/java/bisq/price/spot/providers/MercadoBitcoinTest.java @@ -19,6 +19,8 @@ package bisq.price.spot.providers; import bisq.price.AbstractExchangeRateProviderTest; +import org.springframework.core.env.StandardEnvironment; + import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; @@ -28,7 +30,7 @@ public class MercadoBitcoinTest extends AbstractExchangeRateProviderTest { @Test public void doGet_successfulCall() { - doGet_successfulCall(new MercadoBitcoin()); + doGet_successfulCall(new MercadoBitcoin(new StandardEnvironment())); } } diff --git a/pricenode/src/test/java/bisq/price/spot/providers/ParibuTest.java b/pricenode/src/test/java/bisq/price/spot/providers/ParibuTest.java index 148a1291cb..3aac4b9e22 100644 --- a/pricenode/src/test/java/bisq/price/spot/providers/ParibuTest.java +++ b/pricenode/src/test/java/bisq/price/spot/providers/ParibuTest.java @@ -19,6 +19,8 @@ package bisq.price.spot.providers; import bisq.price.AbstractExchangeRateProviderTest; +import org.springframework.core.env.StandardEnvironment; + import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; @@ -28,7 +30,7 @@ public class ParibuTest extends AbstractExchangeRateProviderTest { @Test public void doGet_successfulCall() { - doGet_successfulCall(new Paribu()); + doGet_successfulCall(new Paribu(new StandardEnvironment())); } } diff --git a/pricenode/src/test/java/bisq/price/spot/providers/PoloniexTest.java b/pricenode/src/test/java/bisq/price/spot/providers/PoloniexTest.java index 70cb3b7d7c..de7711e92c 100644 --- a/pricenode/src/test/java/bisq/price/spot/providers/PoloniexTest.java +++ b/pricenode/src/test/java/bisq/price/spot/providers/PoloniexTest.java @@ -19,6 +19,8 @@ package bisq.price.spot.providers; import bisq.price.AbstractExchangeRateProviderTest; +import org.springframework.core.env.StandardEnvironment; + import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; @@ -28,7 +30,7 @@ public class PoloniexTest extends AbstractExchangeRateProviderTest { @Test public void doGet_successfulCall() { - doGet_successfulCall(new Poloniex()); + doGet_successfulCall(new Poloniex(new StandardEnvironment())); } } diff --git a/pricenode/src/test/java/bisq/price/spot/providers/QuoineTest.java b/pricenode/src/test/java/bisq/price/spot/providers/QuoineTest.java index 2067453cce..64653342c2 100644 --- a/pricenode/src/test/java/bisq/price/spot/providers/QuoineTest.java +++ b/pricenode/src/test/java/bisq/price/spot/providers/QuoineTest.java @@ -19,6 +19,8 @@ package bisq.price.spot.providers; import bisq.price.AbstractExchangeRateProviderTest; +import org.springframework.core.env.StandardEnvironment; + import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; @@ -28,7 +30,7 @@ public class QuoineTest extends AbstractExchangeRateProviderTest { @Test public void doGet_successfulCall() { - doGet_successfulCall(new Quoine()); + doGet_successfulCall(new Quoine(new StandardEnvironment())); } }