mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Move stop_duration to parent class
avoids reimplementation and enhances standardization
This commit is contained in:
parent
12e84bda1e
commit
4351a26b4c
|
@ -200,6 +200,9 @@ For that reason, they must implement the following methods:
|
||||||
|
|
||||||
The `until` portion should be calculated using the provided `calculate_lock_end()` method.
|
The `until` portion should be calculated using the provided `calculate_lock_end()` method.
|
||||||
|
|
||||||
|
All Protections should use `"stop_duration"` to define how long a a pair (or all pairs) should be locked.
|
||||||
|
The content of this is made available as `self._stop_duration` to the each Protection.
|
||||||
|
|
||||||
#### Global vs. local stops
|
#### Global vs. local stops
|
||||||
|
|
||||||
Protections can have 2 different ways to stop trading for a limited :
|
Protections can have 2 different ways to stop trading for a limited :
|
||||||
|
|
|
@ -20,8 +20,6 @@ class CooldownPeriod(IProtection):
|
||||||
def __init__(self, config: Dict[str, Any], protection_config: Dict[str, Any]) -> None:
|
def __init__(self, config: Dict[str, Any], protection_config: Dict[str, Any]) -> None:
|
||||||
super().__init__(config, protection_config)
|
super().__init__(config, protection_config)
|
||||||
|
|
||||||
self._stop_duration = protection_config.get('stop_duration', 60)
|
|
||||||
|
|
||||||
def _reason(self) -> str:
|
def _reason(self) -> str:
|
||||||
"""
|
"""
|
||||||
LockReason to use
|
LockReason to use
|
||||||
|
|
|
@ -23,6 +23,8 @@ class IProtection(LoggingMixin, ABC):
|
||||||
def __init__(self, config: Dict[str, Any], protection_config: Dict[str, Any]) -> None:
|
def __init__(self, config: Dict[str, Any], protection_config: Dict[str, Any]) -> None:
|
||||||
self._config = config
|
self._config = config
|
||||||
self._protection_config = protection_config
|
self._protection_config = protection_config
|
||||||
|
self._stop_duration = protection_config.get('stop_duration', 60)
|
||||||
|
|
||||||
LoggingMixin.__init__(self, logger)
|
LoggingMixin.__init__(self, logger)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -22,7 +22,6 @@ class LowProfitPairs(IProtection):
|
||||||
|
|
||||||
self._lookback_period = protection_config.get('lookback_period', 60)
|
self._lookback_period = protection_config.get('lookback_period', 60)
|
||||||
self._trade_limit = protection_config.get('trade_limit', 1)
|
self._trade_limit = protection_config.get('trade_limit', 1)
|
||||||
self._stop_duration = protection_config.get('stop_duration', 60)
|
|
||||||
self._required_profit = protection_config.get('required_profit', 0.0)
|
self._required_profit = protection_config.get('required_profit', 0.0)
|
||||||
|
|
||||||
def short_desc(self) -> str:
|
def short_desc(self) -> str:
|
||||||
|
|
|
@ -25,7 +25,6 @@ class StoplossGuard(IProtection):
|
||||||
|
|
||||||
self._lookback_period = protection_config.get('lookback_period', 60)
|
self._lookback_period = protection_config.get('lookback_period', 60)
|
||||||
self._trade_limit = protection_config.get('trade_limit', 10)
|
self._trade_limit = protection_config.get('trade_limit', 10)
|
||||||
self._stop_duration = protection_config.get('stop_duration', 60)
|
|
||||||
self._disable_global_stop = protection_config.get('only_per_pair', False)
|
self._disable_global_stop = protection_config.get('only_per_pair', False)
|
||||||
|
|
||||||
def short_desc(self) -> str:
|
def short_desc(self) -> str:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user