feat: add fmt_coin2

This commit is contained in:
Matthias
2024-11-12 19:02:47 +01:00
parent 4e5ae0af84
commit 98dcc08c6d
3 changed files with 32 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
from freqtrade.util import decimals_per_coin, fmt_coin, round_value
from freqtrade.util.formatters import fmt_coin2
def test_decimals_per_coin():
@@ -25,6 +26,16 @@ def test_fmt_coin():
assert fmt_coin(222.2, "USDT", False, True) == "222.200"
def test_fmt_coin2():
assert fmt_coin2(222.222222, "USDT") == "222.222222 USDT"
assert fmt_coin2(222.2, "XRP", 3, keep_trailing_zeros=True) == "222.200 XRP"
assert fmt_coin2(222.2, "USDT") == "222.2 USDT"
assert fmt_coin2(222.12745, "EUR") == "222.12745 EUR"
assert fmt_coin2(0.1274512123, "BTC") == "0.12745121 BTC"
assert fmt_coin2(0.1274512123, "ETH") == "0.12745121 ETH"
assert fmt_coin2(0.00001245, "PEPE") == "0.00001245 PEPE"
def test_round_value():
assert round_value(222.222222, 3) == "222.222"
assert round_value(222.2, 3) == "222.2"