Improve some formatting and typehints
This commit is contained in:
parent
ec40e79362
commit
f9e2e87346
@ -512,7 +512,7 @@ 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: List[Dict] = []
|
||||||
total = 0.0
|
total = 0.0
|
||||||
try:
|
try:
|
||||||
tickers = self._freqtrade.exchange.get_tickers(cached=True)
|
tickers = self._freqtrade.exchange.get_tickers(cached=True)
|
||||||
@ -547,13 +547,12 @@ class RPC:
|
|||||||
except (ExchangeError):
|
except (ExchangeError):
|
||||||
logger.warning(f" Could not get rate for pair {coin}.")
|
logger.warning(f" Could not get rate for pair {coin}.")
|
||||||
continue
|
continue
|
||||||
total = total + (est_stake or 0)
|
total = total + est_stake
|
||||||
currencies.append({
|
currencies.append({
|
||||||
'currency': coin,
|
'currency': coin,
|
||||||
# TODO: The below can be simplified if we don't assign None to values.
|
'free': balance.free,
|
||||||
'free': balance.free if balance.free is not None else 0,
|
'balance': balance.total,
|
||||||
'balance': balance.total if balance.total is not None else 0,
|
'used': balance.used,
|
||||||
'used': balance.used if balance.used is not None else 0,
|
|
||||||
'est_stake': est_stake or 0,
|
'est_stake': est_stake or 0,
|
||||||
'stake': stake_currency,
|
'stake': stake_currency,
|
||||||
'side': 'long',
|
'side': 'long',
|
||||||
@ -583,7 +582,6 @@ class RPC:
|
|||||||
total, stake_currency, fiat_display_currency) if self._fiat_converter else 0
|
total, stake_currency, fiat_display_currency) if self._fiat_converter else 0
|
||||||
|
|
||||||
trade_count = len(Trade.get_trades_proxy())
|
trade_count = len(Trade.get_trades_proxy())
|
||||||
starting_capital_ratio = 0.0
|
|
||||||
starting_capital_ratio = (total / starting_capital) - 1 if starting_capital else 0.0
|
starting_capital_ratio = (total / starting_capital) - 1 if starting_capital else 0.0
|
||||||
starting_cap_fiat_ratio = (value / starting_cap_fiat) - 1 if starting_cap_fiat else 0.0
|
starting_cap_fiat_ratio = (value / starting_cap_fiat) - 1 if starting_cap_fiat else 0.0
|
||||||
|
|
||||||
@ -871,7 +869,7 @@ class RPC:
|
|||||||
else:
|
else:
|
||||||
errors[pair] = {
|
errors[pair] = {
|
||||||
'error_msg': f"Pair {pair} is not in the current blacklist."
|
'error_msg': f"Pair {pair} is not in the current blacklist."
|
||||||
}
|
}
|
||||||
resp = self._rpc_blacklist()
|
resp = self._rpc_blacklist()
|
||||||
resp['errors'] = errors
|
resp['errors'] = errors
|
||||||
return resp
|
return resp
|
||||||
|
Loading…
Reference in New Issue
Block a user