[SQUASH] Use HyperStrategyMixin as part of IStrategy interface.

This commit is contained in:
Rokas Kupstys
2021-03-24 16:03:38 +02:00
parent 2d13e5fd50
commit e9f0babe8a
6 changed files with 6 additions and 24 deletions

View File

@@ -2,6 +2,5 @@
from freqtrade.exchange import (timeframe_to_minutes, timeframe_to_msecs, timeframe_to_next_date,
timeframe_to_prev_date, timeframe_to_seconds)
from freqtrade.strategy.interface import IStrategy
from freqtrade.strategy.hyper import HyperStrategyMixin, IntParameter, FloatParameter,\
CategoricalParameter
from freqtrade.strategy.hyper import IntParameter, FloatParameter, CategoricalParameter
from freqtrade.strategy.strategy_helper import merge_informative_pair, stoploss_from_open

View File

@@ -135,13 +135,9 @@ class HyperStrategyMixin(object):
strategy logic.
"""
# Hint that class can be used with HyperOptAuto.
HYPER_STRATEGY = 1
def __init__(self):
"""
Initialize hyperoptable strategy mixin.
:param config:
"""
self._load_params(getattr(self, 'buy_params', None))
self._load_params(getattr(self, 'sell_params', None))

View File

@@ -18,6 +18,7 @@ from freqtrade.exceptions import OperationalException, StrategyError
from freqtrade.exchange import timeframe_to_minutes, timeframe_to_seconds
from freqtrade.exchange.exchange import timeframe_to_next_date
from freqtrade.persistence import PairLocks, Trade
from freqtrade.strategy.hyper import HyperStrategyMixin
from freqtrade.strategy.strategy_wrapper import strategy_safe_wrapper
from freqtrade.wallets import Wallets
@@ -59,7 +60,7 @@ class SellCheckTuple(NamedTuple):
sell_type: SellType
class IStrategy(ABC):
class IStrategy(ABC, HyperStrategyMixin):
"""
Interface for freqtrade strategies
Defines the mandatory structure must follow any custom strategies