Skip to content

Commit

Permalink
LC-250 - Fixed BitBuy exchange rate calculation (#854)
Browse files Browse the repository at this point in the history
  • Loading branch information
SMaros authored Oct 13, 2023
1 parent 1d8bc8d commit 162789f
Showing 1 changed file with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,21 +140,13 @@ private BigDecimal getRateSourceCryptoVolume(String cryptoCurrency) {
@Override
public BigDecimal getExchangeRateForBuy(String cryptoCurrency, String fiatCurrency) {
BigDecimal rateSourceCryptoVolume = getRateSourceCryptoVolume(cryptoCurrency);
BigDecimal result = calculateBuyPrice(cryptoCurrency, fiatCurrency, rateSourceCryptoVolume);
if (result != null) {
return result.divide(rateSourceCryptoVolume, 2, RoundingMode.UP);
}
return null;
return calculateBuyPrice(cryptoCurrency, fiatCurrency, rateSourceCryptoVolume);
}

@Override
public BigDecimal getExchangeRateForSell(String cryptoCurrency, String fiatCurrency) {
BigDecimal rateSourceCryptoVolume = getRateSourceCryptoVolume(cryptoCurrency);
BigDecimal result = calculateSellPrice(cryptoCurrency, fiatCurrency, rateSourceCryptoVolume);
if (result != null) {
return result.divide(rateSourceCryptoVolume, 2, RoundingMode.DOWN);
}
return null;
return calculateSellPrice(cryptoCurrency, fiatCurrency, rateSourceCryptoVolume);
}

@Override
Expand Down

0 comments on commit 162789f

Please sign in to comment.