diff --git a/config_full.json.example b/config_full.json.example
index 981fc5209..f39abb00c 100644
--- a/config_full.json.example
+++ b/config_full.json.example
@@ -5,6 +5,7 @@
"tradable_balance_ratio": 0.99,
"fiat_display_currency": "USD",
"amount_reserve_percent" : 0.05,
+ "amend_last_stake_amount": false,
"dry_run": false,
"ticker_interval": "5m",
"trailing_stop": false,
diff --git a/docs/configuration.md b/docs/configuration.md
index 3b8760366..9a05eea2d 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -44,6 +44,7 @@ Mandatory parameters are marked as **Required**, which means that they are requi
| `stake_currency` | **Required.** Crypto-currency used for trading. [Strategy Override](#parameters-in-the-strategy).
***Datatype:*** *String*
| `stake_amount` | **Required.** Amount of crypto-currency your bot will use for each trade. Set it to `"unlimited"` to allow the bot to use all available balance. [More information below](#configuring-amount-per-trade). [Strategy Override](#parameters-in-the-strategy).
***Datatype:*** *Positive float or `"unlimited"`.*
| `tradable_balance_ratio` | Ratio of the total account balance the bot is allowed to trade. [More information below](#configuring-amount-per-trade).
*Defaults to `0.99` 99%).*
***Datatype:*** *Positive float between `0.1` and `1.0`.*
+| `amend_last_stake_amount` | **Required.** Use reduced last stake amount if necessary. [More information below](#configuring-amount-per-trade).
*Defaults to `false`.*
***Datatype:*** *Boolean*
| `amount_reserve_percent` | Reserve some amount in min pair stake amount. The bot will reserve `amount_reserve_percent` + stoploss value when calculating min pair stake amount in order to avoid possible trade refusals.
*Defaults to `0.05` (5%).*
***Datatype:*** *Positive Float as ratio.*
| `ticker_interval` | The ticker interval to use (e.g `1m`, `5m`, `15m`, `30m`, `1h` ...). [Strategy Override](#parameters-in-the-strategy).
***Datatype:*** *String*
| `fiat_display_currency` | Fiat currency used to show your profits. [More information below](#what-values-can-be-used-for-fiat_display_currency).
***Datatype:*** *String*
@@ -146,6 +147,22 @@ For example, if you have 10 ETH available in your wallet on the exchange and `tr
!!! Warning
`tradable_balance_ratio` applies to the current balance (free balance + tied up in trades). Therefore, assuming a starting balance of 1000, a configuration of `tradable_balance_ratio=0.99` will not guarantee that 10 units will always remain available on the exchange. The free amount may reduce to 5 units if the total balance is reduce to 500 (either by a losing streak, or by withdrawing balance).
+#### Amend last stake amount
+
+Assuming we have a `balance=1000` (USDT), `stake_amount=400`, and `max_open_trades=3`.
+The bot would open 2 trades, and will be unable to fill the last trading slot, since the requested 400 USDT are no longer available, since 800 USDT are already tied in other trades.
+
+To overcome this, the option `amend_last_stake_amount` can be set to `True`, which will enable the bot to reduce stake_amount to the available balance in order to fill the last trade slot.
+
+In the example above this would mean:
+
+- Trade1: 400 USDT
+- Trade2: 400 USDT
+- Trade3: 200 USDT
+
+!!! Note
+ This option only applies with [Static stake amount](#static-stake-amount) - since [Dynamic stake amount](#dynamic-stake-amount) divides the balances evenly.
+
#### Static stake amount
The `stake_amount` configuration statically configures the amount of stake-currency your bot will use for each trade.
diff --git a/freqtrade/constants.py b/freqtrade/constants.py
index ca4f3cf36..a1bd70183 100644
--- a/freqtrade/constants.py
+++ b/freqtrade/constants.py
@@ -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',
diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py
index 6c02844f1..5aacdc587 100644
--- a/freqtrade/freqtradebot.py
+++ b/freqtrade/freqtradebot.py
@@ -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 "