Implement amend_last_stake_amount

This commit is contained in:
Matthias
2020-01-05 13:25:11 +01:00
parent a75420f75f
commit b37f34ff5b
4 changed files with 23 additions and 0 deletions

View File

@@ -79,6 +79,7 @@ CONF_SCHEMA = {
'maximum': 1,
'default': 0.99
},
'amend_last_stake_amount': {'type': 'boolean', 'default': False},
'fiat_display_currency': {'type': 'string', 'enum': SUPPORTED_FIAT},
'dry_run': {'type': 'boolean'},
'dry_run_wallet': {'type': 'number', 'default': DRY_RUN_WALLET},
@@ -282,6 +283,7 @@ SCHEMA_TRADE_REQUIRED = [
'max_open_trades',
'stake_currency',
'stake_amount',
'tradable_balance_ratio',
'dry_run',
'dry_run_wallet',
'bid_strategy',

View File

@@ -308,6 +308,9 @@ class FreqtradeBot:
"""
available_amount = self._get_available_stake_amount()
if self.config['amend_last_stake_amount']:
stake_amount = min(stake_amount, available_amount)
if available_amount < stake_amount:
raise DependencyException(
f"Available balance ({available_amount} {self.config['stake_currency']}) is "