mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
Adjust trade amount by 2% if trade recovery remains above the trade amount
closes #10002
This commit is contained in:
@@ -494,7 +494,23 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
send_msg=prev_trade_state != trade.is_open)
|
send_msg=prev_trade_state != trade.is_open)
|
||||||
else:
|
else:
|
||||||
trade.exit_reason = prev_exit_reason
|
trade.exit_reason = prev_exit_reason
|
||||||
|
total = self.wallets.get_total(trade.base_currency)
|
||||||
|
if total < trade.amount:
|
||||||
|
if total > trade.amount * 0.98:
|
||||||
|
logger.warning(
|
||||||
|
f"{trade} has a total of {trade.amount} {trade.base_currency}, "
|
||||||
|
f"but the Wallet shows a total of {total} {trade.base_currency}. "
|
||||||
|
f"Adjusting trade amount to {total}."
|
||||||
|
"This may however lead to further issues."
|
||||||
|
)
|
||||||
|
trade.amount = total
|
||||||
|
else:
|
||||||
|
logger.warning(
|
||||||
|
f"{trade} has a total of {trade.amount} {trade.base_currency}, "
|
||||||
|
f"but the Wallet shows a total of {total} {trade.base_currency}. "
|
||||||
|
"Refusing to adjust as the difference is too large."
|
||||||
|
"This may however lead to further issues."
|
||||||
|
)
|
||||||
if prev_trade_amount != trade.amount:
|
if prev_trade_amount != trade.amount:
|
||||||
# Cancel stoploss on exchange if the amount changed
|
# Cancel stoploss on exchange if the amount changed
|
||||||
trade = self.cancel_stoploss_on_exchange(trade)
|
trade = self.cancel_stoploss_on_exchange(trade)
|
||||||
|
|||||||
Reference in New Issue
Block a user