mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
feat: Skip trade deepcopy if the callback isn't implemented
closes #10946
This commit is contained in:
@@ -23,9 +23,11 @@ def strategy_safe_wrapper(f: F, message: str = "", default_retval=None, supress_
|
||||
@wraps(f)
|
||||
def wrapper(*args, **kwargs):
|
||||
try:
|
||||
if "trade" in kwargs:
|
||||
# Protect accidental modifications from within the strategy
|
||||
kwargs["trade"] = deepcopy(kwargs["trade"])
|
||||
if not (getattr(f, "__qualname__", "")).startswith("IStrategy."):
|
||||
# Don't deep-copy if the function is not implemented in the user strategy.``
|
||||
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(f"{message}Strategy caused the following exception: {error}{f}")
|
||||
|
||||
Reference in New Issue
Block a user