Allow wallet update from /balance
This commit is contained in:
parent
4013701bdb
commit
c8806a16a1
@ -306,6 +306,8 @@ class RPC:
|
|||||||
except (TemporaryError, DependencyException):
|
except (TemporaryError, DependencyException):
|
||||||
raise RPCException('Error getting current tickers.')
|
raise RPCException('Error getting current tickers.')
|
||||||
|
|
||||||
|
self._freqtrade.wallets.update(require_update=False)
|
||||||
|
|
||||||
for coin, balance in self._freqtrade.wallets.get_all_balances().items():
|
for coin, balance in self._freqtrade.wallets.get_all_balances().items():
|
||||||
if not balance.total:
|
if not balance.total:
|
||||||
continue
|
continue
|
||||||
|
@ -32,7 +32,7 @@ def test_sync_wallet_at_boot(mocker, default_conf):
|
|||||||
assert freqtrade.wallets._wallets['GAS'].used == 0.0
|
assert freqtrade.wallets._wallets['GAS'].used == 0.0
|
||||||
assert freqtrade.wallets._wallets['GAS'].total == 0.260739
|
assert freqtrade.wallets._wallets['GAS'].total == 0.260739
|
||||||
assert freqtrade.wallets.get_free('BNT') == 1.0
|
assert freqtrade.wallets.get_free('BNT') == 1.0
|
||||||
|
assert freqtrade.wallets._last_wallet_refresh > 0
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
'freqtrade.exchange.Exchange',
|
||||||
get_balances=MagicMock(return_value={
|
get_balances=MagicMock(return_value={
|
||||||
@ -61,6 +61,11 @@ def test_sync_wallet_at_boot(mocker, default_conf):
|
|||||||
assert freqtrade.wallets.get_free('GAS') == 0.270739
|
assert freqtrade.wallets.get_free('GAS') == 0.270739
|
||||||
assert freqtrade.wallets.get_used('GAS') == 0.1
|
assert freqtrade.wallets.get_used('GAS') == 0.1
|
||||||
assert freqtrade.wallets.get_total('GAS') == 0.260439
|
assert freqtrade.wallets.get_total('GAS') == 0.260439
|
||||||
|
update_mock = mocker.patch('freqtrade.wallets.Wallets._update_live')
|
||||||
|
freqtrade.wallets.update(False)
|
||||||
|
assert update_mock.call_count == 0
|
||||||
|
freqtrade.wallets.update()
|
||||||
|
assert update_mock.call_count == 1
|
||||||
|
|
||||||
|
|
||||||
def test_sync_wallet_missing_data(mocker, default_conf):
|
def test_sync_wallet_missing_data(mocker, default_conf):
|
||||||
|
Loading…
Reference in New Issue
Block a user