Merge pull request #2251 from freqtrade/telegram_fiatconvert

Telegram fiatconvert with identical currencies
This commit is contained in:
hroff-1902 2019-09-09 21:49:00 +03:00 committed by GitHub
commit f987e6e0f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -104,7 +104,7 @@ class CryptoToFiatConverter(object):
:return: float, value in fiat of the crypto-currency amount
"""
if crypto_symbol == fiat_symbol:
return crypto_amount
return float(crypto_amount)
price = self.get_price(crypto_symbol=crypto_symbol, fiat_symbol=fiat_symbol)
return float(crypto_amount) * float(price)

View File

@ -210,3 +210,10 @@ def test_convert_amount(mocker):
fiat_symbol="BTC"
)
assert result == 1.23
result = fiat_convert.convert_amount(
crypto_amount="1.23",
crypto_symbol="BTC",
fiat_symbol="BTC"
)
assert result == 1.23