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)
|
@wraps(f)
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
try:
|
try:
|
||||||
if "trade" in kwargs:
|
if not (getattr(f, "__qualname__", "")).startswith("IStrategy."):
|
||||||
# Protect accidental modifications from within the strategy
|
# Don't deep-copy if the function is not implemented in the user strategy.``
|
||||||
kwargs["trade"] = deepcopy(kwargs["trade"])
|
if "trade" in kwargs:
|
||||||
|
# Protect accidental modifications from within the strategy
|
||||||
|
kwargs["trade"] = deepcopy(kwargs["trade"])
|
||||||
return f(*args, **kwargs)
|
return f(*args, **kwargs)
|
||||||
except ValueError as error:
|
except ValueError as error:
|
||||||
logger.warning(f"{message}Strategy caused the following exception: {error}{f}")
|
logger.warning(f"{message}Strategy caused the following exception: {error}{f}")
|
||||||
|
|||||||
Reference in New Issue
Block a user