Skip to content

Commit

Permalink
Apply Codacy style changes
Browse files Browse the repository at this point in the history
Apply various changes in coding style, required by the Codacy check.
  • Loading branch information
cd2357 committed Aug 8, 2020
1 parent 9fb5c0b commit 0c27038
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,11 @@ protected Set<ExchangeRate> doGet(Class<? extends Exchange> exchangeClass) {
public Collection<CurrencyPair> getCurrencyPairs() {
// If required by the exchange implementation, specify a filter
// (list of pairs which should be retrieved)
if (requiresFilterDuringBulkTickerRetrieval())
if (requiresFilterDuringBulkTickerRetrieval()) {
return Stream.of(desiredFiatPairs, desiredCryptoPairs)
.flatMap(Collection::stream)
.collect(Collectors.toList());
}

// Otherwise, specify an empty list, indicating that the API should
// simply return all available tickers
Expand All @@ -178,8 +179,7 @@ public Collection<CurrencyPair> getCurrencyPairs() {
throw new IllegalArgumentException("No tickers retrieved, " +
"exchange requires explicit filter argument during bulk retrieval?");
}
}
catch (NotYetImplementedForExchangeException e) {
} catch (NotYetImplementedForExchangeException e) {
// Thrown when a provider has no marketDataService.getTickers() implementation
// either because the exchange API does not provide it, or because it has not
// been implemented yet in the knowm xchange library
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,18 @@ private Map<String, ExchangeRate> getAggregateExchangeRates() {

// For each currency code, calculate aggregate rate
currencyCodeToExchangeRates.forEach((currencyCode, exchangeRateList) -> {
if (exchangeRateList.isEmpty())
if (exchangeRateList.isEmpty()) {
// If the map was built incorrectly and this currency points to an empty
// list of rates, skip it
return;
}

ExchangeRate aggregateExchangeRate;
if (exchangeRateList.size() == 1) {
// If a single provider has rates for this currency, then aggregate = rate
// from that provider
aggregateExchangeRate = exchangeRateList.get(0);
}
else {
} else {
// If multiple providers have rates for this currency, then
// aggregate = average of the rates
OptionalDouble opt = exchangeRateList.stream().mapToDouble(ExchangeRate::getPrice).average();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public Set<ExchangeRate> doGet() {
new Date(),
this.getName()
));
});
});

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Coinpaprika extends ExchangeRateProvider {
("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
.replace(" ", ""); // Strip any spaces

public Coinpaprika() {
super("COINPAPRIKA", "coinpaprika", Duration.ofMinutes(1));
Expand All @@ -80,8 +80,7 @@ public Set<ExchangeRate> doGet() {
new Date(),
this.getName()
));

});
});

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
@Component
class Hitbtc extends ExchangeRateProvider {

public Hitbtc() { super("HITBTC", "hitbtc", Duration.ofMinutes(1)); }
public Hitbtc() {
super("HITBTC", "hitbtc", Duration.ofMinutes(1));
}

@Override
public Set<ExchangeRate> doGet() {
Expand Down
4 changes: 3 additions & 1 deletion pricenode/src/main/java/bisq/price/spot/providers/Huobi.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
@Component
class Huobi extends ExchangeRateProvider {

public Huobi() { super("HUOBI", "huobi", Duration.ofMinutes(1)); }
public Huobi() {
super("HUOBI", "huobi", Duration.ofMinutes(1));
}

@Override
public Set<ExchangeRate> doGet() {
Expand Down

0 comments on commit 0c27038

Please sign in to comment.