Improve login-mixin structure

This commit is contained in:
Matthias
2020-11-22 11:49:41 +01:00
parent 8d9c66a638
commit 8f958ef723
14 changed files with 35 additions and 35 deletions

View File

@@ -1,6 +1,6 @@
import logging
from datetime import datetime, timedelta, timezone
from datetime import datetime, timedelta
from typing import Any, Dict
from freqtrade.persistence import Trade
@@ -46,7 +46,7 @@ class CooldownPeriod(IProtection):
]
trade = Trade.get_trades(filters).first()
if trade:
self.log_once(logger.info, f"Cooldown for {pair} for {self._stop_duration}.")
self.log_once(f"Cooldown for {pair} for {self._stop_duration}.", logger.info)
until = self.calculate_lock_end([trade], self._stop_duration)
return True, until, self._reason()

View File

@@ -1,6 +1,6 @@
import logging
from abc import ABC, abstractmethod, abstractproperty
from abc import ABC, abstractmethod
from datetime import datetime, timedelta, timezone
from typing import Any, Dict, List, Optional, Tuple

View File

@@ -58,9 +58,8 @@ class LowProfitPairs(IProtection):
profit = sum(trade.close_profit for trade in trades)
if profit < self._required_profit:
self.log_once(
logger.info,
f"Trading for {pair} stopped due to {profit:.2f} < {self._required_profit} "
f"within {self._lookback_period} minutes.")
f"within {self._lookback_period} minutes.", logger.info)
until = self.calculate_lock_end(trades, self._stop_duration)
return True, until, self._reason(profit)

View File

@@ -58,8 +58,8 @@ class StoplossGuard(IProtection):
trades = Trade.get_trades(filters).all()
if len(trades) > self._trade_limit:
self.log_once(logger.info, f"Trading stopped due to {self._trade_limit} "
f"stoplosses within {self._lookback_period} minutes.")
self.log_once(f"Trading stopped due to {self._trade_limit} "
f"stoplosses within {self._lookback_period} minutes.", logger.info)
until = self.calculate_lock_end(trades, self._stop_duration)
return True, until, self._reason()