Implement getMarketPrices API endpoint

- Increase rate limit to 10 calls per second.
- Use the new API also for the getMarketPrice call, this makes the 'Can get market prices' API test pass
This commit is contained in:
premek 2021-11-17 15:50:29 +01:00 committed by woodser
parent b1e69f9fdc
commit f27e3e3d1a
7 changed files with 176 additions and 54 deletions

View file

@ -19,6 +19,7 @@ package bisq.core.api;
import bisq.core.api.model.AddressBalanceInfo;
import bisq.core.api.model.BalancesInfo;
import bisq.core.api.model.MarketPriceInfo;
import bisq.core.api.model.TxFeeRateInfo;
import bisq.core.monetary.Price;
import bisq.core.offer.Offer;
@ -46,6 +47,8 @@ import com.google.common.util.concurrent.FutureCallback;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import java.util.function.Consumer;
import lombok.Getter;
@ -225,8 +228,12 @@ public class CoreApi {
// Prices
///////////////////////////////////////////////////////////////////////////////////////////
public void getMarketPrice(String currencyCode, Consumer<Double> resultHandler) {
corePriceService.getMarketPrice(currencyCode, resultHandler);
public double getMarketPrice(String currencyCode) throws ExecutionException, InterruptedException, TimeoutException {
return corePriceService.getMarketPrice(currencyCode);
}
public List<MarketPriceInfo> getMarketPrices() throws ExecutionException, InterruptedException, TimeoutException {
return corePriceService.getMarketPrices();
}
///////////////////////////////////////////////////////////////////////////////////////////
@ -275,7 +282,7 @@ public class CoreApi {
public BalancesInfo getBalances(String currencyCode) {
return walletsService.getBalances(currencyCode);
}
public String getNewDepositSubaddress() {
return walletsService.getNewDepositSubaddress();
}