mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Warning message for open trades when stopping bot
This commit is contained in:
parent
baaf7f1c54
commit
e813573f27
|
@ -175,6 +175,19 @@ class FreqtradeBot:
|
||||||
if self.config['cancel_open_orders_on_exit']:
|
if self.config['cancel_open_orders_on_exit']:
|
||||||
self.cancel_all_open_orders()
|
self.cancel_all_open_orders()
|
||||||
|
|
||||||
|
def check_for_open_trades(self):
|
||||||
|
open_trades = Trade.get_trades([Trade.is_open == True,
|
||||||
|
]).all()
|
||||||
|
|
||||||
|
if len(open_trades) is not 0:
|
||||||
|
msg = {
|
||||||
|
f'type': RPCMessageType.WARNING_NOTIFICATION,
|
||||||
|
f'status': f'{len(open_trades)} OPEN TRADES ACTIVE\n\n'
|
||||||
|
f'Handle these trades manually or \'/start\' the bot again '
|
||||||
|
f'and use \'/stopbuy\' to handle open trades gracefully.'
|
||||||
|
}
|
||||||
|
self.rpc.send_msg(msg)
|
||||||
|
|
||||||
def _refresh_active_whitelist(self, trades: List[Trade] = []) -> List[str]:
|
def _refresh_active_whitelist(self, trades: List[Trade] = []) -> List[str]:
|
||||||
"""
|
"""
|
||||||
Refresh active whitelist from pairlist or edge and extend it with
|
Refresh active whitelist from pairlist or edge and extend it with
|
||||||
|
|
|
@ -90,6 +90,9 @@ class Worker:
|
||||||
if state == State.RUNNING:
|
if state == State.RUNNING:
|
||||||
self.freqtrade.startup()
|
self.freqtrade.startup()
|
||||||
|
|
||||||
|
if state == State.STOPPED:
|
||||||
|
self.freqtrade.check_for_open_trades()
|
||||||
|
|
||||||
# Reset heartbeat timestamp to log the heartbeat message at
|
# Reset heartbeat timestamp to log the heartbeat message at
|
||||||
# first throttling iteration when the state changes
|
# first throttling iteration when the state changes
|
||||||
self._heartbeat_msg = 0
|
self._heartbeat_msg = 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user