Call connection at intervals

This commit is contained in:
Matthias
2024-05-31 06:52:11 +02:00
parent 33e61b1308
commit 12852438a5
2 changed files with 10 additions and 2 deletions

View File

@@ -563,6 +563,13 @@ class Exchange:
amount, self.get_precision_amount(pair), self.precisionMode, contract_size
)
def ws_connection_reset(self):
"""
called at regular intervals to reset the websocket connection
"""
if self._exchange_ws:
self._exchange_ws.reset_connections()
def _load_async_markets(self, reload: bool = False) -> None:
try:
if self._api_async:

View File

@@ -168,6 +168,8 @@ class FreqtradeBot(LoggingMixin):
t = str(time(time_slot, minutes, 2))
self._schedule.every().day.at(t).do(update)
self._schedule.every().day.at("00:02").do(self.exchange.ws_connection_reset)
self.strategy.ft_bot_start()
# Initialize protections AFTER bot start - otherwise parameters are not loaded.
self.protections = ProtectionManager(self.config, self.strategy.protections)
@@ -289,7 +291,6 @@ class FreqtradeBot(LoggingMixin):
# Then looking for entry opportunities
if self.get_free_open_trades():
self.enter_positions()
if self.trading_mode == TradingMode.FUTURES:
self._schedule.run_pending()
Trade.commit()
self.rpc.process_msg_queue(self.dataprovider._msg_queue)