mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-15 20:31:43 +00:00
fix: don't restrict spaces - explicitly defined space should win
This commit is contained in:
@@ -174,24 +174,15 @@ def detect_all_parameters(
|
|||||||
attr = getattr(obj, attr_name)
|
attr = getattr(obj, attr_name)
|
||||||
if not issubclass(attr.__class__, BaseParameter):
|
if not issubclass(attr.__class__, BaseParameter):
|
||||||
continue
|
continue
|
||||||
auto_category: str | None = None
|
if not attr.category:
|
||||||
# Category auto detection
|
# Category auto detection
|
||||||
for category in auto_categories:
|
for category in auto_categories:
|
||||||
if attr_name.startswith(category + "_"):
|
if attr_name.startswith(category + "_"):
|
||||||
auto_category = category
|
attr.category = category
|
||||||
break
|
break
|
||||||
if auto_category is None and attr.category is None:
|
if attr.category is None:
|
||||||
raise OperationalException(f"Cannot determine parameter space for {attr_name}.")
|
raise OperationalException(f"Cannot determine parameter space for {attr_name}.")
|
||||||
if auto_category is not None and attr.category is None:
|
|
||||||
attr.category = auto_category
|
|
||||||
if (
|
|
||||||
auto_category is not None
|
|
||||||
and attr.category is not None
|
|
||||||
and auto_category != attr.category
|
|
||||||
):
|
|
||||||
raise OperationalException(
|
|
||||||
f"Conflicting parameter space for {attr_name}: {auto_category} vs {attr.category}."
|
|
||||||
)
|
|
||||||
if attr.category in ("all", "default") or attr.category.isidentifier() is False:
|
if attr.category in ("all", "default") or attr.category.isidentifier() is False:
|
||||||
raise OperationalException(
|
raise OperationalException(
|
||||||
f"'{attr.category}' is not a valid space. Parameter: {attr_name}."
|
f"'{attr.category}' is not a valid space. Parameter: {attr_name}."
|
||||||
|
|||||||
Reference in New Issue
Block a user