Merge branch 'develop' into feat/short
This commit is contained in:
@@ -292,7 +292,7 @@ class BooleanParameter(CategoricalParameter):
|
||||
load=load, **kwargs)
|
||||
|
||||
|
||||
class HyperStrategyMixin(object):
|
||||
class HyperStrategyMixin:
|
||||
"""
|
||||
A helper base class which allows HyperOptAuto class to reuse implementations of buy/sell
|
||||
strategy logic.
|
||||
|
@@ -30,7 +30,7 @@ logger = logging.getLogger(__name__)
|
||||
CUSTOM_SELL_MAX_LENGTH = 64
|
||||
|
||||
|
||||
class SellCheckTuple(object):
|
||||
class SellCheckTuple:
|
||||
"""
|
||||
NamedTuple for Sell type + reason
|
||||
"""
|
||||
@@ -868,7 +868,7 @@ class IStrategy(ABC, HyperStrategyMixin):
|
||||
if self.trailing_stop_positive is not None and bound_profit > sl_offset:
|
||||
stop_loss_value = self.trailing_stop_positive
|
||||
logger.debug(f"{trade.pair} - Using positive stoploss: {stop_loss_value} "
|
||||
f"offset: {sl_offset:.4g} profit: {current_profit:.4f}%")
|
||||
f"offset: {sl_offset:.4g} profit: {current_profit:.2%}")
|
||||
|
||||
trade.adjust_stop_loss(bound or current_rate, stop_loss_value)
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import logging
|
||||
from copy import deepcopy
|
||||
|
||||
from freqtrade.exceptions import StrategyError
|
||||
|
||||
@@ -14,6 +15,9 @@ def strategy_safe_wrapper(f, message: str = "", default_retval=None, supress_err
|
||||
"""
|
||||
def wrapper(*args, **kwargs):
|
||||
try:
|
||||
if 'trade' in kwargs:
|
||||
# Protect accidental modifications from within the strategy
|
||||
kwargs['trade'] = deepcopy(kwargs['trade'])
|
||||
return f(*args, **kwargs)
|
||||
except ValueError as error:
|
||||
logger.warning(
|
||||
|
Reference in New Issue
Block a user