Move lookback_period to parent __init__
This commit is contained in:
parent
f13e9ce5ed
commit
eb952d77be
@ -21,8 +21,10 @@ All protection end times are rounded up to the next candle to avoid sudden, unex
|
||||
|
||||
### Common settings to all Protections
|
||||
|
||||
* `method` - Protection name to use.
|
||||
* `stop_duration` (minutes) - how long should protections be locked.
|
||||
* `lookback_period` (minutes) - Only trades that completed after `current_time - lookback_period` will be considered (may be ignored by some Protections).
|
||||
* `trade_limit` - How many trades are required at minimum (not used by all Protections).
|
||||
|
||||
#### Stoploss Guard
|
||||
|
||||
|
@ -24,6 +24,7 @@ class IProtection(LoggingMixin, ABC):
|
||||
self._config = config
|
||||
self._protection_config = protection_config
|
||||
self._stop_duration = protection_config.get('stop_duration', 60)
|
||||
self._lookback_period = protection_config.get('lookback_period', 60)
|
||||
|
||||
LoggingMixin.__init__(self, logger)
|
||||
|
||||
|
@ -18,7 +18,6 @@ class LowProfitPairs(IProtection):
|
||||
def __init__(self, config: Dict[str, Any], protection_config: Dict[str, Any]) -> None:
|
||||
super().__init__(config, protection_config)
|
||||
|
||||
self._lookback_period = protection_config.get('lookback_period', 60)
|
||||
self._trade_limit = protection_config.get('trade_limit', 1)
|
||||
self._required_profit = protection_config.get('required_profit', 0.0)
|
||||
|
||||
|
@ -21,7 +21,6 @@ class MaxDrawdown(IProtection):
|
||||
def __init__(self, config: Dict[str, Any], protection_config: Dict[str, Any]) -> None:
|
||||
super().__init__(config, protection_config)
|
||||
|
||||
self._lookback_period = protection_config.get('lookback_period', 60)
|
||||
self._trade_limit = protection_config.get('trade_limit', 1)
|
||||
self._max_allowed_drawdown = protection_config.get('max_allowed_drawdown', 0.0)
|
||||
# TODO: Implement checks to limit max_drawdown to sensible values
|
||||
|
@ -21,7 +21,6 @@ class StoplossGuard(IProtection):
|
||||
def __init__(self, config: Dict[str, Any], protection_config: Dict[str, Any]) -> None:
|
||||
super().__init__(config, protection_config)
|
||||
|
||||
self._lookback_period = protection_config.get('lookback_period', 60)
|
||||
self._trade_limit = protection_config.get('trade_limit', 10)
|
||||
self._disable_global_stop = protection_config.get('only_per_pair', False)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user