Update tests for new wallet RPC structure
This commit is contained in:
parent
13e74c5693
commit
d07a24a54f
@ -568,7 +568,6 @@ class RPC:
|
|||||||
def _rpc_balance(self, stake_currency: str, fiat_display_currency: str) -> Dict:
|
def _rpc_balance(self, stake_currency: str, fiat_display_currency: str) -> Dict:
|
||||||
""" Returns current account balance per crypto """
|
""" Returns current account balance per crypto """
|
||||||
currencies = []
|
currencies = []
|
||||||
positions = []
|
|
||||||
total = 0.0
|
total = 0.0
|
||||||
try:
|
try:
|
||||||
tickers = self._freqtrade.exchange.get_tickers(cached=True)
|
tickers = self._freqtrade.exchange.get_tickers(cached=True)
|
||||||
|
@ -636,6 +636,10 @@ def test_rpc_balance_handle(default_conf, mocker, tickers):
|
|||||||
'used': 2.0,
|
'used': 2.0,
|
||||||
'est_stake': 12.0,
|
'est_stake': 12.0,
|
||||||
'stake': 'BTC',
|
'stake': 'BTC',
|
||||||
|
'is_position': False,
|
||||||
|
'leverage': 1.0,
|
||||||
|
'position': 0.0,
|
||||||
|
'side': 'long',
|
||||||
},
|
},
|
||||||
{'free': 1.0,
|
{'free': 1.0,
|
||||||
'balance': 5.0,
|
'balance': 5.0,
|
||||||
@ -643,6 +647,10 @@ def test_rpc_balance_handle(default_conf, mocker, tickers):
|
|||||||
'est_stake': 0.30794,
|
'est_stake': 0.30794,
|
||||||
'used': 4.0,
|
'used': 4.0,
|
||||||
'stake': 'BTC',
|
'stake': 'BTC',
|
||||||
|
'is_position': False,
|
||||||
|
'leverage': 1.0,
|
||||||
|
'position': 0.0,
|
||||||
|
'side': 'long',
|
||||||
|
|
||||||
},
|
},
|
||||||
{'free': 5.0,
|
{'free': 5.0,
|
||||||
@ -651,6 +659,10 @@ def test_rpc_balance_handle(default_conf, mocker, tickers):
|
|||||||
'est_stake': 0.0011563153318162476,
|
'est_stake': 0.0011563153318162476,
|
||||||
'used': 5.0,
|
'used': 5.0,
|
||||||
'stake': 'BTC',
|
'stake': 'BTC',
|
||||||
|
'is_position': False,
|
||||||
|
'leverage': 1.0,
|
||||||
|
'position': 0.0,
|
||||||
|
'side': 'long',
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
assert result['total'] == 12.309096315331816
|
assert result['total'] == 12.309096315331816
|
||||||
|
@ -453,6 +453,10 @@ def test_api_balance(botclient, mocker, rpc_balance, tickers):
|
|||||||
'used': 0.0,
|
'used': 0.0,
|
||||||
'est_stake': 12.0,
|
'est_stake': 12.0,
|
||||||
'stake': 'BTC',
|
'stake': 'BTC',
|
||||||
|
'is_position': False,
|
||||||
|
'leverage': 1.0,
|
||||||
|
'position': 0.0,
|
||||||
|
'side': 'long',
|
||||||
}
|
}
|
||||||
assert 'starting_capital' in response
|
assert 'starting_capital' in response
|
||||||
assert 'starting_capital_fiat' in response
|
assert 'starting_capital_fiat' in response
|
||||||
|
@ -905,6 +905,10 @@ def test_balance_handle_too_large_response(default_conf, update, mocker) -> None
|
|||||||
'balance': i,
|
'balance': i,
|
||||||
'est_stake': 1,
|
'est_stake': 1,
|
||||||
'stake': 'BTC',
|
'stake': 'BTC',
|
||||||
|
'is_position': False,
|
||||||
|
'leverage': 1.0,
|
||||||
|
'position': 0.0,
|
||||||
|
'side': 'long',
|
||||||
})
|
})
|
||||||
mocker.patch('freqtrade.rpc.rpc.RPC._rpc_balance', return_value={
|
mocker.patch('freqtrade.rpc.rpc.RPC._rpc_balance', return_value={
|
||||||
'currencies': balances,
|
'currencies': balances,
|
||||||
|
Loading…
Reference in New Issue
Block a user