Use sensible defaults for balance_dust_level

This commit is contained in:
Matthias
2021-02-28 09:03:27 +01:00
parent 0895407811
commit a13dc3cdde
5 changed files with 18 additions and 5 deletions

View File

@@ -54,6 +54,11 @@ DECIMALS_PER_COIN = {
'ETH': 5,
}
DUST_PER_COIN = {
'BTC': 0.0001,
'ETH': 0.01
}
# Soure files with destination directories within user-directory
USER_DATA_FILES = {
@@ -230,6 +235,7 @@ CONF_SCHEMA = {
'enabled': {'type': 'boolean'},
'token': {'type': 'string'},
'chat_id': {'type': 'string'},
'balance_dust_level': {'type': 'number', 'minimum': 0.0},
'notification_settings': {
'type': 'object',
'properties': {
@@ -244,7 +250,6 @@ CONF_SCHEMA = {
}
},
'required': ['enabled', 'token', 'chat_id'],
'balance_dust_level': 0.0001
},
'webhook': {
'type': 'object',

View File

@@ -17,6 +17,7 @@ from telegram.ext import CallbackContext, CommandHandler, Updater
from telegram.utils.helpers import escape_markdown
from freqtrade.__init__ import __version__
from freqtrade.constants import DUST_PER_COIN
from freqtrade.exceptions import OperationalException
from freqtrade.misc import round_coin_value
from freqtrade.rpc import RPC, RPCException, RPCHandler, RPCMessageType
@@ -487,7 +488,9 @@ class Telegram(RPCHandler):
result = self._rpc._rpc_balance(self._config['stake_currency'],
self._config.get('fiat_display_currency', ''))
balance_dust_level = self._config['telegram'].get('balance_dust_level', 0.0001 )
balance_dust_level = self._config['telegram'].get('balance_dust_level', 0.0)
if not balance_dust_level:
balance_dust_level = DUST_PER_COIN.get(self._config['stake_currency'], 1.0)
output = ''
if self._config['dry_run']:
@@ -507,7 +510,8 @@ class Telegram(RPCHandler):
f"\t`Est. {curr['stake']}: "
f"{round_coin_value(curr['est_stake'], curr['stake'], False)}`\n")
else:
curr_output = f"*{curr['currency']}:* not showing <{balance_dust_level} {curr['stake']} amount \n"
curr_output = (f"*{curr['currency']}:* not showing <{balance_dust_level} "
f"{curr['stake']} amount \n")
# Handle overflowing messsage length
if len(output + curr_output) >= MAX_TELEGRAM_MESSAGE_LENGTH: