From e2e00151194f43d98dc857cf5d321c2fed86c712 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 5 Sep 2019 20:02:01 +0200 Subject: [PATCH] Don't rename dict ... we can use it as is --- freqtrade/rpc/rpc.py | 4 ++-- freqtrade/rpc/telegram.py | 4 ++-- freqtrade/tests/rpc/test_rpc.py | 16 ++++++++-------- freqtrade/tests/rpc/test_rpc_apiserver.py | 4 ++-- freqtrade/tests/rpc/test_rpc_telegram.py | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/freqtrade/rpc/rpc.py b/freqtrade/rpc/rpc.py index 7b811cadc..8112b33bf 100644 --- a/freqtrade/rpc/rpc.py +++ b/freqtrade/rpc/rpc.py @@ -294,9 +294,9 @@ class RPC(object): total = total + est_btc output.append({ 'currency': coin, - 'available': balance['free'], + 'free': balance['free'], 'balance': balance['total'], - 'pending': balance['used'], + 'used': balance['used'], 'est_btc': est_btc, }) if total == 0.0: diff --git a/freqtrade/rpc/telegram.py b/freqtrade/rpc/telegram.py index d11fc02ab..80582a0ce 100644 --- a/freqtrade/rpc/telegram.py +++ b/freqtrade/rpc/telegram.py @@ -328,9 +328,9 @@ class Telegram(RPC): for currency in result['currencies']: if currency['est_btc'] > 0.0001: curr_output = "*{currency}:*\n" \ - "\t`Available: {available: .8f}`\n" \ + "\t`Available: {free: .8f}`\n" \ "\t`Balance: {balance: .8f}`\n" \ - "\t`Pending: {pending: .8f}`\n" \ + "\t`Pending: {used: .8f}`\n" \ "\t`Est. BTC: {est_btc: .8f}`\n".format(**currency) else: curr_output = "*{currency}:* not showing <1$ amount \n".format(**currency) diff --git a/freqtrade/tests/rpc/test_rpc.py b/freqtrade/tests/rpc/test_rpc.py index 5d3fb7920..47ed34a58 100644 --- a/freqtrade/tests/rpc/test_rpc.py +++ b/freqtrade/tests/rpc/test_rpc.py @@ -363,9 +363,9 @@ def test_rpc_balance_handle_error(default_conf, mocker): assert 'USD' == result['symbol'] assert result['currencies'] == [{ 'currency': 'BTC', - 'available': 10.0, + 'free': 10.0, 'balance': 12.0, - 'pending': 2.0, + 'used': 2.0, 'est_btc': 12.0, }] assert result['total'] == 12.0 @@ -417,22 +417,22 @@ def test_rpc_balance_handle(default_conf, mocker): assert 'USD' == result['symbol'] assert result['currencies'] == [ {'currency': 'BTC', - 'available': 10.0, + 'free': 10.0, 'balance': 12.0, - 'pending': 2.0, + 'used': 2.0, 'est_btc': 12.0, }, - {'available': 1.0, + {'free': 1.0, 'balance': 5.0, 'currency': 'ETH', 'est_btc': 0.05, - 'pending': 4.0 + 'used': 4.0 }, - {'available': 5.0, + {'free': 5.0, 'balance': 10.0, 'currency': 'PAX', 'est_btc': 0.1, - 'pending': 5.0} + 'used': 5.0} ] assert result['total'] == 12.15 diff --git a/freqtrade/tests/rpc/test_rpc_apiserver.py b/freqtrade/tests/rpc/test_rpc_apiserver.py index 794343a98..bcbbb228f 100644 --- a/freqtrade/tests/rpc/test_rpc_apiserver.py +++ b/freqtrade/tests/rpc/test_rpc_apiserver.py @@ -251,9 +251,9 @@ def test_api_balance(botclient, mocker, rpc_balance): assert len(rc.json["currencies"]) == 5 assert rc.json['currencies'][0] == { 'currency': 'BTC', - 'available': 12.0, + 'free': 12.0, 'balance': 12.0, - 'pending': 0.0, + 'used': 0.0, 'est_btc': 12.0, } diff --git a/freqtrade/tests/rpc/test_rpc_telegram.py b/freqtrade/tests/rpc/test_rpc_telegram.py index 3820332b8..3930b110d 100644 --- a/freqtrade/tests/rpc/test_rpc_telegram.py +++ b/freqtrade/tests/rpc/test_rpc_telegram.py @@ -577,8 +577,8 @@ def test_balance_handle_too_large_response(default_conf, update, mocker) -> None curr = choice(ascii_uppercase) + choice(ascii_uppercase) + choice(ascii_uppercase) balances.append({ 'currency': curr, - 'available': 1.0, - 'pending': 0.5, + 'free': 1.0, + 'used': 0.5, 'balance': i, 'est_btc': 1 })