Implement last_stake_amount_min_ratio

This commit is contained in:
Matthias
2020-01-10 06:36:28 +01:00
parent e94dfdeff2
commit fab19ae3a7
5 changed files with 28 additions and 8 deletions

View File

@@ -80,6 +80,9 @@ CONF_SCHEMA = {
'default': 0.99
},
'amend_last_stake_amount': {'type': 'boolean', 'default': False},
'last_stake_amount_min_ratio': {
'type': 'number', 'minimum': 0.0, 'maximum': 1.0, 'default': 0.5
},
'fiat_display_currency': {'type': 'string', 'enum': SUPPORTED_FIAT},
'dry_run': {'type': 'boolean'},
'dry_run_wallet': {'type': 'number', 'default': DRY_RUN_WALLET},
@@ -284,6 +287,7 @@ SCHEMA_TRADE_REQUIRED = [
'stake_currency',
'stake_amount',
'tradable_balance_ratio',
'last_stake_amount_min_ratio',
'dry_run',
'dry_run_wallet',
'bid_strategy',

View File

@@ -312,7 +312,12 @@ class FreqtradeBot:
available_amount = self._get_available_stake_amount()
if self.config['amend_last_stake_amount']:
stake_amount = min(stake_amount, available_amount)
# Remaining amount needs to be at least stake_amount * last_stake_amount_min_ratio
# Otherwise the remaining amount is too low to trade.
if available_amount > (stake_amount * self.config['last_stake_amount_min_ratio']):
stake_amount = min(stake_amount, available_amount)
else:
stake_amount = 0
if available_amount < stake_amount:
raise DependencyException(