Telegram and log prints strategy version.

This commit is contained in:
Dardon 2021-11-20 16:26:07 +00:00
parent 06c81b5234
commit d4fd13bf50
3 changed files with 17 additions and 3 deletions

View File

@ -1304,7 +1304,11 @@ class Telegram(RPCHandler):
:param update: message update
:return: None
"""
self._send_msg('*Version:* `{}`'.format(__version__))
strategy_version = self._rpc._freqtrade.strategy.version()
if strategy_version is None:
self._send_msg('*Version:* `{}`'.format(__version__))
else:
self._send_msg('*Freqtrade version:* `{}`, *Strategy version:* `{}`'.format(__version__, strategy_version))
@authorized_only
def _show_config(self, update: Update, context: CallbackContext) -> None:

View File

@ -394,6 +394,12 @@ class IStrategy(ABC, HyperStrategyMixin):
"""
return []
def version(self) -> str:
"""
Returns version of the strategy.
"""
return None
###
# END - Intended to be overridden by strategy
###

View File

@ -113,8 +113,12 @@ class Worker:
if self._heartbeat_interval:
now = time.time()
if (now - self._heartbeat_msg) > self._heartbeat_interval:
version = __version__
strategy_version = self.freqtrade.strategy.version()
if (strategy_version != None):
version += ', strategy_version: ' + strategy_version
logger.info(f"Bot heartbeat. PID={getpid()}, "
f"version='{__version__}', state='{state.name}'")
f"version='{version}', state='{state.name}'")
self._heartbeat_msg = now
return state