diff --git a/build.gradle b/build.gradle
index 1946ba1a55d..8301832c462 100644
--- a/build.gradle
+++ b/build.gradle
@@ -62,7 +62,7 @@ configure(subprojects) {
junitVersion = '4.12'
jupiterVersion = '5.7.0'
kotlinVersion = '1.3.41'
- knowmXchangeVersion = '4.4.2'
+ knowmXchangeVersion = '5.0.13'
langVersion = '3.11'
logbackVersion = '1.1.11'
loggingVersion = '1.2'
@@ -606,6 +606,7 @@ configure(project(':pricenode')) {
implementation("org.knowm.xchange:xchange-bitstamp:$knowmXchangeVersion")
implementation("org.knowm.xchange:xchange-btcmarkets:$knowmXchangeVersion")
implementation("org.knowm.xchange:xchange-cexio:$knowmXchangeVersion")
+ implementation("org.knowm.xchange:xchange-coinbasepro:$knowmXchangeVersion")
implementation("org.knowm.xchange:xchange-coinmarketcap:$knowmXchangeVersion")
implementation("org.knowm.xchange:xchange-coinmate:$knowmXchangeVersion")
implementation("org.knowm.xchange:xchange-coinone:$knowmXchangeVersion")
diff --git a/pricenode/src/main/java/bisq/price/spot/providers/Bitbay.java b/pricenode/src/main/java/bisq/price/spot/providers/CoinbasePro.java
similarity index 68%
rename from pricenode/src/main/java/bisq/price/spot/providers/Bitbay.java
rename to pricenode/src/main/java/bisq/price/spot/providers/CoinbasePro.java
index d9b42ce1f93..663fee8e39f 100644
--- a/pricenode/src/main/java/bisq/price/spot/providers/Bitbay.java
+++ b/pricenode/src/main/java/bisq/price/spot/providers/CoinbasePro.java
@@ -14,13 +14,12 @@
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see .
*/
-
package bisq.price.spot.providers;
import bisq.price.spot.ExchangeRate;
import bisq.price.spot.ExchangeRateProvider;
-import org.knowm.xchange.bitbay.BitbayExchange;
+import org.knowm.xchange.coinbasepro.CoinbaseProExchange;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@@ -30,16 +29,21 @@
import java.util.Set;
@Component
-class Bitbay extends ExchangeRateProvider {
+class CoinbasePro extends ExchangeRateProvider {
- public Bitbay(Environment env) {
- super(env, "BITBAY", "bitbay", Duration.ofMinutes(1));
+ public CoinbasePro(Environment env) {
+ super(env, "COINBASEPRO", "coinbasepro", Duration.ofMinutes(1));
}
@Override
public Set doGet() {
- // Supported fiat: EUR, GBP, PLN, USD
- // Supported alts: DASH, ETH, LTC
- return doGet(BitbayExchange.class);
+ // Supported fiat: EUR, USD, GBP
+ // Supported alts: DASH, DOGE, ETC, ETH, LTC, ZEC, ZEN
+ return doGet(CoinbaseProExchange.class);
+ }
+
+ @Override
+ protected boolean requiresFilterDuringBulkTickerRetrieval() {
+ return true;
}
}
diff --git a/pricenode/src/main/java/bisq/price/spot/providers/Coinpaprika.java b/pricenode/src/main/java/bisq/price/spot/providers/Coinpaprika.java
deleted file mode 100644
index 0b91d72be07..00000000000
--- a/pricenode/src/main/java/bisq/price/spot/providers/Coinpaprika.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * This file is part of Bisq.
- *
- * Bisq is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or (at
- * your option) any later version.
- *
- * Bisq is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with Bisq. If not, see .
- */
-
-package bisq.price.spot.providers;
-
-import bisq.price.spot.ExchangeRate;
-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;
-import org.springframework.web.util.UriComponentsBuilder;
-
-import java.time.Duration;
-
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.function.Predicate;
-import java.util.stream.Collectors;
-
-@Component
-class Coinpaprika extends ExchangeRateProvider {
-
- private final RestTemplate restTemplate = new RestTemplate();
-
- /**
- * Used to determine the currencies in which the BTC price can be quoted. There seems
- * to be no programatic way to retrieve it, so we get the value from the API
- * documentation (see "quotes" param decsribed at
- * https://api.coinpaprika.com/#operation/getTickersById ). The hardcoded value below
- * is the list of allowed values as per the API documentation, but without BTC and ETH
- * as it makes no sense to quote the BTC price in them.
- */
- private final static String SUPPORTED_CURRENCIES =
- ("USD, EUR, PLN, KRW, GBP, CAD, JPY, RUB, TRY, NZD, AUD, CHF, UAH, HKD, " +
- "SGD, NGN, PHP, MXN, BRL, THB, CLP, CNY, CZK, DKK, HUF, IDR, ILS," +
- "INR, MYR, NOK, PKR, SEK, TWD, ZAR, VND, BOB, COP, PEN, ARS, ISK")
- .replace(" ", ""); // Strip any spaces
-
- public Coinpaprika(Environment env) {
- super(env, "COINPAPRIKA", "coinpaprika", Duration.ofMinutes(1));
- }
-
- @Override
- public Set doGet() {
-
- // Single IP address can send less than 10 requests per second
- // We make only 1 API call per provider poll, so we're not at risk of reaching it
-
- Set result = new HashSet();
-
- Predicate isDesiredFiatPair = t -> getSupportedFiatCurrencies().contains(t.getKey());
-
- getMarketData().getQuotes().entrySet().stream()
- .filter(isDesiredFiatPair)
- .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))
- .forEach((key, ticker) -> {
-
- result.add(new ExchangeRate(
- key,
- ticker.getPrice(),
- new Date(),
- this.getName()
- ));
- });
-
- return result;
- }
-
- private CoinpaprikaMarketData getMarketData() {
- return restTemplate.exchange(
- RequestEntity
- .get(UriComponentsBuilder
- .fromUriString(
- "https://api.coinpaprika.com/v1/tickers/btc-bitcoin?quotes=" +
- SUPPORTED_CURRENCIES).build()
- .toUri())
- .build(),
- new ParameterizedTypeReference() {
- }
- ).getBody();
- }
-}
diff --git a/pricenode/src/test/java/bisq/price/spot/providers/BitbayTest.java b/pricenode/src/test/java/bisq/price/spot/providers/BitbayTest.java
deleted file mode 100644
index 7366272e926..00000000000
--- a/pricenode/src/test/java/bisq/price/spot/providers/BitbayTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * This file is part of Bisq.
- *
- * Bisq is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or (at
- * your option) any later version.
- *
- * Bisq is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with Bisq. If not, see .
- */
-
-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;
-
-@Slf4j
-public class BitbayTest extends AbstractExchangeRateProviderTest {
-
- @Test
- public void doGet_successfulCall() {
- doGet_successfulCall(new Bitbay(new StandardEnvironment()));
- }
-
-}
diff --git a/pricenode/src/test/java/bisq/price/spot/providers/CoinpaprikaTest.java b/pricenode/src/test/java/bisq/price/spot/providers/CoinbaseProTest.java
similarity index 88%
rename from pricenode/src/test/java/bisq/price/spot/providers/CoinpaprikaTest.java
rename to pricenode/src/test/java/bisq/price/spot/providers/CoinbaseProTest.java
index 0bf44241b3e..a3e12c8a159 100644
--- a/pricenode/src/test/java/bisq/price/spot/providers/CoinpaprikaTest.java
+++ b/pricenode/src/test/java/bisq/price/spot/providers/CoinbaseProTest.java
@@ -26,11 +26,11 @@
import org.junit.jupiter.api.Test;
@Slf4j
-public class CoinpaprikaTest extends AbstractExchangeRateProviderTest {
+public class CoinbaseProTest extends AbstractExchangeRateProviderTest {
@Test
public void doGet_successfulCall() {
- doGet_successfulCall(new Coinpaprika(new StandardEnvironment()));
+ doGet_successfulCall(new CoinbasePro(new StandardEnvironment()));
}
}