From 946b87eb97471a730122f817580d5ad294c1297d Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 20 Oct 2026 16:33:10 +0200 Subject: [PATCH] fix: harmonize strategy validation and shared helpers (#293) Keep numeric domains consistent across prediction, metadata and trading. Preserve RL overrides and forced-disable rules. --- ReforceXY/.basedpyright/diagnostics.json | 368 +++---- ReforceXY/user_data/freqaimodels/ReforceXY.py | 126 +-- .../user_data/strategies/RLAgentStrategy.py | 13 +- quickadapter/.basedpyright/diagnostics.json | 894 +++++++++--------- .../tests/test_regressor_label_config.py | 62 +- .../test_regressor_prediction_history.py | 45 +- .../tests/test_regressor_selection.py | 86 +- quickadapter/tests/test_strategy_reversal.py | 40 +- .../freqaimodels/QuickAdapterRegressorV3.py | 83 +- .../user_data/strategies/QuickAdapterV3.py | 49 +- quickadapter/user_data/strategies/Utils.py | 11 + 11 files changed, 931 insertions(+), 846 deletions(-) diff --git a/ReforceXY/.basedpyright/diagnostics.json b/ReforceXY/.basedpyright/diagnostics.json index 530d90b..146010e 100644 --- a/ReforceXY/.basedpyright/diagnostics.json +++ b/ReforceXY/.basedpyright/diagnostics.json @@ -203,923 +203,923 @@ }, { "endCharacter": 22, - "endLine": 1059, + "endLine": 1086, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Cannot assign to attribute \"train_env\" for class \"ReforceXY*\"\n  Expression of type \"VecEnv\" cannot be assigned to attribute \"train_env\" of class \"ReforceXY\"\n    Type \"VecEnv\" is not assignable to type \"VecMonitor | SubprocVecEnv | Env[Unknown, Unknown]\"\n      \"VecEnv\" is not assignable to \"VecMonitor\"\n      \"VecEnv\" is not assignable to \"SubprocVecEnv\"\n      \"VecEnv\" is not assignable to \"Env[Unknown, Unknown]\"", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 13, - "startLine": 1059 + "startLine": 1086 }, { "endCharacter": 37, - "endLine": 1059, + "endLine": 1086, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Cannot assign to attribute \"eval_env\" for class \"ReforceXY*\"\n  Expression of type \"VecEnv | None\" cannot be assigned to attribute \"eval_env\" of class \"ReforceXY\"\n    Type \"VecEnv | None\" is not assignable to type \"VecMonitor | SubprocVecEnv | Env[Unknown, Unknown]\"\n      Type \"VecEnv\" is not assignable to type \"VecMonitor | SubprocVecEnv | Env[Unknown, Unknown]\"\n        \"VecEnv\" is not assignable to \"VecMonitor\"\n        \"VecEnv\" is not assignable to \"SubprocVecEnv\"\n        \"VecEnv\" is not assignable to \"Env[Unknown, Unknown]\"", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 29, - "startLine": 1059 + "startLine": 1086 }, { "endCharacter": 24, - "endLine": 1318, + "endLine": 1347, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"VecEnv\" cannot be assigned to parameter \"eval_env\" of type \"BaseEnvironment\" in function \"__init__\"\n  \"VecEnv\" is not assignable to \"BaseEnvironment\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 16, - "startLine": 1318 + "startLine": 1347 }, { "endCharacter": 38, - "endLine": 1551, + "endLine": 1580, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"obj\" of type \"Sized\" in function \"len\"\n  Type \"Any | None\" is not assignable to type \"Sized\"\n    \"None\" is incompatible with protocol \"Sized\"\n      \"__len__\" is not present", "rule": "reportArgumentType", "severity": "error", "startCharacter": 30, - "startLine": 1551 + "startLine": 1580 }, { "endCharacter": 36, - "endLine": 1555, + "endLine": 1584, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"obj\" of type \"Sized\" in function \"len\"\n  Type \"Any | None\" is not assignable to type \"Sized\"\n    \"None\" is incompatible with protocol \"Sized\"\n      \"__len__\" is not present", "rule": "reportArgumentType", "severity": "error", "startCharacter": 29, - "startLine": 1555 + "startLine": 1584 }, { "endCharacter": 80, - "endLine": 1558, + "endLine": 1587, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"timeframe\" of type \"str\" in function \"steps_to_days\"\n  Type \"Any | None\" is not assignable to type \"str\"\n    \"None\" is not assignable to \"str\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 52, - "startLine": 1558 + "startLine": 1587 }, { "endCharacter": 78, - "endLine": 1559, + "endLine": 1588, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"timeframe\" of type \"str\" in function \"steps_to_days\"\n  Type \"Any | None\" is not assignable to type \"str\"\n    \"None\" is not assignable to \"str\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 50, - "startLine": 1559 + "startLine": 1588 }, { "endCharacter": 80, - "endLine": 1560, + "endLine": 1589, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"timeframe\" of type \"str\" in function \"steps_to_days\"\n  Type \"Any | None\" is not assignable to type \"str\"\n    \"None\" is not assignable to \"str\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 52, - "startLine": 1560 + "startLine": 1589 }, { "endCharacter": 56, - "endLine": 1644, + "endLine": 1673, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"VecMonitor | SubprocVecEnv | Env[Unknown, Unknown]\" cannot be assigned to parameter \"eval_env\" of type \"VecEnv | None\" in function \"get_callbacks\"\n  Type \"VecMonitor | SubprocVecEnv | Env[Unknown, Unknown]\" is not assignable to type \"VecEnv | None\"\n    Type \"Env[Unknown, Unknown]\" is not assignable to type \"VecEnv | None\"\n      \"Env[Unknown, Unknown]\" is not assignable to \"VecEnv\"\n      \"Env[Unknown, Unknown]\" is not assignable to \"None\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 43, - "startLine": 1644 + "startLine": 1673 }, { "endCharacter": 84, - "endLine": 1664, + "endLine": 1693, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"float | list[float]\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"float | list[float]\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"list[float]\" is not assignable to type \"ConvertibleToFloat\"\n      \"list[float]\" is not assignable to \"str\"\n      \"list[float]\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"list[float]\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"list[float]\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 67, - "startLine": 1664 + "startLine": 1693 }, { "endCharacter": 84, - "endLine": 1664, + "endLine": 1693, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"float | list[float]\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"float | list[float]\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"list[float]\" is not assignable to type \"ConvertibleToFloat\"\n      \"list[float]\" is not assignable to \"str\"\n      \"list[float]\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"list[float]\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"list[float]\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 67, - "startLine": 1664 + "startLine": 1693 }, { "endCharacter": 44, - "endLine": 2742, + "endLine": 2771, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "\"best_trial_params\" is possibly unbound", "rule": "reportPossiblyUnboundVariable", "severity": "error", "startCharacter": 27, - "startLine": 2742 + "startLine": 2771 }, { "endCharacter": 12, - "endLine": 2762, + "endLine": 2791, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Parameter declaration \"seed\" is obscured by a declaration of the same name", "rule": "reportRedeclaration", "severity": "error", "startCharacter": 8, - "startLine": 2762 + "startLine": 2791 }, { "endCharacter": 16, - "endLine": 2763, + "endLine": 2792, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Parameter declaration \"env_info\" is obscured by a declaration of the same name", "rule": "reportRedeclaration", "severity": "error", "startCharacter": 8, - "startLine": 2763 + "startLine": 2792 }, { "endCharacter": 51, - "endLine": 2806, + "endLine": 2837, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"list[() -> BaseEnvironment]\" cannot be assigned to parameter \"env_fns\" of type \"list[() -> Env[Unknown, Unknown]]\" in function \"__init__\"\n  \"list[() -> BaseEnvironment]\" is not assignable to \"list[() -> Env[Unknown, Unknown]]\"\n    Type parameter \"_T@list\" is invariant, but \"() -> BaseEnvironment\" is not the same as \"() -> Env[Unknown, Unknown]\"\n    Consider switching from \"list\" to \"Sequence\" which is covariant", "rule": "reportArgumentType", "severity": "error", "startCharacter": 42, - "startLine": 2806 + "startLine": 2837 }, { "endCharacter": 53, - "endLine": 2812, + "endLine": 2843, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"list[() -> BaseEnvironment]\" cannot be assigned to parameter \"env_fns\" of type \"list[() -> Env[Unknown, Unknown]]\" in function \"__init__\"\n  \"list[() -> BaseEnvironment]\" is not assignable to \"list[() -> Env[Unknown, Unknown]]\"\n    Type parameter \"_T@list\" is invariant, but \"() -> BaseEnvironment\" is not the same as \"() -> Env[Unknown, Unknown]\"\n    Consider switching from \"list\" to \"Sequence\" which is covariant", "rule": "reportArgumentType", "severity": "error", "startCharacter": 45, - "startLine": 2812 + "startLine": 2843 }, { "endCharacter": 22, - "endLine": 2875, + "endLine": 2906, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Operator \"*\" not supported for \"None\"", "rule": "reportOptionalOperand", "severity": "error", "startCharacter": 15, - "startLine": 2875 + "startLine": 2906 }, { "endCharacter": 96, - "endLine": 2877, + "endLine": 2908, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Operator \"*\" not supported for \"None\"", "rule": "reportOptionalOperand", "severity": "error", "startCharacter": 89, - "startLine": 2877 + "startLine": 2908 }, { "endCharacter": 23, - "endLine": 2880, + "endLine": 2911, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Operator \"*\" not supported for \"None\"", "rule": "reportOptionalOperand", "severity": "error", "startCharacter": 16, - "startLine": 2880 + "startLine": 2911 }, { "endCharacter": 98, - "endLine": 2882, + "endLine": 2913, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Operator \"*\" not supported for \"None\"", "rule": "reportOptionalOperand", "severity": "error", "startCharacter": 91, - "startLine": 2882 + "startLine": 2913 }, { "endCharacter": 44, - "endLine": 2894, + "endLine": 2925, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Operator \"*\" not supported for types \"Any | None\" and \"Any | int | None\"\n  Operator \"*\" not supported for types \"None\" and \"None\"\n  Operator \"*\" not supported for types \"None\" and \"int\"", "rule": "reportOperatorIssue", "severity": "error", "startCharacter": 15, - "startLine": 2894 + "startLine": 2925 }, { "endCharacter": 133, - "endLine": 2896, + "endLine": 2927, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Operator \"*\" not supported for types \"Any | None\" and \"Any | int | None\"\n  Operator \"*\" not supported for types \"None\" and \"None\"\n  Operator \"*\" not supported for types \"None\" and \"int\"", "rule": "reportOperatorIssue", "severity": "error", "startCharacter": 106, - "startLine": 2896 + "startLine": 2927 }, { "endCharacter": 30, - "endLine": 2899, + "endLine": 2930, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Operator \">\" not supported for \"None\"", "rule": "reportOptionalOperand", "severity": "error", "startCharacter": 15, - "startLine": 2899 + "startLine": 2930 }, { "endCharacter": 54, - "endLine": 2965, + "endLine": 2996, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "\"is_pruned\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 45, - "startLine": 2965 + "startLine": 2996 }, { "endCharacter": 67, - "endLine": 2968, + "endLine": 2999, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "\"use_masking\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 56, - "startLine": 2968 + "startLine": 2999 }, { "endCharacter": 60, - "endLine": 2976, + "endLine": 3007, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "\"update_best_reward\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 42, - "startLine": 2976 + "startLine": 3007 }, { "endCharacter": 84, - "endLine": 2976, + "endLine": 3007, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"float | list[float]\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"float | list[float]\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"list[float]\" is not assignable to type \"ConvertibleToFloat\"\n      \"list[float]\" is not assignable to \"str\"\n      \"list[float]\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"list[float]\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"list[float]\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 67, - "startLine": 2976 + "startLine": 3007 }, { "endCharacter": 84, - "endLine": 2976, + "endLine": 3007, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"float | list[float]\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"float | list[float]\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"list[float]\" is not assignable to type \"ConvertibleToFloat\"\n      \"list[float]\" is not assignable to \"str\"\n      \"list[float]\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"list[float]\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"list[float]\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 67, - "startLine": 2976 + "startLine": 3007 }, { "endCharacter": 46, - "endLine": 3030, + "endLine": 3061, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "\"is_pruned\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 37, - "startLine": 3030 + "startLine": 3061 }, { "endCharacter": 57, - "endLine": 3033, + "endLine": 3064, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "\"best_mean_reward\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 41, - "startLine": 3033 + "startLine": 3064 }, { "endCharacter": 37, - "endLine": 3043, + "endLine": 3074, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Cannot assign to attribute \"train_env\" for class \"ReforceXY*\"\n  Type \"None\" is not assignable to type \"VecMonitor | SubprocVecEnv | Env[Unknown, Unknown]\"\n    \"None\" is not assignable to \"VecMonitor\"\n    \"None\" is not assignable to \"SubprocVecEnv\"\n    \"None\" is not assignable to \"Env[Unknown, Unknown]\"", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 33, - "startLine": 3043 + "startLine": 3074 }, { "endCharacter": 36, - "endLine": 3048, + "endLine": 3079, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Cannot assign to attribute \"eval_env\" for class \"ReforceXY*\"\n  Type \"None\" is not assignable to type \"VecMonitor | SubprocVecEnv | Env[Unknown, Unknown]\"\n    \"None\" is not assignable to \"VecMonitor\"\n    \"None\" is not assignable to \"SubprocVecEnv\"\n    \"None\" is not assignable to \"Env[Unknown, Unknown]\"", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 32, - "startLine": 3048 + "startLine": 3079 }, { "endCharacter": 7, - "endLine": 3093, + "endLine": 3124, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Declaration \"MyRLEnv\" is obscured by a declaration of the same name", "rule": "reportRedeclaration", "severity": "error", "startCharacter": 0, - "startLine": 3093 + "startLine": 3124 }, { "endCharacter": 36, - "endLine": 3105, + "endLine": 3136, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Declaration \"_last_closed_trade_tick\" is obscured by a declaration of the same name", "rule": "reportRedeclaration", "severity": "error", "startCharacter": 13, - "startLine": 3105 + "startLine": 3136 }, { "endCharacter": 13, - "endLine": 3697, + "endLine": 3728, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Method \"reset\" overrides class \"BaseEnvironment\" in an incompatible manner\n  Return type mismatch: base method returns type \"tuple[DataFrame, dict[Unknown, Unknown]]\", override returns type \"tuple[NDArray[float32], dict[str, Any]]\"\n    \"tuple[NDArray[float32], dict[str, Any]]\" is not assignable to \"tuple[DataFrame, dict[Unknown, Unknown]]\"\n      Tuple entry 1 is incorrect type\n        \"ndarray[_AnyShape, dtype[float32]]\" is not assignable to \"DataFrame\"", "rule": "reportIncompatibleMethodOverride", "severity": "error", "startCharacter": 8, - "startLine": 3697 + "startLine": 3728 }, { "endCharacter": 26, - "endLine": 3718, + "endLine": 3749, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Type \"tuple[DataFrame, dict[Unknown, Unknown]]\" is not assignable to return type \"tuple[NDArray[float32], dict[str, Any]]\"\n  \"DataFrame\" is not assignable to \"ndarray[_AnyShape, dtype[float32]]\"", "rule": "reportReturnType", "severity": "error", "startCharacter": 15, - "startLine": 3718 + "startLine": 3749 }, { "endCharacter": 55, - "endLine": 4026, + "endLine": 4057, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"float | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"float | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 44, - "startLine": 4026 + "startLine": 4057 }, { "endCharacter": 55, - "endLine": 4026, + "endLine": 4057, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"float | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"float | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 44, - "startLine": 4026 + "startLine": 4057 }, { "endCharacter": 59, - "endLine": 4050, + "endLine": 4081, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"float | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"float | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 48, - "startLine": 4050 + "startLine": 4081 }, { "endCharacter": 59, - "endLine": 4050, + "endLine": 4081, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"float | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"float | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 48, - "startLine": 4050 + "startLine": 4081 }, { "endCharacter": 24, - "endLine": 4079, + "endLine": 4110, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Method \"_get_observation\" overrides class \"BaseEnvironment\" in an incompatible manner\n  Return type mismatch: base method returns type \"DataFrame\", override returns type \"NDArray[float32]\"\n    \"ndarray[_AnyShape, dtype[float32]]\" is not assignable to \"DataFrame\"", "rule": "reportIncompatibleMethodOverride", "severity": "error", "startCharacter": 8, - "startLine": 4079 + "startLine": 4110 }, { "endCharacter": 12, - "endLine": 4172, + "endLine": 4203, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Method \"step\" overrides class \"Base5ActionRLEnv\" in an incompatible manner\n  Return type mismatch: base method returns type \"tuple[DataFrame, float, bool, Literal[False], dict[str, Unknown]]\", override returns type \"tuple[NDArray[float32], float, bool, bool, dict[str, Any]]\"\n    \"tuple[NDArray[float32], float, bool, bool, dict[str, Any]]\" is not assignable to \"tuple[DataFrame, float, bool, Literal[False], dict[str, Unknown]]\"\n      Tuple entry 1 is incorrect type\n        \"ndarray[_AnyShape, dtype[float32]]\" is not assignable to \"DataFrame\"", "rule": "reportIncompatibleMethodOverride", "severity": "error", "startCharacter": 8, - "startLine": 4172 + "startLine": 4203 }, { "endCharacter": 20, - "endLine": 4362, + "endLine": 4393, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Method \"action_masks\" overrides class \"BaseEnvironment\" in an incompatible manner\n  Return type mismatch: base method returns type \"list[bool]\", override returns type \"NDArray[bool_]\"\n    \"ndarray[_AnyShape, dtype[bool_]]\" is not assignable to \"list[bool]\"", "rule": "reportIncompatibleMethodOverride", "severity": "error", "startCharacter": 8, - "startLine": 4362 + "startLine": 4393 }, { "endCharacter": 40, - "endLine": 4511, + "endLine": 4542, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "\"Figure\" is not exported from module \"matplotlib.pyplot\"", "rule": "reportPrivateImportUsage", "severity": "error", "startCharacter": 34, - "startLine": 4511 + "startLine": 4542 }, { "endCharacter": 54, - "endLine": 5014, + "endLine": 5027, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 45, - "startLine": 5014 + "startLine": 5027 }, { "endCharacter": 54, - "endLine": 5014, + "endLine": 5027, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 45, - "startLine": 5014 + "startLine": 5027 }, { "endCharacter": 50, - "endLine": 5026, + "endLine": 5039, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"object\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"object\" is not assignable to type \"ConvertibleToFloat\"\n    \"object\" is not assignable to \"str\"\n    \"object\" is incompatible with protocol \"Buffer\"\n      \"__buffer__\" is not present\n    \"object\" is incompatible with protocol \"SupportsFloat\"\n      \"__float__\" is not present\n    \"object\" is incompatible with protocol \"SupportsIndex\"\n      \"__index__\" is not present", "rule": "reportArgumentType", "severity": "error", "startCharacter": 37, - "startLine": 5026 + "startLine": 5039 }, { "endCharacter": 72, - "endLine": 5037, + "endLine": 5050, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"float | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"float | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 70, - "startLine": 5037 + "startLine": 5050 }, { "endCharacter": 72, - "endLine": 5037, + "endLine": 5050, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"float | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"float | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 70, - "startLine": 5037 + "startLine": 5050 }, { "endCharacter": 73, - "endLine": 5046, + "endLine": 5059, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"float | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"float | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 71, - "startLine": 5046 + "startLine": 5059 }, { "endCharacter": 73, - "endLine": 5046, + "endLine": 5059, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"float | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"float | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 71, - "startLine": 5046 + "startLine": 5059 }, { "endCharacter": 58, - "endLine": 5055, + "endLine": 5068, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 56, - "startLine": 5055 + "startLine": 5068 }, { "endCharacter": 58, - "endLine": 5055, + "endLine": 5068, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 56, - "startLine": 5055 + "startLine": 5068 }, { "endCharacter": 50, - "endLine": 5286, + "endLine": 5299, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Mapping[Unknown, Unknown]\" cannot be assigned to parameter \"src\" of type \"dict[str, Any]\" in function \"deepmerge\"\n  \"Mapping[Unknown, Unknown]\" is not assignable to \"dict[str, Any]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 49, - "startLine": 5286 + "startLine": 5299 }, { "endCharacter": 20, - "endLine": 5463, + "endLine": 5479, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 18, - "startLine": 5463 + "startLine": 5479 }, { "endCharacter": 20, - "endLine": 5463, + "endLine": 5479, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 18, - "startLine": 5463 + "startLine": 5479 }, { "endCharacter": 59, - "endLine": 5468, + "endLine": 5484, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToInt\"\n    Type \"None\" is not assignable to type \"ConvertibleToInt\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 31, - "startLine": 5468 + "startLine": 5484 }, { "endCharacter": 59, - "endLine": 5468, + "endLine": 5484, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToInt\"\n    Type \"None\" is not assignable to type \"ConvertibleToInt\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 31, - "startLine": 5468 + "startLine": 5484 }, { "endCharacter": 65, - "endLine": 5469, + "endLine": 5485, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToInt\"\n    Type \"None\" is not assignable to type \"ConvertibleToInt\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 34, - "startLine": 5469 + "startLine": 5485 }, { "endCharacter": 65, - "endLine": 5469, + "endLine": 5485, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToInt\"\n    Type \"None\" is not assignable to type \"ConvertibleToInt\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 34, - "startLine": 5469 + "startLine": 5485 }, { "endCharacter": 63, - "endLine": 5472, + "endLine": 5488, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 34, - "startLine": 5472 + "startLine": 5488 }, { "endCharacter": 63, - "endLine": 5472, + "endLine": 5488, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 34, - "startLine": 5472 + "startLine": 5488 }, { "endCharacter": 61, - "endLine": 5474, + "endLine": 5490, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToInt\"\n    Type \"None\" is not assignable to type \"ConvertibleToInt\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 32, - "startLine": 5474 + "startLine": 5490 }, { "endCharacter": 61, - "endLine": 5474, + "endLine": 5490, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToInt\"\n    Type \"None\" is not assignable to type \"ConvertibleToInt\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 32, - "startLine": 5474 + "startLine": 5490 }, { "endCharacter": 67, - "endLine": 5475, + "endLine": 5491, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 36, - "startLine": 5475 + "startLine": 5491 }, { "endCharacter": 67, - "endLine": 5475, + "endLine": 5491, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 36, - "startLine": 5475 + "startLine": 5491 }, { "endCharacter": 73, - "endLine": 5476, + "endLine": 5492, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 39, - "startLine": 5476 + "startLine": 5492 }, { "endCharacter": 73, - "endLine": 5476, + "endLine": 5492, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 39, - "startLine": 5476 + "startLine": 5492 }, { "endCharacter": 61, - "endLine": 5477, + "endLine": 5493, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 33, - "startLine": 5477 + "startLine": 5493 }, { "endCharacter": 61, - "endLine": 5477, + "endLine": 5493, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 33, - "startLine": 5477 + "startLine": 5493 }, { "endCharacter": 89, - "endLine": 5484, + "endLine": 5500, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToInt\"\n    Type \"None\" is not assignable to type \"ConvertibleToInt\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 52, - "startLine": 5484 + "startLine": 5500 }, { "endCharacter": 89, - "endLine": 5484, + "endLine": 5500, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToInt\"\n    Type \"None\" is not assignable to type \"ConvertibleToInt\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 52, - "startLine": 5484 + "startLine": 5500 }, { "endCharacter": 83, - "endLine": 5485, + "endLine": 5501, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToInt\"\n    Type \"None\" is not assignable to type \"ConvertibleToInt\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 49, - "startLine": 5485 + "startLine": 5501 }, { "endCharacter": 83, - "endLine": 5485, + "endLine": 5501, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToInt\"\n    Type \"None\" is not assignable to type \"ConvertibleToInt\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 49, - "startLine": 5485 + "startLine": 5501 }, { "endCharacter": 65, - "endLine": 5511, + "endLine": 5527, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToInt\"\n    Type \"None\" is not assignable to type \"ConvertibleToInt\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 34, - "startLine": 5511 + "startLine": 5527 }, { "endCharacter": 65, - "endLine": 5511, + "endLine": 5527, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToInt\"\n    Type \"None\" is not assignable to type \"ConvertibleToInt\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 34, - "startLine": 5511 + "startLine": 5527 }, { "endCharacter": 67, - "endLine": 5513, + "endLine": 5529, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToInt\"\n    Type \"None\" is not assignable to type \"ConvertibleToInt\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 35, - "startLine": 5513 + "startLine": 5529 }, { "endCharacter": 67, - "endLine": 5513, + "endLine": 5529, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToInt\"\n    Type \"None\" is not assignable to type \"ConvertibleToInt\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 35, - "startLine": 5513 + "startLine": 5529 }, { "endCharacter": 87, - "endLine": 5516, + "endLine": 5532, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 46, - "startLine": 5516 + "startLine": 5532 }, { "endCharacter": 87, - "endLine": 5516, + "endLine": 5532, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 46, - "startLine": 5516 + "startLine": 5532 }, { "endCharacter": 93, - "endLine": 5517, + "endLine": 5533, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 49, - "startLine": 5517 + "startLine": 5533 }, { "endCharacter": 93, - "endLine": 5517, + "endLine": 5533, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 49, - "startLine": 5517 + "startLine": 5533 }, { "endCharacter": 89, - "endLine": 5518, + "endLine": 5534, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 47, - "startLine": 5518 + "startLine": 5534 }, { "endCharacter": 89, - "endLine": 5518, + "endLine": 5534, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 47, - "startLine": 5518 + "startLine": 5534 }, { "endCharacter": 89, - "endLine": 5519, + "endLine": 5535, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToInt\"\n    Type \"None\" is not assignable to type \"ConvertibleToInt\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 46, - "startLine": 5519 + "startLine": 5535 }, { "endCharacter": 89, - "endLine": 5519, + "endLine": 5535, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToInt\"\n    Type \"None\" is not assignable to type \"ConvertibleToInt\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 46, - "startLine": 5519 + "startLine": 5535 }, { "endCharacter": 75, - "endLine": 5520, + "endLine": 5536, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToInt\"\n    Type \"None\" is not assignable to type \"ConvertibleToInt\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 39, - "startLine": 5520 + "startLine": 5536 }, { "endCharacter": 75, - "endLine": 5520, + "endLine": 5536, "file": "ReforceXY/user_data/freqaimodels/ReforceXY.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToInt\"\n    Type \"None\" is not assignable to type \"ConvertibleToInt\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 39, - "startLine": 5520 + "startLine": 5536 }, { "endCharacter": 33, - "endLine": 36, + "endLine": 37, "file": "ReforceXY/user_data/strategies/RLAgentStrategy.py", "message": "Argument of type \"Scalar\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Scalar\" is not assignable to type \"ConvertibleToInt\"\n    Type \"complex\" is not assignable to type \"ConvertibleToInt\"\n      \"complex\" is not assignable to \"str\"\n      \"complex\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"complex\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"complex\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 20, - "startLine": 36 + "startLine": 37 }, { "endCharacter": 33, - "endLine": 36, + "endLine": 37, "file": "ReforceXY/user_data/strategies/RLAgentStrategy.py", "message": "Argument of type \"Scalar\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Scalar\" is not assignable to type \"ConvertibleToInt\"\n    Type \"complex\" is not assignable to type \"ConvertibleToInt\"\n      \"complex\" is not assignable to \"str\"\n      \"complex\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"complex\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"complex\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 20, - "startLine": 36 + "startLine": 37 }, { "endCharacter": 17, - "endLine": 63, + "endLine": 64, "file": "ReforceXY/user_data/strategies/RLAgentStrategy.py", "message": "\"can_short\" overrides symbol of same name in class \"IStrategy\"\n  \"property\" is not assignable to \"bool\"", "rule": "reportIncompatibleVariableOverride", "severity": "error", "startCharacter": 8, - "startLine": 63 + "startLine": 64 }, { "endCharacter": 19, - "endLine": 67, + "endLine": 68, "file": "ReforceXY/user_data/strategies/RLAgentStrategy.py", "message": "\"protections\" overrides symbol of same name in class \"IStrategy\"\n  \"property\" is not assignable to \"list[Unknown]\"", "rule": "reportIncompatibleVariableOverride", "severity": "error", "startCharacter": 8, - "startLine": 67 + "startLine": 68 } ], "filesAnalyzed": 3, diff --git a/ReforceXY/user_data/freqaimodels/ReforceXY.py b/ReforceXY/user_data/freqaimodels/ReforceXY.py index 4c51bfe..6cb2410 100644 --- a/ReforceXY/user_data/freqaimodels/ReforceXY.py +++ b/ReforceXY/user_data/freqaimodels/ReforceXY.py @@ -441,6 +441,15 @@ class ReforceXY(BaseReinforcementLearningModel): DEFAULT_BASE_FACTOR: Final[float] = 100.0 DEFAULT_DISCOUNT_GAMMA: Final[float] = 0.95 + DEFAULT_SEED: Final[int] = 42 + DEFAULT_OPTUNA_SEED: Final[int] = 42 + DEFAULT_N_ENVS: Final[int] = 1 + DEFAULT_N_EVAL_ENVS: Final[int] = 1 + DEFAULT_FRAME_STACKING: Final[int] = 0 + DEFAULT_N_EVAL_STEPS: Final[int] = 10_000 + DEFAULT_N_EVAL_EPISODES: Final[int] = 5 + DEFAULT_TENSORBOARD_THROTTLE: Final[int] = 1 + DEFAULT_OPTUNA_PURGE_PERIOD: Final[int] = 0 DEFAULT_MAX_TRADE_DURATION_CANDLES: Final[int] = 128 DEFAULT_IDLE_DURATION_MULTIPLIER: Final[int] = 4 @@ -592,16 +601,20 @@ class ReforceXY(BaseReinforcementLearningModel): self.recurrent: bool = self.model_type == ReforceXY._MODEL_TYPES[1] # "RecurrentPPO" self.lr_schedule: bool = self.rl_config.get("lr_schedule", False) self.cr_schedule: bool = self.rl_config.get("cr_schedule", False) - self.n_envs: int = self.rl_config.get("n_envs", 1) - self.n_eval_envs: int = self.rl_config.get("n_eval_envs", 1) + self.n_envs: int = self.rl_config.get("n_envs", ReforceXY.DEFAULT_N_ENVS) + self.n_eval_envs: int = self.rl_config.get("n_eval_envs", ReforceXY.DEFAULT_N_EVAL_ENVS) self.multiprocessing: bool = self.rl_config.get("multiprocessing", False) self.eval_multiprocessing: bool = self.rl_config.get("eval_multiprocessing", False) - self.frame_stacking: int = self.rl_config.get("frame_stacking", 0) - self.n_eval_steps: int = self.rl_config.get("n_eval_steps", 10_000) - self.n_eval_episodes: int = self.rl_config.get("n_eval_episodes", 5) + self.frame_stacking: int = self.rl_config.get( + "frame_stacking", ReforceXY.DEFAULT_FRAME_STACKING + ) + self.n_eval_steps: int = self.rl_config.get("n_eval_steps", ReforceXY.DEFAULT_N_EVAL_STEPS) + self.n_eval_episodes: int = self.rl_config.get( + "n_eval_episodes", ReforceXY.DEFAULT_N_EVAL_EPISODES + ) self.max_no_improvement_evals: int = self.rl_config.get("max_no_improvement_evals", 0) self.min_evals: int = self.rl_config.get("min_evals", 0) - self.rl_config.setdefault("tensorboard_throttle", 1) + self.rl_config.setdefault("tensorboard_throttle", ReforceXY.DEFAULT_TENSORBOARD_THROTTLE) self.plot_new_best: bool = self.rl_config.get("plot_new_best", False) self.check_envs: bool = self.rl_config.get("check_envs", True) self.progressbar_callback: ProgressBarCallback | None = None @@ -615,7 +628,9 @@ class ReforceXY(BaseReinforcementLearningModel): self.optuna_timeout_hours: float = self.rl_config_optuna.get("timeout_hours", 0) self.optuna_n_trials: int = self.rl_config_optuna.get("n_trials", 100) self.optuna_n_startup_trials: int = self.rl_config_optuna.get("n_startup_trials", 15) - self.optuna_purge_period: int = int(self.rl_config_optuna.get("purge_period", 0)) + self.optuna_purge_period: int = int( + self.rl_config_optuna.get("purge_period", ReforceXY.DEFAULT_OPTUNA_PURGE_PERIOD) + ) self.optuna_eval_callback: MaskableTrialEvalCallback | None = None self._model_params_cache: dict[str, Any] | None = None self._frame_buffers: dict[str, tuple[Any, deque[NDArray[np.float32]]]] = {} @@ -861,14 +876,19 @@ class ReforceXY(BaseReinforcementLearningModel): function will set them to proper values and warn them """ if not isinstance(self.n_envs, int) or self.n_envs < 1: - logger.warning("Config [global]: n_envs=%r invalid; defaulting to 1", self.n_envs) - self.n_envs = 1 + logger.warning( + "Config [global]: n_envs=%r invalid; defaulting to %d", + self.n_envs, + ReforceXY.DEFAULT_N_ENVS, + ) + self.n_envs = ReforceXY.DEFAULT_N_ENVS if not isinstance(self.n_eval_envs, int) or self.n_eval_envs < 1: logger.warning( - "Config [global]: n_eval_envs=%r invalid; defaulting to 1", + "Config [global]: n_eval_envs=%r invalid; defaulting to %d", self.n_eval_envs, + ReforceXY.DEFAULT_N_EVAL_ENVS, ) - self.n_eval_envs = 1 + self.n_eval_envs = ReforceXY.DEFAULT_N_EVAL_ENVS if self.multiprocessing and self.n_envs <= 1: logger.warning( "Config [global]: multiprocessing=True requires n_envs=%d>1; defaulting to False", @@ -888,10 +908,11 @@ class ReforceXY(BaseReinforcementLearningModel): self.plot_new_best = False if not isinstance(self.frame_stacking, int) or self.frame_stacking < 0: logger.warning( - "Config [global]: frame_stacking=%r invalid; defaulting to 0", + "Config [global]: frame_stacking=%r invalid; defaulting to %d", self.frame_stacking, + ReforceXY.DEFAULT_FRAME_STACKING, ) - self.frame_stacking = 0 + self.frame_stacking = ReforceXY.DEFAULT_FRAME_STACKING if self.frame_stacking == 1: logger.warning( "Config [global]: frame_stacking=1 equivalent to no stacking; defaulting to 0" @@ -899,22 +920,25 @@ class ReforceXY(BaseReinforcementLearningModel): self.frame_stacking = 0 if not isinstance(self.n_eval_steps, int) or self.n_eval_steps <= 0: logger.warning( - "Config [global]: n_eval_steps=%r invalid; defaulting to 10000", + "Config [global]: n_eval_steps=%r invalid; defaulting to %d", self.n_eval_steps, + ReforceXY.DEFAULT_N_EVAL_STEPS, ) - self.n_eval_steps = 10_000 + self.n_eval_steps = ReforceXY.DEFAULT_N_EVAL_STEPS if not isinstance(self.n_eval_episodes, int) or self.n_eval_episodes <= 0: logger.warning( - "Config [global]: n_eval_episodes=%r invalid; defaulting to 5", + "Config [global]: n_eval_episodes=%r invalid; defaulting to %d", self.n_eval_episodes, + ReforceXY.DEFAULT_N_EVAL_EPISODES, ) - self.n_eval_episodes = 5 + self.n_eval_episodes = ReforceXY.DEFAULT_N_EVAL_EPISODES if not isinstance(self.optuna_purge_period, int) or self.optuna_purge_period < 0: logger.warning( - "Config [global]: purge_period=%r invalid; defaulting to 0", + "Config [global]: purge_period=%r invalid; defaulting to %d", self.optuna_purge_period, + ReforceXY.DEFAULT_OPTUNA_PURGE_PERIOD, ) - self.optuna_purge_period = 0 + self.optuna_purge_period = ReforceXY.DEFAULT_OPTUNA_PURGE_PERIOD if self.rl_config_optuna.get("continuous", False) and self.optuna_purge_period > 0: logger.warning( "Config [global]: purge_period has no effect when continuous=True; defaulting to 0" @@ -931,13 +955,16 @@ class ReforceXY(BaseReinforcementLearningModel): "enabling add_state_info" ) self.rl_config["add_state_info"] = True - tensorboard_throttle = self.rl_config.get("tensorboard_throttle", 1) + tensorboard_throttle = self.rl_config.get( + "tensorboard_throttle", ReforceXY.DEFAULT_TENSORBOARD_THROTTLE + ) if not isinstance(tensorboard_throttle, int) or tensorboard_throttle < 1: logger.warning( - "Config [global]: tensorboard_throttle=%r invalid; defaulting to 1", + "Config [global]: tensorboard_throttle=%r invalid; defaulting to %d", tensorboard_throttle, + ReforceXY.DEFAULT_TENSORBOARD_THROTTLE, ) - self.rl_config["tensorboard_throttle"] = 1 + self.rl_config["tensorboard_throttle"] = ReforceXY.DEFAULT_TENSORBOARD_THROTTLE if self.continual_learning and bool(self.frame_stacking): logger.warning( "Config [global]: continual_learning=True incompatible with frame_stacking=%d; defaulting to False", @@ -1023,7 +1050,7 @@ class ReforceXY(BaseReinforcementLearningModel): train_df = data_dictionary["train_features"] test_df = data_dictionary["test_features"] effective_params = self.get_model_params() if model_params is None else model_params - seed = effective_params.get("seed", 42) + seed = effective_params.get("seed", ReforceXY.DEFAULT_SEED) if self.check_envs: logger.info("Env [%s]: checking environments", dk.pair) @@ -1076,7 +1103,7 @@ class ReforceXY(BaseReinforcementLearningModel): model_params: dict[str, Any] = copy.deepcopy(self.model_training_parameters) - model_params.setdefault("seed", 42) + model_params.setdefault("seed", ReforceXY.DEFAULT_SEED) model_params.setdefault("gamma", ReforceXY.DEFAULT_DISCOUNT_GAMMA) if not self.hyperopt and self.lr_schedule: @@ -1284,7 +1311,9 @@ class ReforceXY(BaseReinforcementLearningModel): if self.activate_tensorboard: info_callback = InfoMetricsCallback( actions=Actions, - throttle=self.rl_config.get("tensorboard_throttle", 1), + throttle=self.rl_config.get( + "tensorboard_throttle", ReforceXY.DEFAULT_TENSORBOARD_THROTTLE + ), verbose=verbose, ) callbacks.append(info_callback) @@ -2277,7 +2306,7 @@ class ReforceXY(BaseReinforcementLearningModel): f"Valid: {', '.join(ReforceXY._SAMPLERS)}" ) sampler = cast("SamplerType", sampler_value) - seed = self.rl_config_optuna.get("seed", 42) + seed = self.rl_config_optuna.get("seed", ReforceXY.DEFAULT_OPTUNA_SEED) match sampler: case ReforceXY._SAMPLERS.tpe: logger.info( @@ -2765,7 +2794,9 @@ class ReforceXY(BaseReinforcementLearningModel): trial: Trial | None = None, model_params: dict[str, Any] | None = None, ) -> tuple[VecEnv, VecEnv | None]: - seed: int = self.get_model_params().get("seed", 42) if seed is None else seed + seed: int = ( + self.get_model_params().get("seed", ReforceXY.DEFAULT_SEED) if seed is None else seed + ) if trial is not None: seed += trial.number set_random_seed(seed) @@ -2905,7 +2936,7 @@ class ReforceXY(BaseReinforcementLearningModel): # Ensure that the sampled parameters take precedence params = deepmerge(self.get_model_params(), params) params["gamma"] = ReforceXY._resolve_discount_gamma(params) - params["seed"] = params.get("seed", 42) + trial.number + params["seed"] = params.get("seed", ReforceXY.DEFAULT_SEED) + trial.number logger.info("Hyperopt [%s]: trial #%d params: %s", study_name, trial.number, params) nan_encountered = False @@ -4670,9 +4701,9 @@ class InfoMetricsCallback(TensorboardCallback): Tensorboard callback """ - def __init__(self, *args, throttle: int = 1, **kwargs): + def __init__(self, *args, throttle: int = ReforceXY.DEFAULT_TENSORBOARD_THROTTLE, **kwargs): super().__init__(*args, **kwargs) - self.throttle = 1 if throttle < 1 else throttle + self.throttle = ReforceXY.DEFAULT_TENSORBOARD_THROTTLE if throttle < 1 else throttle def _safe_logger_record( self, key: str, value: Any, exclude: tuple[str, ...] | None = None @@ -4704,22 +4735,6 @@ class InfoMetricsCallback(TensorboardCallback): ) pass - @staticmethod - def _build_train_freq( - train_freq: TrainFreq | int | tuple[int, ...] | list[int] | None, - ) -> int | None: - train_freq_val: int | None = None - if isinstance(train_freq, TrainFreq) and hasattr(train_freq, "frequency"): - if isinstance(train_freq.frequency, int): - train_freq_val = train_freq.frequency - elif isinstance(train_freq, (tuple, list)) and train_freq: - if isinstance(train_freq[0], int): - train_freq_val = train_freq[0] - elif isinstance(train_freq, int): - train_freq_val = train_freq - - return train_freq_val - def _on_training_start(self) -> None: lr = getattr(self.model, "learning_rate", None) lr_schedule, lr_iv, lr_fv = get_schedule_type(lr) @@ -4791,9 +4806,7 @@ class InfoMetricsCallback(TensorboardCallback): "exploration_rate": float(self.model.exploration_rate), } ) - train_freq = InfoMetricsCallback._build_train_freq( - getattr(self.model, "train_freq", None) - ) + train_freq = _build_train_freq(getattr(self.model, "train_freq", None)) if train_freq is not None: hparam_dict.update({"train_freq": train_freq}) if ReforceXY._MODEL_TYPES[4] in self.model.__class__.__name__: # "QRDQN" @@ -5296,14 +5309,17 @@ def _compute_gradient_steps(tf: int, ss: int) -> int: return -1 -def compute_gradient_steps(train_freq: Any, subsample_steps: Any) -> int: - tf: int | None = None +def _build_train_freq(train_freq: Any) -> int | None: + """Extract the collection frequency from an SB3 object or constructor value.""" if isinstance(train_freq, TrainFreq): - tf = train_freq.frequency if isinstance(train_freq.frequency, int) else None + return train_freq.frequency if isinstance(train_freq.frequency, int) else None if isinstance(train_freq, (tuple, list)) and train_freq: - tf = train_freq[0] if isinstance(train_freq[0], int) else None - elif isinstance(train_freq, int): - tf = train_freq + return train_freq[0] if isinstance(train_freq[0], int) else None + return train_freq if isinstance(train_freq, int) else None + + +def compute_gradient_steps(train_freq: Any, subsample_steps: Any) -> int: + tf = _build_train_freq(train_freq) ss: int | None = subsample_steps if isinstance(subsample_steps, int) else None diff --git a/ReforceXY/user_data/strategies/RLAgentStrategy.py b/ReforceXY/user_data/strategies/RLAgentStrategy.py index e6c53d8..1e768d5 100644 --- a/ReforceXY/user_data/strategies/RLAgentStrategy.py +++ b/ReforceXY/user_data/strategies/RLAgentStrategy.py @@ -5,6 +5,8 @@ from typing import Any, Final, Literal import numpy as np import pandas as pd +from freqtrade.constants import LongShort +from freqtrade.freqai.RL.Base5ActionRLEnv import Actions # import talib.abstract as ta from freqtrade.persistence import Trade @@ -12,7 +14,6 @@ from freqtrade.strategy import IStrategy from pandas import DataFrame TradingMode = Literal["margin", "futures", "spot"] -TradeDirection = Literal["long", "short"] logger = logging.getLogger(__name__) @@ -53,11 +54,11 @@ class RLAgentStrategy(IStrategy): INTERFACE_VERSION = 3 _TRADING_MODES: Final[tuple[TradingMode, ...]] = ("margin", "futures", "spot") - _TRADE_DIRECTIONS: Final[tuple[TradeDirection, ...]] = ("long", "short") - _ACTION_ENTER_LONG: Final[int] = 1 - _ACTION_EXIT_LONG: Final[int] = 2 - _ACTION_ENTER_SHORT: Final[int] = 3 - _ACTION_EXIT_SHORT: Final[int] = 4 + _TRADE_DIRECTIONS: Final[tuple[LongShort, ...]] = ("long", "short") + _ACTION_ENTER_LONG: Final[int] = Actions.Long_enter.value + _ACTION_EXIT_LONG: Final[int] = Actions.Long_exit.value + _ACTION_ENTER_SHORT: Final[int] = Actions.Short_enter.value + _ACTION_EXIT_SHORT: Final[int] = Actions.Short_exit.value _leverage_warning_state: tuple[str, str] | None = None @property diff --git a/quickadapter/.basedpyright/diagnostics.json b/quickadapter/.basedpyright/diagnostics.json index aa1458d..910fb00 100644 --- a/quickadapter/.basedpyright/diagnostics.json +++ b/quickadapter/.basedpyright/diagnostics.json @@ -3,1113 +3,1123 @@ "diagnostics": [ { "endCharacter": 46, - "endLine": 1438, + "endLine": 1432, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"str | None\" cannot be assigned to parameter \"default\" of type \"str\" in function \"_validate_label_selection_metric\"\n  Type \"str | None\" is not assignable to type \"str\"\n    \"None\" is not assignable to \"str\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 24, - "startLine": 1438 + "startLine": 1432 }, { "endCharacter": 79, - "endLine": 2808, + "endLine": 2801, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Cannot access attribute \"index\" for class \"NDArray[Unknown]\"\n  Attribute \"index\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 74, - "startLine": 2808 + "startLine": 2801 }, { "endCharacter": 72, - "endLine": 2810, + "endLine": 2803, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Cannot access attribute \"index\" for class \"NDArray[Unknown]\"\n  Attribute \"index\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 67, - "startLine": 2810 + "startLine": 2803 }, { "endCharacter": 90, - "endLine": 2819, + "endLine": 2812, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Cannot access attribute \"index\" for class \"NDArray[Unknown]\"\n  Attribute \"index\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 85, - "startLine": 2819 + "startLine": 2812 }, { "endCharacter": 34, - "endLine": 2831, + "endLine": 2824, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"Unknown | NDArray[Unknown] | Any | list[Unknown]\" cannot be assigned to parameter \"train_features\" of type \"DataFrame\" in function \"_filter_train_by_mask\"\n  Type \"Unknown | NDArray[Unknown] | Any | list[Unknown]\" is not assignable to type \"DataFrame\"\n    \"list[Unknown]\" is not assignable to \"DataFrame\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 20, - "startLine": 2831 + "startLine": 2824 }, { "endCharacter": 32, - "endLine": 2832, + "endLine": 2825, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"Unknown | NDArray[Unknown] | Any | list[Unknown]\" cannot be assigned to parameter \"train_labels\" of type \"DataFrame\" in function \"_filter_train_by_mask\"\n  Type \"Unknown | NDArray[Unknown] | Any | list[Unknown]\" is not assignable to type \"DataFrame\"\n    \"list[Unknown]\" is not assignable to \"DataFrame\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 20, - "startLine": 2832 + "startLine": 2825 }, { "endCharacter": 38, - "endLine": 2833, + "endLine": 2826, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"Unknown | NDArray[Unknown] | Any | list[Unknown]\" cannot be assigned to parameter \"train_weights\" of type \"NDArray[floating[Any]]\" in function \"_filter_train_by_mask\"\n  Type \"Unknown | NDArray[Unknown] | Any | list[Unknown]\" is not assignable to type \"NDArray[floating[Any]]\"\n    \"list[Unknown]\" is not assignable to \"ndarray[_AnyShape, dtype[floating[Any]]]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 20, - "startLine": 2833 + "startLine": 2826 }, { "endCharacter": 59, - "endLine": 2836, + "endLine": 2829, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"Unknown | NDArray[Unknown] | Any | list[Unknown] | None\" cannot be assigned to parameter \"train_label_weights\" of type \"NDArray[floating[Any]] | None\" in function \"_filter_train_by_mask\"\n  Type \"Unknown | NDArray[Unknown] | Any | list[Unknown] | None\" is not assignable to type \"NDArray[floating[Any]] | None\"\n    Type \"list[Unknown]\" is not assignable to type \"NDArray[floating[Any]] | None\"\n      \"list[Unknown]\" is not assignable to \"ndarray[_AnyShape, dtype[floating[Any]]]\"\n      \"list[Unknown]\" is not assignable to \"None\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 40, - "startLine": 2836 + "startLine": 2829 }, { "endCharacter": 34, - "endLine": 2870, + "endLine": 2863, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"DataFrame | Unknown | NDArray[Unknown] | Any | list[Unknown]\" cannot be assigned to parameter \"features\" of type \"DataFrame\" in function \"_shuffle_split_rows\"\n  Type \"DataFrame | Unknown | NDArray[Unknown] | Any | list[Unknown]\" is not assignable to type \"DataFrame\"\n    \"list[Unknown]\" is not assignable to \"DataFrame\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 20, - "startLine": 2870 + "startLine": 2863 }, { "endCharacter": 32, - "endLine": 2871, + "endLine": 2864, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"DataFrame | Unknown | NDArray[Unknown] | Any | list[Unknown]\" cannot be assigned to parameter \"labels\" of type \"DataFrame\" in function \"_shuffle_split_rows\"\n  Type \"DataFrame | Unknown | NDArray[Unknown] | Any | list[Unknown]\" is not assignable to type \"DataFrame\"\n    \"list[Unknown]\" is not assignable to \"DataFrame\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 20, - "startLine": 2871 + "startLine": 2864 }, { "endCharacter": 38, - "endLine": 2872, + "endLine": 2865, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"NDArray[floating[Any]] | Unknown | NDArray[Unknown] | Any | list[Unknown]\" cannot be assigned to parameter \"base_weights\" of type \"NDArray[floating[Any]]\" in function \"_shuffle_split_rows\"\n  Type \"NDArray[floating[Any]] | Unknown | NDArray[Unknown] | Any | list[Unknown]\" is not assignable to type \"NDArray[floating[Any]]\"\n    \"list[Unknown]\" is not assignable to \"ndarray[_AnyShape, dtype[floating[Any]]]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 20, - "startLine": 2872 + "startLine": 2865 }, { "endCharacter": 39, - "endLine": 2873, + "endLine": 2866, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"NDArray[floating[Any]] | Unknown | NDArray[Unknown] | Any | list[Unknown] | None\" cannot be assigned to parameter \"label_weights\" of type \"NDArray[floating[Any]] | None\" in function \"_shuffle_split_rows\"\n  Type \"NDArray[floating[Any]] | Unknown | NDArray[Unknown] | Any | list[Unknown] | None\" is not assignable to type \"NDArray[floating[Any]] | None\"\n    Type \"list[Unknown]\" is not assignable to type \"NDArray[floating[Any]] | None\"\n      \"list[Unknown]\" is not assignable to \"ndarray[_AnyShape, dtype[floating[Any]]]\"\n      \"list[Unknown]\" is not assignable to \"None\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 20, - "startLine": 2873 + "startLine": 2866 }, { "endCharacter": 37, - "endLine": 2880, + "endLine": 2873, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"Unknown | NDArray[Unknown] | Any | list[Unknown] | DataFrame\" cannot be assigned to parameter \"features\" of type \"DataFrame\" in function \"_shuffle_split_rows\"\n  Type \"Unknown | NDArray[Unknown] | Any | list[Unknown] | DataFrame\" is not assignable to type \"DataFrame\"\n    \"list[Unknown]\" is not assignable to \"DataFrame\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 24, - "startLine": 2880 + "startLine": 2873 }, { "endCharacter": 35, - "endLine": 2881, + "endLine": 2874, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"Unknown | NDArray[Unknown] | Any | list[Unknown] | DataFrame\" cannot be assigned to parameter \"labels\" of type \"DataFrame\" in function \"_shuffle_split_rows\"\n  Type \"Unknown | NDArray[Unknown] | Any | list[Unknown] | DataFrame\" is not assignable to type \"DataFrame\"\n    \"list[Unknown]\" is not assignable to \"DataFrame\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 24, - "startLine": 2881 + "startLine": 2874 }, { "endCharacter": 41, - "endLine": 2882, + "endLine": 2875, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"Unknown | NDArray[Unknown] | Any | list[Unknown] | ndarray[_AnyShape, dtype[floating[Any]]]\" cannot be assigned to parameter \"base_weights\" of type \"NDArray[floating[Any]]\" in function \"_shuffle_split_rows\"\n  Type \"Unknown | NDArray[Unknown] | Any | list[Unknown] | ndarray[_AnyShape, dtype[floating[Any]]]\" is not assignable to type \"NDArray[floating[Any]]\"\n    \"list[Unknown]\" is not assignable to \"ndarray[_AnyShape, dtype[floating[Any]]]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 24, - "startLine": 2882 + "startLine": 2875 }, { "endCharacter": 42, - "endLine": 2883, + "endLine": 2876, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"Unknown | NDArray[Unknown] | Any | list[Unknown] | ndarray[_AnyShape, dtype[floating[Any]]] | None\" cannot be assigned to parameter \"label_weights\" of type \"NDArray[floating[Any]] | None\" in function \"_shuffle_split_rows\"\n  Type \"Unknown | NDArray[Unknown] | Any | list[Unknown] | ndarray[_AnyShape, dtype[floating[Any]]] | None\" is not assignable to type \"NDArray[floating[Any]] | None\"\n    Type \"list[Unknown]\" is not assignable to type \"NDArray[floating[Any]] | None\"\n      \"list[Unknown]\" is not assignable to \"ndarray[_AnyShape, dtype[floating[Any]]]\"\n      \"list[Unknown]\" is not assignable to \"None\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 24, - "startLine": 2883 + "startLine": 2876 }, { "endCharacter": 30, - "endLine": 2901, + "endLine": 2894, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"NDArray[floating[Any]] | Unknown | NDArray[Unknown] | Any | list[Unknown]\" cannot be assigned to parameter \"base_weights\" of type \"NDArray[floating[Any]]\" in function \"_compose_train_weights_with_support\"\n  Type \"NDArray[floating[Any]] | Unknown | NDArray[Unknown] | Any | list[Unknown]\" is not assignable to type \"NDArray[floating[Any]]\"\n    \"list[Unknown]\" is not assignable to \"ndarray[_AnyShape, dtype[floating[Any]]]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 12, - "startLine": 2901 + "startLine": 2894 }, { "endCharacter": 31, - "endLine": 2902, + "endLine": 2895, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"NDArray[floating[Any]] | Unknown | NDArray[Unknown] | Any | list[Unknown] | None\" cannot be assigned to parameter \"label_weights\" of type \"NDArray[floating[Any]] | None\" in function \"_compose_train_weights_with_support\"\n  Type \"NDArray[floating[Any]] | Unknown | NDArray[Unknown] | Any | list[Unknown] | None\" is not assignable to type \"NDArray[floating[Any]] | None\"\n    Type \"list[Unknown]\" is not assignable to type \"NDArray[floating[Any]] | None\"\n      \"list[Unknown]\" is not assignable to \"ndarray[_AnyShape, dtype[floating[Any]]]\"\n      \"list[Unknown]\" is not assignable to \"None\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 12, - "startLine": 2902 + "startLine": 2895 }, { "endCharacter": 33, - "endLine": 2908, + "endLine": 2901, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"NDArray[floating[Any]] | Unknown | NDArray[Unknown] | Any | list[Unknown]\" cannot be assigned to parameter \"base_weights\" of type \"NDArray[floating[Any]]\" in function \"_compose_eval_weights\"\n  Type \"NDArray[floating[Any]] | Unknown | NDArray[Unknown] | Any | list[Unknown]\" is not assignable to type \"NDArray[floating[Any]]\"\n    \"list[Unknown]\" is not assignable to \"ndarray[_AnyShape, dtype[floating[Any]]]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 16, - "startLine": 2908 + "startLine": 2901 }, { "endCharacter": 34, - "endLine": 2909, + "endLine": 2902, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"NDArray[floating[Any]] | Unknown | NDArray[Unknown] | Any | list[Unknown] | None\" cannot be assigned to parameter \"label_weights\" of type \"NDArray[floating[Any]] | None\" in function \"_compose_eval_weights\"\n  Type \"NDArray[floating[Any]] | Unknown | NDArray[Unknown] | Any | list[Unknown] | None\" is not assignable to type \"NDArray[floating[Any]] | None\"\n    Type \"list[Unknown]\" is not assignable to type \"NDArray[floating[Any]] | None\"\n      \"list[Unknown]\" is not assignable to \"ndarray[_AnyShape, dtype[floating[Any]]]\"\n      \"list[Unknown]\" is not assignable to \"None\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 16, - "startLine": 2909 + "startLine": 2902 }, { "endCharacter": 26, - "endLine": 2916, + "endLine": 2909, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"DataFrame | Unknown | NDArray[Unknown] | Any | list[Unknown]\" cannot be assigned to parameter \"train_df\" of type \"DataFrame\" in function \"build_data_dictionary\"\n  Type \"DataFrame | Unknown | NDArray[Unknown] | Any | list[Unknown]\" is not assignable to type \"DataFrame\"\n    \"list[Unknown]\" is not assignable to \"DataFrame\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 12, - "startLine": 2916 + "startLine": 2909 }, { "endCharacter": 25, - "endLine": 2917, + "endLine": 2910, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"DataFrame | Unknown | NDArray[Unknown] | Any | list[Unknown]\" cannot be assigned to parameter \"test_df\" of type \"DataFrame\" in function \"build_data_dictionary\"\n  Type \"DataFrame | Unknown | NDArray[Unknown] | Any | list[Unknown]\" is not assignable to type \"DataFrame\"\n    \"list[Unknown]\" is not assignable to \"DataFrame\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 12, - "startLine": 2917 + "startLine": 2910 }, { "endCharacter": 24, - "endLine": 2918, + "endLine": 2911, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"DataFrame | Unknown | NDArray[Unknown] | Any | list[Unknown]\" cannot be assigned to parameter \"train_labels\" of type \"DataFrame\" in function \"build_data_dictionary\"\n  Type \"DataFrame | Unknown | NDArray[Unknown] | Any | list[Unknown]\" is not assignable to type \"DataFrame\"\n    \"list[Unknown]\" is not assignable to \"DataFrame\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 12, - "startLine": 2918 + "startLine": 2911 }, { "endCharacter": 23, - "endLine": 2919, + "endLine": 2912, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"DataFrame | Unknown | NDArray[Unknown] | Any | list[Unknown]\" cannot be assigned to parameter \"test_labels\" of type \"DataFrame\" in function \"build_data_dictionary\"\n  Type \"DataFrame | Unknown | NDArray[Unknown] | Any | list[Unknown]\" is not assignable to type \"DataFrame\"\n    \"list[Unknown]\" is not assignable to \"DataFrame\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 12, - "startLine": 2919 + "startLine": 2912 }, { "endCharacter": 87, - "endLine": 3249, + "endLine": 3242, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Cannot access attribute \"index\" for class \"NDArray[Unknown]\"\n  Attribute \"index\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 82, - "startLine": 3249 + "startLine": 3242 }, { "endCharacter": 68, - "endLine": 3250, + "endLine": 3243, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Cannot access attribute \"index\" for class \"NDArray[Unknown]\"\n  Attribute \"index\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 63, - "startLine": 3250 + "startLine": 3243 }, { "endCharacter": 71, - "endLine": 3259, + "endLine": 3252, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Cannot access attribute \"index\" for class \"NDArray[Unknown]\"\n  Attribute \"index\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 66, - "startLine": 3259 + "startLine": 3252 }, { "endCharacter": 47, - "endLine": 3262, + "endLine": 3255, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Cannot access attribute \"loc\" for class \"NDArray[Unknown]\"\n  Attribute \"loc\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 44, - "startLine": 3262 + "startLine": 3255 }, { "endCharacter": 47, - "endLine": 3262, + "endLine": 3255, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Cannot access attribute \"loc\" for class \"list[Unknown]\"\n  Attribute \"loc\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 44, - "startLine": 3262 + "startLine": 3255 }, { "endCharacter": 43, - "endLine": 3263, + "endLine": 3256, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Cannot access attribute \"loc\" for class \"NDArray[Unknown]\"\n  Attribute \"loc\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 40, - "startLine": 3263 + "startLine": 3256 }, { "endCharacter": 43, - "endLine": 3263, + "endLine": 3256, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Cannot access attribute \"loc\" for class \"list[Unknown]\"\n  Attribute \"loc\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 40, - "startLine": 3263 + "startLine": 3256 }, { "endCharacter": 31, - "endLine": 3284, + "endLine": 3277, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Cannot access attribute \"empty\" for class \"NDArray[Unknown]\"\n  Attribute \"empty\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 26, - "startLine": 3284 + "startLine": 3277 }, { "endCharacter": 31, - "endLine": 3284, + "endLine": 3277, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Cannot access attribute \"empty\" for class \"list[Unknown]\"\n  Attribute \"empty\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 26, - "startLine": 3284 + "startLine": 3277 }, { "endCharacter": 60, - "endLine": 3284, + "endLine": 3277, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Cannot access attribute \"empty\" for class \"NDArray[Unknown]\"\n  Attribute \"empty\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 55, - "startLine": 3284 + "startLine": 3277 }, { "endCharacter": 60, - "endLine": 3284, + "endLine": 3277, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Cannot access attribute \"empty\" for class \"list[Unknown]\"\n  Attribute \"empty\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 55, - "startLine": 3284 + "startLine": 3277 }, { "endCharacter": 73, - "endLine": 3296, + "endLine": 3289, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"Unknown | Any | ((value: Unknown, start: SupportsIndex = 0, stop: SupportsIndex = sys.maxsize, /) -> int)\" cannot be assigned to parameter \"target\" of type \"Index[Any]\" in function \"get_indexer\"\n  Type \"Unknown | Any | ((value: Unknown, start: SupportsIndex = 0, stop: SupportsIndex = sys.maxsize, /) -> int)\" is not assignable to type \"Index[Any]\"\n    \"MethodType\" is not assignable to \"Index[Any]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 53, - "startLine": 3296 + "startLine": 3289 }, { "endCharacter": 73, - "endLine": 3296, + "endLine": 3289, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Cannot access attribute \"index\" for class \"NDArray[Unknown]\"\n  Attribute \"index\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 68, - "startLine": 3296 + "startLine": 3289 }, { "endCharacter": 83, - "endLine": 3297, + "endLine": 3290, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"Unknown | Any | ((value: Unknown, start: SupportsIndex = 0, stop: SupportsIndex = sys.maxsize, /) -> int)\" cannot be assigned to parameter \"target\" of type \"Index[Any]\" in function \"get_indexer\"\n  Type \"Unknown | Any | ((value: Unknown, start: SupportsIndex = 0, stop: SupportsIndex = sys.maxsize, /) -> int)\" is not assignable to type \"Index[Any]\"\n    \"MethodType\" is not assignable to \"Index[Any]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 58, - "startLine": 3297 + "startLine": 3290 }, { "endCharacter": 83, - "endLine": 3297, + "endLine": 3290, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Cannot access attribute \"index\" for class \"NDArray[Unknown]\"\n  Attribute \"index\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 78, - "startLine": 3297 + "startLine": 3290 }, { "endCharacter": 46, - "endLine": 3532, + "endLine": 3525, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Cannot access attribute \"empty\" for class \"Buffer\"\n  Attribute \"empty\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 41, - "startLine": 3532 + "startLine": 3525 }, { "endCharacter": 46, - "endLine": 3532, + "endLine": 3525, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Cannot access attribute \"empty\" for class \"_NestedSequence[_SupportsArray[dtype[Any]]]\"\n  Attribute \"empty\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 41, - "startLine": 3532 + "startLine": 3525 }, { "endCharacter": 46, - "endLine": 3532, + "endLine": 3525, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Cannot access attribute \"empty\" for class \"_NestedSequence[complex | bytes | str]\"\n  Attribute \"empty\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 41, - "startLine": 3532 + "startLine": 3525 }, { "endCharacter": 46, - "endLine": 3532, + "endLine": 3525, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Cannot access attribute \"empty\" for class \"_SupportsArray[dtype[Any]]\"\n  Attribute \"empty\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 41, - "startLine": 3532 + "startLine": 3525 }, { "endCharacter": 46, - "endLine": 3532, + "endLine": 3525, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Cannot access attribute \"empty\" for class \"bytes\"\n  Attribute \"empty\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 41, - "startLine": 3532 + "startLine": 3525 }, { "endCharacter": 46, - "endLine": 3532, + "endLine": 3525, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Cannot access attribute \"empty\" for class \"complex\"\n  Attribute \"empty\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 41, - "startLine": 3532 + "startLine": 3525 }, { "endCharacter": 46, - "endLine": 3532, + "endLine": 3525, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Cannot access attribute \"empty\" for class \"str\"\n  Attribute \"empty\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 41, - "startLine": 3532 + "startLine": 3525 }, { "endCharacter": 41, - "endLine": 3539, + "endLine": 3532, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"ArrayLike\" cannot be assigned to parameter \"features\" of type \"DataFrame\" in function \"_sanitize_pipeline_weights\"\n  Type \"ArrayLike\" is not assignable to type \"DataFrame\"\n    \"Buffer\" is not assignable to \"DataFrame\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 16, - "startLine": 3539 + "startLine": 3532 }, { "endCharacter": 39, - "endLine": 3588, + "endLine": 3581, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"ArrayLike\" cannot be assigned to parameter \"features\" of type \"DataFrame\" in function \"_sanitize_pipeline_weights\"\n  Type \"ArrayLike\" is not assignable to type \"DataFrame\"\n    \"Buffer\" is not assignable to \"DataFrame\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 20, - "startLine": 3588 + "startLine": 3581 }, { "endCharacter": 19, - "endLine": 3698, + "endLine": 3691, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"int | Any | None\" cannot be assigned to parameter \"gap\" of type \"int\" in function \"__init__\"\n  Type \"int | Any | None\" is not assignable to type \"int\"\n    \"None\" is not assignable to \"int\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 16, - "startLine": 3698 + "startLine": 3691 }, { "endCharacter": 21, - "endLine": 3809, + "endLine": 3802, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"X\" of type \"DataFrame\" in function \"hp_objective\"\n  Type \"Any | None\" is not assignable to type \"DataFrame\"\n    \"None\" is not assignable to \"DataFrame\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 20, - "startLine": 3809 + "startLine": 3802 }, { "endCharacter": 21, - "endLine": 3810, + "endLine": 3803, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"y\" of type \"DataFrame\" in function \"hp_objective\"\n  Type \"Any | None\" is not assignable to type \"DataFrame\"\n    \"None\" is not assignable to \"DataFrame\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 20, - "startLine": 3810 + "startLine": 3803 }, { "endCharacter": 33, - "endLine": 3811, + "endLine": 3804, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"train_weights\" of type \"NDArray[floating[Any]]\" in function \"hp_objective\"\n  Type \"Any | None\" is not assignable to type \"NDArray[floating[Any]]\"\n    \"None\" is not assignable to \"ndarray[_AnyShape, dtype[floating[Any]]]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 20, - "startLine": 3811 + "startLine": 3804 }, { "endCharacter": 32, - "endLine": 3812, + "endLine": 3805, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"X_validation\" of type \"DataFrame\" in function \"hp_objective\"\n  Type \"Any | None\" is not assignable to type \"DataFrame\"\n    \"None\" is not assignable to \"DataFrame\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 20, - "startLine": 3812 + "startLine": 3805 }, { "endCharacter": 32, - "endLine": 3813, + "endLine": 3806, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"y_validation\" of type \"DataFrame\" in function \"hp_objective\"\n  Type \"Any | None\" is not assignable to type \"DataFrame\"\n    \"None\" is not assignable to \"DataFrame\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 20, - "startLine": 3813 + "startLine": 3806 }, { "endCharacter": 38, - "endLine": 3814, + "endLine": 3807, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"validation_weights\" of type \"NDArray[floating[Any]]\" in function \"hp_objective\"\n  Type \"Any | None\" is not assignable to type \"NDArray[floating[Any]]\"\n    \"None\" is not assignable to \"ndarray[_AnyShape, dtype[floating[Any]]]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 20, - "startLine": 3814 + "startLine": 3807 }, { "endCharacter": 24, - "endLine": 3835, + "endLine": 3828, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"X_test\" of type \"DataFrame\" in function \"make_test_set_and_weights\"\n  Type \"Any | None\" is not assignable to type \"DataFrame\"\n    \"None\" is not assignable to \"DataFrame\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 12, - "startLine": 3835 + "startLine": 3828 }, { "endCharacter": 24, - "endLine": 3836, + "endLine": 3829, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"y_test\" of type \"DataFrame\" in function \"make_test_set_and_weights\"\n  Type \"Any | None\" is not assignable to type \"DataFrame\"\n    \"None\" is not assignable to \"DataFrame\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 12, - "startLine": 3836 + "startLine": 3829 }, { "endCharacter": 30, - "endLine": 3837, + "endLine": 3830, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"test_weights\" of type \"NDArray[floating[Any]]\" in function \"make_test_set_and_weights\"\n  Type \"Any | None\" is not assignable to type \"NDArray[floating[Any]]\"\n    \"None\" is not assignable to \"ndarray[_AnyShape, dtype[floating[Any]]]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 12, - "startLine": 3837 + "startLine": 3830 }, { "endCharacter": 15, - "endLine": 3843, + "endLine": 3836, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"X\" of type \"DataFrame\" in function \"fit_regressor\"\n  Type \"Any | None\" is not assignable to type \"DataFrame\"\n    \"None\" is not assignable to \"DataFrame\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 14, - "startLine": 3843 + "startLine": 3836 }, { "endCharacter": 15, - "endLine": 3844, + "endLine": 3837, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"y\" of type \"DataFrame\" in function \"fit_regressor\"\n  Type \"Any | None\" is not assignable to type \"DataFrame\"\n    \"None\" is not assignable to \"DataFrame\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 14, - "startLine": 3844 + "startLine": 3837 }, { "endCharacter": 39, - "endLine": 3845, + "endLine": 3838, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"train_weights\" of type \"NDArray[floating[Any]]\" in function \"fit_regressor\"\n  Type \"Any | None\" is not assignable to type \"NDArray[floating[Any]]\"\n    \"None\" is not assignable to \"ndarray[_AnyShape, dtype[floating[Any]]]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 26, - "startLine": 3845 + "startLine": 3838 }, { "endCharacter": 38, - "endLine": 3855, + "endLine": 3848, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "\"columns\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 31, - "startLine": 3855 + "startLine": 3848 }, { "endCharacter": 34, - "endLine": 3856, + "endLine": 3849, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "\"index\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 29, - "startLine": 3856 + "startLine": 3849 }, { "endCharacter": 82, - "endLine": 3858, + "endLine": 3851, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "\"copy\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 78, - "startLine": 3858 + "startLine": 3851 }, { "endCharacter": 62, - "endLine": 4278, + "endLine": 4271, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "\"get_pair_dataframe\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 44, - "startLine": 4278 + "startLine": 4271 }, { "endCharacter": 68, - "endLine": 4665, + "endLine": 4652, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Type \"floating[Any] | NDArray[float64]\" is not assignable to return type \"NDArray[floating[Any]]\"\n  Type \"floating[Any] | NDArray[float64]\" is not assignable to type \"NDArray[floating[Any]]\"\n    \"floating[Any]\" is not assignable to \"ndarray[_AnyShape, dtype[floating[Any]]]\"", "rule": "reportReturnType", "severity": "error", "startCharacter": 15, - "startLine": 4661 + "startLine": 4648 }, { "endCharacter": 13, - "endLine": 4694, + "endLine": 4681, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "No overloads for \"cdist\" match the provided arguments", "rule": "reportCallIssue", "severity": "error", "startCharacter": 19, - "startLine": 4689 + "startLine": 4676 }, { "endCharacter": 38, - "endLine": 4692, + "endLine": 4679, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"str\" cannot be assigned to parameter \"metric\" of type \"_MetricFunc\" in function \"cdist\"\n  Type \"str\" is not assignable to type \"_MetricFunc\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 23, - "startLine": 4692 + "startLine": 4679 }, { "endCharacter": 9, - "endLine": 4797, + "endLine": 4784, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "No overloads for \"pdist\" match the provided arguments", "rule": "reportCallIssue", "severity": "error", "startCharacter": 36, - "startLine": 4795 + "startLine": 4782 }, { "endCharacter": 42, - "endLine": 4796, + "endLine": 4783, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"str\" cannot be assigned to parameter \"metric\" of type \"_MetricFunc\" in function \"pdist\"\n  Type \"str\" is not assignable to type \"_MetricFunc\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 27, - "startLine": 4796 + "startLine": 4783 }, { "endCharacter": 9, - "endLine": 4874, + "endLine": 4861, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "No overloads for \"cdist\" match the provided arguments", "rule": "reportCallIssue", "severity": "error", "startCharacter": 15, - "startLine": 4869 + "startLine": 4856 }, { "endCharacter": 34, - "endLine": 4872, + "endLine": 4859, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"str\" cannot be assigned to parameter \"metric\" of type \"_MetricFunc\" in function \"cdist\"\n  Type \"str\" is not assignable to type \"_MetricFunc\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 19, - "startLine": 4872 + "startLine": 4859 }, { "endCharacter": 99, - "endLine": 5063, + "endLine": 5050, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "No overloads for \"pdist\" match the provided arguments", "rule": "reportCallIssue", "severity": "error", "startCharacter": 12, - "startLine": 5063 + "startLine": 5050 }, { "endCharacter": 79, - "endLine": 5063, + "endLine": 5050, "file": "quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py", "message": "Argument of type \"str\" cannot be assigned to parameter \"metric\" of type \"_MetricFunc\" in function \"pdist\"\n  Type \"str\" is not assignable to type \"_MetricFunc\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 64, - "startLine": 5063 + "startLine": 5050 }, { "endCharacter": 55, - "endLine": 226, + "endLine": 225, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Type \"int\" is not assignable to declared type \"cached_property[int]\"\n  \"int\" is not assignable to \"cached_property[int]\"", "rule": "reportAssignmentType", "severity": "error", "startCharacter": 24, - "startLine": 226 + "startLine": 225 }, { "endCharacter": 15, - "endLine": 261, + "endLine": 260, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Class variable \"minimal_roi\" overrides instance variable of same name in class \"IStrategy\"", "rule": "reportIncompatibleVariableOverride", "severity": "error", "startCharacter": 4, - "startLine": 261 + "startLine": 260 }, { "endCharacter": 72, - "endLine": 261, + "endLine": 260, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Operator \"*\" not supported for types \"cached_property[int]\" and \"Literal[864]\"", "rule": "reportOperatorIssue", "severity": "error", "startCharacter": 49, - "startLine": 261 + "startLine": 260 }, { "endCharacter": 64, - "endLine": 274, + "endLine": 273, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"timeframe\" of type \"str\" in function \"timeframe_to_minutes\"\n  Type \"Any | None\" is not assignable to type \"str\"\n    \"None\" is not assignable to \"str\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 36, - "startLine": 274 + "startLine": 273 }, { "endCharacter": 17, - "endLine": 283, + "endLine": 282, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "\"can_short\" overrides symbol of same name in class \"IStrategy\"\n  \"property\" is not assignable to \"bool\"", "rule": "reportIncompatibleVariableOverride", "severity": "error", "startCharacter": 8, - "startLine": 283 + "startLine": 282 }, { "endCharacter": 19, - "endLine": 287, + "endLine": 286, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "\"plot_config\" overrides symbol of same name in class \"IStrategy\"\n  \"cached_property[dict[str, Any]]\" is not assignable to \"dict[Unknown, Unknown]\"", "rule": "reportIncompatibleVariableOverride", "severity": "error", "startCharacter": 8, - "startLine": 287 + "startLine": 286 }, { "endCharacter": 19, - "endLine": 327, + "endLine": 326, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "\"protections\" overrides symbol of same name in class \"IStrategy\"\n  \"cached_property[list[dict[str, Any]]]\" is not assignable to \"list[Unknown]\"", "rule": "reportIncompatibleVariableOverride", "severity": "error", "startCharacter": 8, - "startLine": 327 + "startLine": 326 }, { "endCharacter": 28, - "endLine": 400, + "endLine": 399, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "\"startup_candle_count\" overrides symbol of same name in class \"IStrategy\"\n  \"property\" is not assignable to \"int\"", "rule": "reportIncompatibleVariableOverride", "severity": "error", "startCharacter": 8, - "startLine": 400 + "startLine": 399 }, { "endCharacter": 44, - "endLine": 509, + "endLine": 508, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Operator \"/\" not supported for \"None\"", "rule": "reportOptionalOperand", "severity": "error", "startCharacter": 12, - "startLine": 509 + "startLine": 508 }, { "endCharacter": 38, - "endLine": 783, + "endLine": 782, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "\"to_numpy\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 30, - "startLine": 783 + "startLine": 782 }, { "endCharacter": 44, - "endLine": 816, + "endLine": 815, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Operator \"-\" not supported for \"None\"", "rule": "reportOptionalOperand", "severity": "error", "startCharacter": 38, - "startLine": 816 + "startLine": 815 }, { "endCharacter": 38, - "endLine": 824, + "endLine": 823, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Object of type \"None\" is not subscriptable", "rule": "reportOptionalSubscript", "severity": "error", "startCharacter": 36, - "startLine": 824 + "startLine": 823 }, { "endCharacter": 39, - "endLine": 825, + "endLine": 824, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Object of type \"None\" is not subscriptable", "rule": "reportOptionalSubscript", "severity": "error", "startCharacter": 37, - "startLine": 825 + "startLine": 824 }, { "endCharacter": 38, - "endLine": 826, + "endLine": 825, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Object of type \"None\" is not subscriptable", "rule": "reportOptionalSubscript", "severity": "error", "startCharacter": 36, - "startLine": 826 + "startLine": 825 }, { "endCharacter": 44, - "endLine": 849, + "endLine": 848, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Operator \"-\" not supported for types \"Series[Any] | None\" and \"Series[Any] | None\"\n  Operator \"-\" not supported for types \"Series[Any]\" and \"None\"\n  Operator \"-\" not supported for types \"None\" and \"Series[Any]\"\n  Operator \"-\" not supported for types \"None\" and \"None\"", "rule": "reportOperatorIssue", "severity": "error", "startCharacter": 29, - "startLine": 849 + "startLine": 848 }, { "endCharacter": 66, - "endLine": 849, + "endLine": 848, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Series[Any] | None\" cannot be assigned to parameter \"s1\" of type \"Series[Any]\" in function \"non_zero_diff\"\n  Type \"Series[Any] | None\" is not assignable to type \"Series[Any]\"\n    \"None\" is not assignable to \"Series[Any]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 61, - "startLine": 849 + "startLine": 848 }, { "endCharacter": 72, - "endLine": 849, + "endLine": 848, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Series[Any] | None\" cannot be assigned to parameter \"s2\" of type \"Series[Any]\" in function \"non_zero_diff\"\n  Type \"Series[Any] | None\" is not assignable to type \"Series[Any]\"\n    \"None\" is not assignable to \"Series[Any]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 68, - "startLine": 849 + "startLine": 848 }, { "endCharacter": 56, - "endLine": 855, + "endLine": 854, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Series[Any] | None\" cannot be assigned to parameter \"p1\" of type \"T@get_distance\" in function \"get_distance\"\n  Type \"Series[Any] | None\" is not assignable to type \"Series[Any]\"\n    \"None\" is not assignable to \"Series[Any]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 50, - "startLine": 855 + "startLine": 854 }, { "endCharacter": 58, - "endLine": 856, + "endLine": 855, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Series[Any] | None\" cannot be assigned to parameter \"p1\" of type \"T@get_distance\" in function \"get_distance\"\n  Type \"Series[Any] | None\" is not assignable to type \"Series[Any]\"\n    \"None\" is not assignable to \"Series[Any]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 52, - "startLine": 856 + "startLine": 855 }, { "endCharacter": 57, - "endLine": 857, + "endLine": 856, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Series[Any] | None\" cannot be assigned to parameter \"p1\" of type \"T@get_distance\" in function \"get_distance\"\n  Type \"Series[Any] | None\" is not assignable to type \"Series[Any]\"\n    \"None\" is not assignable to \"Series[Any]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 51, - "startLine": 857 + "startLine": 856 }, { "endCharacter": 44, - "endLine": 860, + "endLine": 859, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Series[Any] | None\" cannot be assigned to parameter \"series\" of type \"Series[Any]\" in function \"zlema\"\n  Type \"Series[Any] | None\" is not assignable to type \"Series[Any]\"\n    \"None\" is not assignable to \"Series[Any]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 38, - "startLine": 860 + "startLine": 859 }, { "endCharacter": 44, - "endLine": 861, + "endLine": 860, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Series[Any] | None\" cannot be assigned to parameter \"series\" of type \"Series[Any]\" in function \"zlema\"\n  Type \"Series[Any] | None\" is not assignable to type \"Series[Any]\"\n    \"None\" is not assignable to \"Series[Any]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 38, - "startLine": 861 + "startLine": 860 }, { "endCharacter": 44, - "endLine": 862, + "endLine": 861, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Series[Any] | None\" cannot be assigned to parameter \"series\" of type \"Series[Any]\" in function \"zlema\"\n  Type \"Series[Any] | None\" is not assignable to type \"Series[Any]\"\n    \"None\" is not assignable to \"Series[Any]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 38, - "startLine": 862 + "startLine": 861 }, { "endCharacter": 61, - "endLine": 863, + "endLine": 862, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Series[Any] | None\" cannot be assigned to parameter \"p1\" of type \"T@get_distance\" in function \"get_distance\"\n  Type \"Series[Any] | None\" is not assignable to type \"Series[Any]\"\n    \"None\" is not assignable to \"Series[Any]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 55, - "startLine": 863 + "startLine": 862 }, { "endCharacter": 61, - "endLine": 864, + "endLine": 863, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Series[Any] | None\" cannot be assigned to parameter \"p1\" of type \"T@get_distance\" in function \"get_distance\"\n  Type \"Series[Any] | None\" is not assignable to type \"Series[Any]\"\n    \"None\" is not assignable to \"Series[Any]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 55, - "startLine": 864 + "startLine": 863 }, { "endCharacter": 61, - "endLine": 865, + "endLine": 864, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Series[Any] | None\" cannot be assigned to parameter \"p1\" of type \"T@get_distance\" in function \"get_distance\"\n  Type \"Series[Any] | None\" is not assignable to type \"Series[Any]\"\n    \"None\" is not assignable to \"Series[Any]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 55, - "startLine": 865 + "startLine": 864 }, { "endCharacter": 81, - "endLine": 873, + "endLine": 872, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Series[Any]\" cannot be assigned to parameter \"p2\" of type \"T@get_distance\" in function \"get_distance\"\n  \"Series[Any]\" is not assignable to \"float\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 58, - "startLine": 873 + "startLine": 872 }, { "endCharacter": 67, - "endLine": 886, + "endLine": 885, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Series[Any] | None\" cannot be assigned to parameter \"p1\" of type \"T@get_distance\" in function \"get_distance\"\n  Type \"Series[Any] | None\" is not assignable to type \"Series[Any]\"\n    \"None\" is not assignable to \"Series[Any]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 61, - "startLine": 886 + "startLine": 885 }, { "endCharacter": 68, - "endLine": 887, + "endLine": 886, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Series[Any] | None\" cannot be assigned to parameter \"p1\" of type \"T@get_distance\" in function \"get_distance\"\n  Type \"Series[Any] | None\" is not assignable to type \"Series[Any]\"\n    \"None\" is not assignable to \"Series[Any]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 62, - "startLine": 887 + "startLine": 886 }, { "endCharacter": 67, - "endLine": 888, + "endLine": 887, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Series[Any] | None\" cannot be assigned to parameter \"p1\" of type \"T@get_distance\" in function \"get_distance\"\n  Type \"Series[Any] | None\" is not assignable to type \"Series[Any]\"\n    \"None\" is not assignable to \"Series[Any]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 61, - "startLine": 888 + "startLine": 887 }, { "endCharacter": 44, - "endLine": 889, + "endLine": 888, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Operator \"-\" not supported for types \"Series[Any] | None\" and \"Series[Any] | None\"\n  Operator \"-\" not supported for types \"Series[Any]\" and \"None\" when expected type is \"_SetItemValueNotDataFrame\"\n  Operator \"-\" not supported for types \"None\" and \"Series[Any]\" when expected type is \"_SetItemValueNotDataFrame\"\n  Operator \"-\" not supported for types \"None\" and \"None\" when expected type is \"_SetItemValueNotDataFrame\"", "rule": "reportOperatorIssue", "severity": "error", "startCharacter": 30, - "startLine": 889 + "startLine": 888 }, { "endCharacter": 56, - "endLine": 890, + "endLine": 889, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "No overloads for \"__call__\" match the provided arguments", "rule": "reportCallIssue", "severity": "error", "startCharacter": 31, - "startLine": 890 + "startLine": 889 }, { "endCharacter": 47, - "endLine": 890, + "endLine": 889, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Series[Any] | None\" cannot be assigned to parameter \"x1\" of type \"ArrayLike\" in function \"__call__\"\n  Type \"Series[Any] | None\" is not assignable to type \"ArrayLike\"\n    Type \"None\" is not assignable to type \"ArrayLike\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"_SupportsArray[dtype[Any]]\"\n        \"__array__\" is not present\n      \"None\" is incompatible with protocol \"_NestedSequence[_SupportsArray[dtype[Any]]]\"\n        \"__len__\" is not present\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 42, - "startLine": 890 + "startLine": 889 }, { "endCharacter": 55, - "endLine": 890, + "endLine": 889, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Series[Any] | None\" cannot be assigned to parameter \"x2\" of type \"ArrayLike\" in function \"__call__\"\n  Type \"Series[Any] | None\" is not assignable to type \"ArrayLike\"\n    Type \"None\" is not assignable to type \"ArrayLike\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"_SupportsArray[dtype[Any]]\"\n        \"__array__\" is not present\n      \"None\" is incompatible with protocol \"_NestedSequence[_SupportsArray[dtype[Any]]]\"\n        \"__len__\" is not present\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 49, - "startLine": 890 + "startLine": 889 }, { "endCharacter": 64, - "endLine": 891, + "endLine": 890, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "No overloads for \"__call__\" match the provided arguments", "rule": "reportCallIssue", "severity": "error", "startCharacter": 39, - "startLine": 891 + "startLine": 890 }, { "endCharacter": 55, - "endLine": 891, + "endLine": 890, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Series[Any] | None\" cannot be assigned to parameter \"x1\" of type \"ArrayLike\" in function \"__call__\"\n  Type \"Series[Any] | None\" is not assignable to type \"ArrayLike\"\n    Type \"None\" is not assignable to type \"ArrayLike\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"_SupportsArray[dtype[Any]]\"\n        \"__array__\" is not present\n      \"None\" is incompatible with protocol \"_NestedSequence[_SupportsArray[dtype[Any]]]\"\n        \"__len__\" is not present\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 50, - "startLine": 891 + "startLine": 890 }, { "endCharacter": 63, - "endLine": 891, + "endLine": 890, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Series[Any] | None\" cannot be assigned to parameter \"x2\" of type \"ArrayLike\" in function \"__call__\"\n  Type \"Series[Any] | None\" is not assignable to type \"ArrayLike\"\n    Type \"None\" is not assignable to type \"ArrayLike\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"_SupportsArray[dtype[Any]]\"\n        \"__array__\" is not present\n      \"None\" is incompatible with protocol \"_NestedSequence[_SupportsArray[dtype[Any]]]\"\n        \"__len__\" is not present\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 57, - "startLine": 891 + "startLine": 890 + }, + { + "endCharacter": 55, + "endLine": 898, + "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", + "message": "Argument of type \"Series[Any] | None\" cannot be assigned to parameter \"p1\" of type \"T@get_distance\" in function \"get_distance\"\n  Type \"Series[Any] | None\" is not assignable to type \"Series[Any]\"\n    \"None\" is not assignable to \"Series[Any]\"", + "rule": "reportArgumentType", + "severity": "error", + "startCharacter": 49, + "startLine": 898 }, { "endCharacter": 55, @@ -1161,1015 +1171,955 @@ "startCharacter": 49, "startLine": 903 }, - { - "endCharacter": 55, - "endLine": 904, - "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", - "message": "Argument of type \"Series[Any] | None\" cannot be assigned to parameter \"p1\" of type \"T@get_distance\" in function \"get_distance\"\n  Type \"Series[Any] | None\" is not assignable to type \"Series[Any]\"\n    \"None\" is not assignable to \"Series[Any]\"", - "rule": "reportArgumentType", - "severity": "error", - "startCharacter": 49, - "startLine": 904 - }, { "endCharacter": 50, - "endLine": 933, + "endLine": 932, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToInt\"\n    Type \"None\" is not assignable to type \"ConvertibleToInt\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 44, - "startLine": 933 + "startLine": 932 }, { "endCharacter": 50, - "endLine": 933, + "endLine": 932, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToInt\"\n    Type \"None\" is not assignable to type \"ConvertibleToInt\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 44, - "startLine": 933 + "startLine": 932 }, { "endCharacter": 29, - "endLine": 934, + "endLine": 933, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToInt\"\n    Type \"None\" is not assignable to type \"ConvertibleToInt\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 23, - "startLine": 934 + "startLine": 933 }, { "endCharacter": 29, - "endLine": 934, + "endLine": 933, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToInt\"\n    Type \"None\" is not assignable to type \"ConvertibleToInt\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 23, - "startLine": 934 + "startLine": 933 }, { "endCharacter": 60, - "endLine": 971, + "endLine": 970, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 50, - "startLine": 971 + "startLine": 970 }, { "endCharacter": 60, - "endLine": 971, + "endLine": 970, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 50, - "startLine": 971 + "startLine": 970 }, { "endCharacter": 35, - "endLine": 972, + "endLine": 971, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 25, - "startLine": 972 + "startLine": 971 }, { "endCharacter": 35, - "endLine": 972, + "endLine": 971, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"Any | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 25, - "startLine": 972 + "startLine": 971 }, { "endCharacter": 41, - "endLine": 1197, + "endLine": 1196, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Operator \"<\" not supported for \"None\"", "rule": "reportOptionalOperand", "severity": "error", "startCharacter": 12, - "startLine": 1197 + "startLine": 1196 }, { "endCharacter": 41, - "endLine": 1207, + "endLine": 1206, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Operator \">\" not supported for \"None\"", "rule": "reportOptionalOperand", "severity": "error", "startCharacter": 12, - "startLine": 1207 + "startLine": 1206 }, { "endCharacter": 66, - "endLine": 1220, + "endLine": 1219, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"timeframe\" of type \"str\" in function \"timeframe_to_prev_date\"\n  Type \"Any | None\" is not assignable to type \"str\"\n    \"None\" is not assignable to \"str\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 38, - "startLine": 1220 + "startLine": 1219 }, { "endCharacter": 70, - "endLine": 1351, + "endLine": 1350, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Expected 1 more positional argument", "rule": "reportCallIssue", "severity": "error", "startCharacter": 48, - "startLine": 1351 + "startLine": 1350 }, { "endCharacter": 74, - "endLine": 1415, + "endLine": 1414, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"int | None\" cannot be assigned to parameter \"trade_duration_candles\" of type \"int\" in function \"get_trade_natr\"\n  Type \"int | None\" is not assignable to type \"int\"\n    \"None\" is not assignable to \"int\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 52, - "startLine": 1415 + "startLine": 1414 }, { "endCharacter": 74, - "endLine": 1442, + "endLine": 1441, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"int | None\" cannot be assigned to parameter \"trade_duration_candles\" of type \"int\" in function \"get_trade_natr\"\n  Type \"int | None\" is not assignable to type \"int\"\n    \"None\" is not assignable to \"int\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 52, - "startLine": 1442 + "startLine": 1441 }, { "endCharacter": 96, - "endLine": 1494, + "endLine": 1493, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"timeframe\" of type \"str\" in function \"get_analyzed_dataframe\"\n  Type \"Any | None\" is not assignable to type \"str\"\n    \"None\" is not assignable to \"str\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 68, - "startLine": 1494 + "startLine": 1493 }, { "endCharacter": 77, - "endLine": 1524, + "endLine": 1523, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Operator \"<=\" not supported for \"None\"", "rule": "reportOptionalOperand", "severity": "error", "startCharacter": 57, - "startLine": 1524 + "startLine": 1523 }, { "endCharacter": 9, - "endLine": 1529, + "endLine": 1528, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Operator \"+\" not supported for types \"float\" and \"float | None\"\n  Operator \"+\" not supported for types \"float\" and \"None\"", "rule": "reportOperatorIssue", "severity": "error", "startCharacter": 28, - "startLine": 1527 + "startLine": 1526 }, { "endCharacter": 33, - "endLine": 1528, + "endLine": 1527, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Operator \"-\" not supported for \"None\"", "rule": "reportOptionalOperand", "severity": "error", "startCharacter": 13, - "startLine": 1528 + "startLine": 1527 }, { "endCharacter": 67, - "endLine": 1534, + "endLine": 1533, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"float | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"float | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 47, - "startLine": 1534 + "startLine": 1533 }, { "endCharacter": 67, - "endLine": 1534, + "endLine": 1533, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"float | None\" cannot be assigned to parameter \"x\" of type \"ConvertibleToFloat\" in function \"__new__\"\n  Type \"float | None\" is not assignable to type \"ConvertibleToFloat\"\n    Type \"None\" is not assignable to type \"ConvertibleToFloat\"\n      \"None\" is not assignable to \"str\"\n      \"None\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"None\" is incompatible with protocol \"SupportsFloat\"\n        \"__float__\" is not present\n      \"None\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 47, - "startLine": 1534 + "startLine": 1533 }, { "endCharacter": 64, - "endLine": 1688, + "endLine": 1687, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "\"isoformat\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 55, - "startLine": 1688 + "startLine": 1687 }, { "endCharacter": 37, - "endLine": 1739, + "endLine": 1738, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Operator \"<=\" not supported for \"None\"", "rule": "reportOptionalOperand", "severity": "error", "startCharacter": 15, - "startLine": 1739 + "startLine": 1738 }, { "endCharacter": 48, - "endLine": 1741, + "endLine": 1740, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Operator \"<=\" not supported for \"None\"", "rule": "reportOptionalOperand", "severity": "error", "startCharacter": 15, - "startLine": 1741 + "startLine": 1740 }, { "endCharacter": 96, - "endLine": 1921, + "endLine": 1920, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"timeframe\" of type \"str\" in function \"get_analyzed_dataframe\"\n  Type \"Any | None\" is not assignable to type \"str\"\n    \"None\" is not assignable to \"str\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 68, - "startLine": 1921 + "startLine": 1920 }, { "endCharacter": 39, - "endLine": 2024, + "endLine": 2023, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Operator \"+\" not supported for \"None\"", "rule": "reportOptionalOperand", "severity": "error", "startCharacter": 21, - "startLine": 2024 + "startLine": 2023 }, { "endCharacter": 90, - "endLine": 2024, + "endLine": 2023, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Operator \"*\" not supported for types \"float\" and \"Any | None\"\n  Operator \"*\" not supported for types \"float\" and \"None\"", "rule": "reportOperatorIssue", "severity": "error", "startCharacter": 62, - "startLine": 2024 + "startLine": 2023 }, { "endCharacter": 96, - "endLine": 2328, + "endLine": 2325, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"timeframe\" of type \"str\" in function \"get_analyzed_dataframe\"\n  Type \"Any | None\" is not assignable to type \"str\"\n    \"None\" is not assignable to \"str\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 68, - "startLine": 2328 + "startLine": 2325 }, { "endCharacter": 85, - "endLine": 2353, + "endLine": 2350, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "\"isoformat\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 76, - "startLine": 2353 + "startLine": 2350 }, { "endCharacter": 47, - "endLine": 2359, + "endLine": 2356, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Operator \"<\" not supported for \"None\"", "rule": "reportOptionalOperand", "severity": "error", "startCharacter": 16, - "startLine": 2359 - }, - { - "endCharacter": 42, - "endLine": 2363, - "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", - "message": "Argument of type \"str\" cannot be assigned to parameter \"side\" of type \"TradeDirection\" in function \"reversal_confirmed\"\n  Type \"str\" is not assignable to type \"TradeDirection\"\n    \"str\" is not assignable to type \"Literal['long']\"\n    \"str\" is not assignable to type \"Literal['short']\"", - "rule": "reportArgumentType", - "severity": "error", - "startCharacter": 16, - "startLine": 2363 - }, - { - "endCharacter": 42, - "endLine": 2364, - "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", - "message": "Argument of type \"str\" cannot be assigned to parameter \"order\" of type \"OrderType\" in function \"reversal_confirmed\"\n  Type \"str\" is not assignable to type \"OrderType\"\n    \"str\" is not assignable to type \"Literal['entry']\"\n    \"str\" is not assignable to type \"Literal['exit']\"", - "rule": "reportArgumentType", - "severity": "error", - "startCharacter": 16, - "startLine": 2364 + "startLine": 2356 }, { "endCharacter": 69, - "endLine": 2366, + "endLine": 2363, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"int | float\" cannot be assigned to parameter \"lookback_period_candles\" of type \"int\" in function \"reversal_confirmed\"\n  Type \"int | float\" is not assignable to type \"int\"\n    \"float\" is not assignable to \"int\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 16, - "startLine": 2366 + "startLine": 2363 }, { "endCharacter": 47, - "endLine": 2377, + "endLine": 2374, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Operator \">\" not supported for \"None\"", "rule": "reportOptionalOperand", "severity": "error", "startCharacter": 16, - "startLine": 2377 - }, - { - "endCharacter": 43, - "endLine": 2381, - "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", - "message": "Argument of type \"str\" cannot be assigned to parameter \"side\" of type \"TradeDirection\" in function \"reversal_confirmed\"\n  Type \"str\" is not assignable to type \"TradeDirection\"\n    \"str\" is not assignable to type \"Literal['long']\"\n    \"str\" is not assignable to type \"Literal['short']\"", - "rule": "reportArgumentType", - "severity": "error", - "startCharacter": 16, - "startLine": 2381 - }, - { - "endCharacter": 42, - "endLine": 2382, - "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", - "message": "Argument of type \"str\" cannot be assigned to parameter \"order\" of type \"OrderType\" in function \"reversal_confirmed\"\n  Type \"str\" is not assignable to type \"OrderType\"\n    \"str\" is not assignable to type \"Literal['entry']\"\n    \"str\" is not assignable to type \"Literal['exit']\"", - "rule": "reportArgumentType", - "severity": "error", - "startCharacter": 16, - "startLine": 2382 + "startLine": 2374 }, { "endCharacter": 69, - "endLine": 2384, + "endLine": 2381, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"int | float\" cannot be assigned to parameter \"lookback_period_candles\" of type \"int\" in function \"reversal_confirmed\"\n  Type \"int | float\" is not assignable to type \"int\"\n    \"float\" is not assignable to \"int\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 16, - "startLine": 2384 + "startLine": 2381 }, { "endCharacter": 52, - "endLine": 2413, + "endLine": 2410, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"datetime | None\" cannot be assigned to parameter \"current_candle_date\" of type \"datetime\" in function \"_normalize_final_take_profit_state\"\n  Type \"datetime | None\" is not assignable to type \"datetime\"\n    \"None\" is not assignable to \"datetime\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 36, - "startLine": 2413 + "startLine": 2410 }, { "endCharacter": 96, - "endLine": 2533, + "endLine": 2530, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"Any | None\" cannot be assigned to parameter \"timeframe\" of type \"str\" in function \"get_analyzed_dataframe\"\n  Type \"Any | None\" is not assignable to type \"str\"\n    \"None\" is not assignable to \"str\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 68, - "startLine": 2533 - }, - { - "endCharacter": 43, - "endLine": 2542, - "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", - "message": "Argument of type \"str\" cannot be assigned to parameter \"order\" of type \"OrderType\" in function \"reversal_confirmed\"\n  Type \"str\" is not assignable to type \"OrderType\"\n    \"str\" is not assignable to type \"Literal['entry']\"\n    \"str\" is not assignable to type \"Literal['exit']\"", - "rule": "reportArgumentType", - "severity": "error", - "startCharacter": 16, - "startLine": 2542 + "startLine": 2530 }, { "endCharacter": 69, - "endLine": 2544, + "endLine": 2541, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"int | float\" cannot be assigned to parameter \"lookback_period_candles\" of type \"int\" in function \"reversal_confirmed\"\n  Type \"int | float\" is not assignable to type \"int\"\n    \"float\" is not assignable to \"int\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 16, - "startLine": 2544 + "startLine": 2541 }, { "endCharacter": 32, - "endLine": 2624, + "endLine": 2621, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"LocalTrade\" cannot be assigned to parameter \"trade\" of type \"Trade\" in function \"get_trade_annotation_line_start_date\"\n  \"LocalTrade\" is not assignable to \"Trade\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 27, - "startLine": 2624 + "startLine": 2621 }, { "endCharacter": 72, - "endLine": 2627, + "endLine": 2624, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"LocalTrade\" cannot be assigned to parameter \"trade\" of type \"Trade\" in function \"get_trade_exit_stage\"\n  \"LocalTrade\" is not assignable to \"Trade\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 67, - "startLine": 2627 + "startLine": 2624 }, { "endCharacter": 36, - "endLine": 2634, + "endLine": 2631, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"LocalTrade\" cannot be assigned to parameter \"trade\" of type \"Trade\" in function \"get_take_profit_target\"\n  \"LocalTrade\" is not assignable to \"Trade\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 31, - "startLine": 2634 + "startLine": 2631 }, { "endCharacter": 71, - "endLine": 2665, + "endLine": 2662, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"LocalTrade\" cannot be assigned to parameter \"trade\" of type \"Trade\" in function \"get_trade_entry_date\"\n  \"LocalTrade\" is not assignable to \"Trade\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 66, - "startLine": 2665 + "startLine": 2662 }, { "endCharacter": 32, - "endLine": 2698, + "endLine": 2695, "file": "quickadapter/user_data/strategies/QuickAdapterV3.py", "message": "Argument of type \"LocalTrade\" cannot be assigned to parameter \"trade\" of type \"Trade\" in function \"get_take_profit_target\"\n  \"LocalTrade\" is not assignable to \"Trade\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 27, - "startLine": 2698 + "startLine": 2695 }, { "endCharacter": 35, - "endLine": 849, + "endLine": 860, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Argument of type \"list[TrendDirection]\" cannot be assigned to parameter \"value\" of type \"float | IndexOpsMixin[float, Any] | None\" in function \"__setitem__\"\n  Type \"list[TrendDirection]\" is not assignable to type \"float | IndexOpsMixin[float, Any] | None\"\n    \"list[TrendDirection]\" is not assignable to \"float\"\n    \"list[TrendDirection]\" is not assignable to \"IndexOpsMixin[float, Any]\"\n    \"list[TrendDirection]\" is not assignable to \"None\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 8, - "startLine": 849 + "startLine": 860 }, { "endCharacter": 35, - "endLine": 849, + "endLine": 860, "file": "quickadapter/user_data/strategies/Utils.py", "message": "No overloads for \"__setitem__\" match the provided arguments", "rule": "reportCallIssue", "severity": "error", "startCharacter": 8, - "startLine": 849 + "startLine": 860 }, { "endCharacter": 78, - "endLine": 895, + "endLine": 906, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Type \"tuple[SmoothingMethod, ...]\" is not assignable to declared type \"tuple[SmoothingKernel, ...]\"\n  \"tuple[SmoothingMethod, ...]\" is not assignable to \"tuple[SmoothingKernel, ...]\"\n    Tuple entry 1 is incorrect type\n      Type \"SmoothingMethod\" is not assignable to type \"SmoothingKernel\"\n        Type \"Literal['gaussian_filter1d']\" is not assignable to type \"SmoothingKernel\"\n          \"Literal['gaussian_filter1d']\" is not assignable to type \"Literal['gaussian']\"\n          \"Literal['gaussian_filter1d']\" is not assignable to type \"Literal['kaiser']\"\n          \"Literal['gaussian_filter1d']\" is not assignable to type \"Literal['kaiser_bessel_derived']\"\n          \"Literal['gaussian_filter1d']\" is not assignable to type \"Literal['triang']\"", "rule": "reportAssignmentType", "severity": "error", "startCharacter": 56, - "startLine": 895 + "startLine": 906 }, { "endCharacter": 98, - "endLine": 1725, + "endLine": 1736, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Type \"bool | bool_\" is not assignable to return type \"bool\"\n  Type \"bool | bool_\" is not assignable to type \"bool\"\n    \"numpy.bool[builtins.bool]\" is not assignable to \"bool\"", "rule": "reportReturnType", "severity": "error", "startCharacter": 15, - "startLine": 1725 + "startLine": 1736 }, { "endCharacter": 33, - "endLine": 1759, + "endLine": 1770, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Argument of type \"Scalar\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Scalar\" is not assignable to type \"ConvertibleToInt\"\n    Type \"complex\" is not assignable to type \"ConvertibleToInt\"\n      \"complex\" is not assignable to \"str\"\n      \"complex\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"complex\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"complex\" is incompatible with protocol \"SupportsIndex\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 20, - "startLine": 1759 + "startLine": 1770 }, { "endCharacter": 33, - "endLine": 1759, + "endLine": 1770, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Argument of type \"Scalar\" cannot be assigned to parameter \"x\" of type \"ConvertibleToInt\" in function \"__new__\"\n  Type \"Scalar\" is not assignable to type \"ConvertibleToInt\"\n    Type \"complex\" is not assignable to type \"ConvertibleToInt\"\n      \"complex\" is not assignable to \"str\"\n      \"complex\" is incompatible with protocol \"Buffer\"\n        \"__buffer__\" is not present\n      \"complex\" is incompatible with protocol \"SupportsInt\"\n        \"__int__\" is not present\n      \"complex\" is incompatible with protocol \"SupportsIndex\"\n ...", "rule": "reportArgumentType", "severity": "error", "startCharacter": 20, - "startLine": 1759 + "startLine": 1770 }, { "endCharacter": 23, - "endLine": 1771, + "endLine": 1782, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Type \"float\" is not assignable to return type \"T@get_distance\"\n  Type \"float\" is not assignable to type \"T@get_distance\"", "rule": "reportReturnType", "severity": "error", "startCharacter": 11, - "startLine": 1771 + "startLine": 1782 }, { "endCharacter": 83, - "endLine": 2624, + "endLine": 2635, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Argument of type \"str\" cannot be assigned to parameter \"key\" of type \"CombinedMetric\" in function \"__getitem__\"\n  Type \"str\" is not assignable to type \"CombinedMetric\"\n    \"str\" is not assignable to type \"Literal['amplitude']\"\n    \"str\" is not assignable to type \"Literal['amplitude_threshold_ratio']\"\n    \"str\" is not assignable to type \"Literal['volume_rate']\"\n    \"str\" is not assignable to type \"Literal['speed']\"\n    \"str\" is not assignable to type \"Literal['efficiency_ratio']\"\n    \"str\" is not assignable to type \"Literal['volume_weighted_efficiency_ratio']\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 58, - "startLine": 2624 + "startLine": 2635 }, { "endCharacter": 38, - "endLine": 3514, + "endLine": 3525, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Cannot access attribute \"__func__\" for class \"FunctionType\"\n  Attribute \"__func__\" is unknown", "rule": "reportFunctionMemberAccess", "severity": "error", "startCharacter": 30, - "startLine": 3514 + "startLine": 3525 }, { "endCharacter": 34, - "endLine": 3516, + "endLine": 3527, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Cannot access attribute \"__func__\" for class \"FunctionType\"\n  Attribute \"__func__\" is unknown", "rule": "reportFunctionMemberAccess", "severity": "error", "startCharacter": 26, - "startLine": 3516 + "startLine": 3527 }, { "endCharacter": 55, - "endLine": 3746, + "endLine": 3757, "file": "quickadapter/user_data/strategies/Utils.py", "message": "\"rolling\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 48, - "startLine": 3746 + "startLine": 3757 }, { "endCharacter": 38, - "endLine": 3771, + "endLine": 3782, "file": "quickadapter/user_data/strategies/Utils.py", "message": "\"rolling\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 31, - "startLine": 3771 + "startLine": 3782 }, { "endCharacter": 55, - "endLine": 3797, + "endLine": 3808, "file": "quickadapter/user_data/strategies/Utils.py", "message": "\"rolling\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 48, - "startLine": 3797 + "startLine": 3808 }, { "endCharacter": 56, - "endLine": 3798, + "endLine": 3809, "file": "quickadapter/user_data/strategies/Utils.py", "message": "\"rolling\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 49, - "startLine": 3798 + "startLine": 3809 }, { "endCharacter": 33, - "endLine": 3870, + "endLine": 3881, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Argument of type \"Series[Any] | NDArray[floating[Any]]\" cannot be assigned to parameter \"series\" of type \"Series[Any]\" in function \"calculate_zero_lag\"\n  Type \"Series[Any] | NDArray[floating[Any]]\" is not assignable to type \"Series[Any]\"\n    \"ndarray[_AnyShape, dtype[floating[Any]]]\" is not assignable to \"Series[Any]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 27, - "startLine": 3870 + "startLine": 3881 }, { "endCharacter": 69, - "endLine": 3870, + "endLine": 3881, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Expected 1 more positional argument", "rule": "reportCallIssue", "severity": "error", "startCharacter": 59, - "startLine": 3870 + "startLine": 3881 }, { "endCharacter": 40, - "endLine": 3937, + "endLine": 3948, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Argument of type \"Series[Any] | None\" cannot be assigned to parameter \"series\" of type \"Series[Any]\" in function \"calculate_zero_lag\"\n  Type \"Series[Any] | None\" is not assignable to type \"Series[Any]\"\n    \"None\" is not assignable to \"Series[Any]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 35, - "startLine": 3937 + "startLine": 3948 }, { "endCharacter": 38, - "endLine": 3938, + "endLine": 3949, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Argument of type \"Series[Any] | None\" cannot be assigned to parameter \"series\" of type \"Series[Any]\" in function \"calculate_zero_lag\"\n  Type \"Series[Any] | None\" is not assignable to type \"Series[Any]\"\n    \"None\" is not assignable to \"Series[Any]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 34, - "startLine": 3938 + "startLine": 3949 }, { "endCharacter": 42, - "endLine": 3939, + "endLine": 3950, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Argument of type \"Series[Any] | None\" cannot be assigned to parameter \"series\" of type \"Series[Any]\" in function \"calculate_zero_lag\"\n  Type \"Series[Any] | None\" is not assignable to type \"Series[Any]\"\n    \"None\" is not assignable to \"Series[Any]\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 36, - "startLine": 3939 + "startLine": 3950 }, { "endCharacter": 45, - "endLine": 3941, + "endLine": 3952, "file": "quickadapter/user_data/strategies/Utils.py", "message": "\"index\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 40, - "startLine": 3941 + "startLine": 3952 }, { "endCharacter": 33, - "endLine": 3943, + "endLine": 3954, "file": "quickadapter/user_data/strategies/Utils.py", "message": "\"iloc\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 29, - "startLine": 3943 + "startLine": 3954 }, { "endCharacter": 31, - "endLine": 3944, + "endLine": 3955, "file": "quickadapter/user_data/strategies/Utils.py", "message": "\"iloc\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 27, - "startLine": 3944 + "startLine": 3955 }, { "endCharacter": 48, - "endLine": 3949, + "endLine": 3960, "file": "quickadapter/user_data/strategies/Utils.py", "message": "\"index\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 43, - "startLine": 3949 + "startLine": 3960 }, { "endCharacter": 40, - "endLine": 3950, + "endLine": 3961, "file": "quickadapter/user_data/strategies/Utils.py", "message": "\"iloc\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 36, - "startLine": 3950 + "startLine": 3961 }, { "endCharacter": 59, - "endLine": 3952, + "endLine": 3963, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Cannot access attribute \"iloc\" for class \"NDArray[Any]\"\n  Attribute \"iloc\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 55, - "startLine": 3952 + "startLine": 3963 }, { "endCharacter": 34, - "endLine": 3954, + "endLine": 3965, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Cannot access attribute \"iloc\" for class \"NDArray[Any]\"\n  Attribute \"iloc\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 30, - "startLine": 3954 + "startLine": 3965 }, { "endCharacter": 51, - "endLine": 3954, + "endLine": 3965, "file": "quickadapter/user_data/strategies/Utils.py", "message": "\"iloc\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 47, - "startLine": 3954 + "startLine": 3965 }, { "endCharacter": 72, - "endLine": 3954, + "endLine": 3965, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Cannot access attribute \"iloc\" for class \"NDArray[Any]\"\n  Attribute \"iloc\" is unknown", "rule": "reportAttributeAccessIssue", "severity": "error", "startCharacter": 68, - "startLine": 3954 + "startLine": 3965 }, { "endCharacter": 40, - "endLine": 4021, + "endLine": 4032, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Type \"(Series[Any] | NDArray[floating[Any]], int) -> (Series[Any] | NDArray[floating[Any]])\" is not assignable to declared type \"(series: Unknown, timeperiod: Unknown) -> Series[Any]\"\n  Type \"(Series[Any] | NDArray[floating[Any]], int) -> (Series[Any] | NDArray[floating[Any]])\" is not assignable to type \"(series: Unknown, timeperiod: Unknown) -> Series[Any]\"\n    Missing keyword parameter \"series\"\n    Missing keyword parameter \"timeperiod\"\n      Position-only parameter mismatch; parameter \"series\" is not position-only\n      Position-only parameter mismatch; parameter \"timeperiod\" is not position-only\n      Position-only parameter mismatch; expected 2 but received 0\n      Function return type \"Series[Any] | NDArray[floating[Any]]\" is incompatible with type \"Series[Any]\"\n        Type \"Series[Any] | NDArray[floating[Any]]\" is not assignable to type \"Series[Any]\"\n ...", "rule": "reportAssignmentType", "severity": "error", "startCharacter": 20, - "startLine": 4021 + "startLine": 4032 }, { "endCharacter": 33, - "endLine": 4023, + "endLine": 4034, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Type \"(Series[Any] | NDArray[floating[Any]], int) -> (Series[Any] | NDArray[floating[Any]])\" is not assignable to declared type \"(series: Unknown, timeperiod: Unknown) -> Series[Any]\"\n  Type \"(Series[Any] | NDArray[floating[Any]], int) -> (Series[Any] | NDArray[floating[Any]])\" is not assignable to type \"(series: Unknown, timeperiod: Unknown) -> Series[Any]\"\n    Missing keyword parameter \"series\"\n    Missing keyword parameter \"timeperiod\"\n      Position-only parameter mismatch; parameter \"series\" is not position-only\n      Position-only parameter mismatch; parameter \"timeperiod\" is not position-only\n      Position-only parameter mismatch; expected 2 but received 0\n      Function return type \"Series[Any] | NDArray[floating[Any]]\" is incompatible with type \"Series[Any]\"\n        Type \"Series[Any] | NDArray[floating[Any]]\" is not assignable to type \"Series[Any]\"\n ...", "rule": "reportAssignmentType", "severity": "error", "startCharacter": 16, - "startLine": 4023 + "startLine": 4034 }, { "endCharacter": 35, - "endLine": 4069, + "endLine": 4080, "file": "quickadapter/user_data/strategies/Utils.py", "message": "\"to_numpy\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 27, - "startLine": 4069 + "startLine": 4080 }, { "endCharacter": 33, - "endLine": 4070, + "endLine": 4081, "file": "quickadapter/user_data/strategies/Utils.py", "message": "\"to_numpy\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 25, - "startLine": 4070 + "startLine": 4081 }, { "endCharacter": 37, - "endLine": 4187, + "endLine": 4198, "file": "quickadapter/user_data/strategies/Utils.py", "message": "\"to_numpy\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 29, - "startLine": 4187 + "startLine": 4198 }, { "endCharacter": 35, - "endLine": 4188, + "endLine": 4199, "file": "quickadapter/user_data/strategies/Utils.py", "message": "\"to_numpy\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 27, - "startLine": 4188 + "startLine": 4199 }, { "endCharacter": 33, - "endLine": 4189, + "endLine": 4200, "file": "quickadapter/user_data/strategies/Utils.py", "message": "\"to_numpy\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 25, - "startLine": 4189 + "startLine": 4200 }, { "endCharacter": 39, - "endLine": 4209, + "endLine": 4220, "file": "quickadapter/user_data/strategies/Utils.py", "message": "\"to_numpy\" is not a known attribute of \"None\"", "rule": "reportOptionalMemberAccess", "severity": "error", "startCharacter": 31, - "startLine": 4209 + "startLine": 4220 }, { "endCharacter": 92, - "endLine": 4568, + "endLine": 4579, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Type \"bool_ | bool\" is not assignable to return type \"bool\"\n  Type \"bool_ | bool\" is not assignable to type \"bool\"\n    \"numpy.bool[builtins.bool]\" is not assignable to \"bool\"", "rule": "reportReturnType", "severity": "error", "startCharacter": 15, - "startLine": 4568 + "startLine": 4579 }, { "endCharacter": 85, - "endLine": 4969, + "endLine": 4980, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Argument of type \"XGBoostPruningCallback\" cannot be assigned to parameter \"object\" of type \"RegressorCallback\" in function \"append\"\n  Type \"XGBoostPruningCallback\" is not assignable to type \"RegressorCallback\"\n    Type \"XGBoostPruningCallback\" is not assignable to type \"(...) -> Any\"\n    \"XGBoostPruningCallback\" is not assignable to \"TrainingCallback\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 16, - "startLine": 4969 + "startLine": 4980 }, { "endCharacter": 29, - "endLine": 5012, + "endLine": 5023, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Argument of type \"list[tuple[DataFrame, DataFrame]] | None\" cannot be assigned to parameter \"eval_set\" of type \"List[_LGBM_ScikitValidSet] | None\" in function \"fit\"\n  Type \"list[tuple[DataFrame, DataFrame]] | None\" is not assignable to type \"List[_LGBM_ScikitValidSet] | None\"\n    Type \"list[tuple[DataFrame, DataFrame]]\" is not assignable to type \"List[_LGBM_ScikitValidSet] | None\"\n      \"list[tuple[DataFrame, DataFrame]]\" is not assignable to \"List[_LGBM_ScikitValidSet]\"\n        Type parameter \"_T@list\" is invariant, but \"tuple[DataFrame, DataFrame]\" is not the same as \"_LGBM_ScikitValidSet\"\n        Consider switching from \"list\" to \"Sequence\" which is covariant\n      \"list[tuple[DataFrame, DataFrame]]\" is not assignable to \"None\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 21, - "startLine": 5012 + "startLine": 5023 }, { "endCharacter": 43, - "endLine": 5013, + "endLine": 5024, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Argument of type \"list[NDArray[floating[Any]]] | None\" cannot be assigned to parameter \"eval_sample_weight\" of type \"List[_LGBM_WeightType] | None\" in function \"fit\"\n  Type \"list[NDArray[floating[Any]]] | None\" is not assignable to type \"List[_LGBM_WeightType] | None\"\n    Type \"list[NDArray[floating[Any]]]\" is not assignable to type \"List[_LGBM_WeightType] | None\"\n      \"list[NDArray[floating[Any]]]\" is not assignable to \"List[_LGBM_WeightType]\"\n        Type parameter \"_T@list\" is invariant, but \"NDArray[floating[Any]]\" is not the same as \"_LGBM_WeightType\"\n        Consider switching from \"list\" to \"Sequence\" which is covariant\n      \"list[NDArray[floating[Any]]]\" is not assignable to \"None\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 31, - "startLine": 5013 + "startLine": 5024 }, { "endCharacter": 62, - "endLine": 5016, + "endLine": 5027, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Argument of type \"list[RegressorCallback] | None\" cannot be assigned to parameter \"callbacks\" of type \"List[(...) -> Unknown] | None\" in function \"fit\"\n  Type \"list[RegressorCallback] | None\" is not assignable to type \"List[(...) -> Unknown] | None\"\n    Type \"list[RegressorCallback]\" is not assignable to type \"List[(...) -> Unknown] | None\"\n      \"list[RegressorCallback]\" is not assignable to \"List[(...) -> Unknown]\"\n        Type parameter \"_T@list\" is invariant, but \"RegressorCallback\" is not the same as \"(...) -> Unknown\"\n        Consider switching from \"list\" to \"Sequence\" which is covariant\n      \"list[RegressorCallback]\" is not assignable to \"None\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 22, - "startLine": 5016 + "startLine": 5027 }, { "endCharacter": 35, - "endLine": 5038, + "endLine": 5049, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Object of type \"None\" is not subscriptable", "rule": "reportOptionalSubscript", "severity": "error", "startCharacter": 27, - "startLine": 5038 + "startLine": 5049 }, { "endCharacter": 35, - "endLine": 5084, + "endLine": 5095, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Object of type \"None\" is not subscriptable", "rule": "reportOptionalSubscript", "severity": "error", "startCharacter": 27, - "startLine": 5084 + "startLine": 5095 }, { "endCharacter": 49, - "endLine": 5154, + "endLine": 5165, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Argument of type \"CatBoostPruningCallback\" cannot be assigned to parameter \"object\" of type \"RegressorCallback\" in function \"append\"\n  Type \"CatBoostPruningCallback\" is not assignable to type \"RegressorCallback\"\n    Type \"CatBoostPruningCallback\" is not assignable to type \"(...) -> Any\"\n    \"CatBoostPruningCallback\" is not assignable to \"TrainingCallback\"", "rule": "reportArgumentType", "severity": "error", "startCharacter": 33, - "startLine": 5154 + "startLine": 5165 }, { "endCharacter": 75, - "endLine": 5397, + "endLine": 5408, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Operator \"<=\" not supported for \"None\"", "rule": "reportOptionalOperand", "severity": "error", "startCharacter": 54, - "startLine": 5397 + "startLine": 5408 }, { "endCharacter": 23, - "endLine": 5560, + "endLine": 5571, "file": "quickadapter/user_data/strategies/Utils.py", "message": "\"best_params\" is possibly unbound", "rule": "reportPossiblyUnboundVariable", "severity": "error", "startCharacter": 12, - "startLine": 5560 + "startLine": 5571 }, { "endCharacter": 38, - "endLine": 5567, + "endLine": 5578, "file": "quickadapter/user_data/strategies/Utils.py", "message": "\"best_params\" is possibly unbound", "rule": "reportPossiblyUnboundVariable", "severity": "error", "startCharacter": 27, - "startLine": 5567 + "startLine": 5578 }, { "endCharacter": 22, - "endLine": 5579, + "endLine": 5590, "file": "quickadapter/user_data/strategies/Utils.py", "message": "\"best_params\" is possibly unbound", "rule": "reportPossiblyUnboundVariable", "severity": "error", "startCharacter": 11, - "startLine": 5579 + "startLine": 5590 }, { "endCharacter": 22, - "endLine": 5737, + "endLine": 5748, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Declaration \"default_ranges\" is obscured by a declaration of the same name", "rule": "reportRedeclaration", "severity": "error", "startCharacter": 8, - "startLine": 5737 + "startLine": 5748 }, { "endCharacter": 14, - "endLine": 5773, + "endLine": 5784, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Declaration \"params\" is obscured by a declaration of the same name", "rule": "reportRedeclaration", "severity": "error", "startCharacter": 8, - "startLine": 5773 + "startLine": 5784 }, { "endCharacter": 22, - "endLine": 5857, + "endLine": 5868, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Declaration \"default_ranges\" is obscured by a declaration of the same name", "rule": "reportRedeclaration", "severity": "error", "startCharacter": 8, - "startLine": 5857 + "startLine": 5868 }, { "endCharacter": 14, - "endLine": 5891, + "endLine": 5902, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Declaration \"params\" is obscured by a declaration of the same name", "rule": "reportRedeclaration", "severity": "error", "startCharacter": 8, - "startLine": 5891 + "startLine": 5902 }, { "endCharacter": 22, - "endLine": 5962, + "endLine": 5973, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Declaration \"default_ranges\" is obscured by a declaration of the same name", "rule": "reportRedeclaration", "severity": "error", "startCharacter": 8, - "startLine": 5962 + "startLine": 5973 }, { "endCharacter": 22, - "endLine": 6063, + "endLine": 6074, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Declaration \"default_ranges\" is obscured by a declaration of the same name", "rule": "reportRedeclaration", "severity": "error", "startCharacter": 8, - "startLine": 6063 + "startLine": 6074 }, { "endCharacter": 26, - "endLine": 6146, + "endLine": 6157, "file": "quickadapter/user_data/strategies/Utils.py", "message": "Declaration \"default_ranges\" is obscured by a declaration of the same name", "rule": "reportRedeclaration", "severity": "error", "startCharacter": 12, - "startLine": 6146 + "startLine": 6157 } ], "filesAnalyzed": 5, diff --git a/quickadapter/tests/test_regressor_label_config.py b/quickadapter/tests/test_regressor_label_config.py index 2a0d894..221e611 100644 --- a/quickadapter/tests/test_regressor_label_config.py +++ b/quickadapter/tests/test_regressor_label_config.py @@ -339,17 +339,34 @@ class RegressorLabelConfigTest(QaTestCase): def test_knn_density_aggregation_and_neighbour_bounds_are_fatal(self): cases = { - "label_density_aggregation": ("median", "supported values are power_mean"), - "label_density_n_neighbors": (0, "must be int >= 1"), - "label_density_aggregation_param": (1.5, "must be in \\[0, 1\\]"), + "label_density_aggregation": ("median",), + "label_density_n_neighbors": (0, True, np.bool_(True), 1.5, "5"), + "label_density_aggregation_param": ( + 1.5, + True, + np.bool_(False), + "0.5", + 1 + 0j, + [0.5], + 10**500, + np.longdouble("1e400"), + ), } - for key, (value, fragment) in cases.items(): - with self.subTest(key=key): - ft_params = {"label_density_aggregation": "quantile"} - ft_params[key] = value - model = label_regressor(ft_params=ft_params) - with self.assertRaisesRegex(ValueError, fragment): - model._resolve_label_method_config("knn") + for key, values in cases.items(): + for value in values: + with self.subTest(key=key, value=value): + ft_params = {"label_density_aggregation": "quantile"} + ft_params[key] = value + model = label_regressor(ft_params=ft_params) + with self.assertRaises(ValueError): + model._resolve_label_method_config("knn") + + def test_invalid_scalar_orders_cannot_enter_persisted_selection_metadata(self): + for value in (True, np.bool_(False), "2.0", 2 + 0j, [2.0], 10**500): + with self.subTest(value=value): + model = label_regressor(ft_params={"label_p_order": value}) + with self.assertRaises(ValueError): + model._optuna_label_selection_metadata() def test_knn_aggregation_param_defaults_follow_the_aggregation(self): expected = { @@ -666,19 +683,24 @@ class RegressorLabelConfigTest(QaTestCase): self.assertEqual(metadata["method_config"]["category"], "cluster") self.assertIsInstance(json_roundtrip(metadata), dict) + def test_selection_metadata_serializes_a_numpy_aggregation_parameter(self): + model = label_regressor( + ft_params={ + "label_method": "knn", + "label_density_aggregation": "quantile", + "label_density_aggregation_param": np.float32(0.5), + } + ) + metadata = model._optuna_label_selection_metadata() + self.assertEqual(json_roundtrip(metadata)["method_config"]["aggregation_param"], 0.5) + def test_selection_metadata_refuses_non_finite_weights_and_p_order(self): cases = { - "label_weights": ( - {"label_weights": [0.5, np.inf]}, - "label_weights contains non-finite", - ), - "label_p_order": ( - {"label_p_order": float("nan")}, - "label_p_order is non-finite", - ), + "label_weights": {"label_weights": [0.5, np.inf]}, + "label_p_order": {"label_p_order": float("nan")}, } - for name, (ft_params, fragment) in cases.items(): - with self.subTest(field=name), self.assertRaisesRegex(ValueError, fragment): + for name, ft_params in cases.items(): + with self.subTest(field=name), self.assertRaises(ValueError): label_regressor(ft_params=ft_params)._optuna_label_selection_metadata() def test_optuna_create_sampler_maps_every_enum_to_its_sampler(self): diff --git a/quickadapter/tests/test_regressor_prediction_history.py b/quickadapter/tests/test_regressor_prediction_history.py index 656906b..6e87c0a 100644 --- a/quickadapter/tests/test_regressor_prediction_history.py +++ b/quickadapter/tests/test_regressor_prediction_history.py @@ -598,14 +598,51 @@ class RegressorPredictionHistoryTest(QaTestCase): None, "0.5", [1.0], + True, + np.bool_(True), + 1 + 0j, + 10**500, + np.longdouble("1e400"), ): with self.subTest(value=value): self.assertIsNone(QuickAdapterRegressorV3.optuna_validate_value(value)) - def test_validate_value_passes_finite_numbers_through_unchanged(self): - self.assertEqual(QuickAdapterRegressorV3.optuna_validate_value(3), 3) - self.assertEqual(QuickAdapterRegressorV3.optuna_validate_value(-1.25), -1.25) - self.assertEqual(QuickAdapterRegressorV3.optuna_validate_value(0.0), 0.0) + def test_validate_value_preserves_finite_python_and_numpy_scores(self): + for value, expected in ( + (3, 3.0), + (-1.25, -1.25), + (0.0, 0.0), + (np.int64(2), 2.0), + (np.float32(0.5), 0.5), + ): + with self.subTest(value=value): + self.assertEqual(QuickAdapterRegressorV3.optuna_validate_value(value), expected) + + def test_loaded_holdout_rmse_preserves_valid_scores_and_rejects_invalid_metadata(self): + for value, expected in ( + (0, 0.0), + (0.25, 0.25), + (np.int64(2), 2.0), + (np.float32(0.5), 0.5), + (-1, np.inf), + (None, np.inf), + ("0.25", np.inf), + (True, np.inf), + (np.bool_(True), np.inf), + (np.nan, np.inf), + (np.inf, np.inf), + (-np.inf, np.inf), + (10**500, np.inf), + (np.longdouble("1e400"), np.inf), + ): + with self.subTest(value=value): + model, dk, _ = calibrated() + model._session_fitted_pairs.clear() + dk.data["extra_returns_per_train"]["holdout_rmse"] = value + + model.fit_live_predictions(dk, PAIR) + + self.assertEqual(dk.data["extra_returns_per_train"]["holdout_rmse"], expected) def test_holdout_rmse_is_infinite_rather_than_a_fabricated_score(self): # (in-memory score, persisted replay column, pair already fitted this session) diff --git a/quickadapter/tests/test_regressor_selection.py b/quickadapter/tests/test_regressor_selection.py index 62c61ce..e823b02 100644 --- a/quickadapter/tests/test_regressor_selection.py +++ b/quickadapter/tests/test_regressor_selection.py @@ -41,6 +41,19 @@ AT_IDEAL = np.array([[1.0, 1.0]]) ABOVE_IDEAL = np.array([[2.0, 2.0]]) #: A row whose two objectives are unequal, so its power mean genuinely depends on p. ASYMMETRIC_ROW = np.array([[0.25, 0.75]]) +INVALID_REAL_SCALARS = ( + np.inf, + -np.inf, + np.nan, + True, + np.bool_(False), + "2.0", + 2 + 0j, + [], + np.array([2.0]), + 10**500, + np.longdouble("1e400"), +) def front() -> np.ndarray: @@ -1092,13 +1105,13 @@ class RegressorSelectionTest(QaTestCase): # The knn route hard-codes the raise mode, so a bad aggregation param aborts # the selection instead of being quietly downgraded to a different aggregate. line = np.array([[0.0, 0.0], [1.0, 0.0], [4.0, 0.0]]) - for aggregation, param, constraint in ( - ("quantile", 1.5, r"must be in \[0, 1\]"), - ("quantile", -0.1, r"must be in \[0, 1\]"), - ("power_mean", np.inf, "must be finite"), + for aggregation, param in ( + ("quantile", 1.5), + ("quantile", -0.1), + ("power_mean", np.inf), ): with self.subTest(aggregation=aggregation, param=param): - with self.assertRaisesRegex(ValueError, constraint) as caught: + with self.assertRaises(ValueError) as caught: QuickAdapterRegressorV3._knn_based_selection( line, aggregation, @@ -1337,6 +1350,9 @@ class RegressorSelectionTest(QaTestCase): pd.Series(dtype=float), pd.Series([np.nan, np.nan]), pd.Series([np.nan, np.inf]), + pd.Series([1 + 2j]), + pd.Series([10**500], dtype=object), + pd.Series([np.longdouble("1e400")], dtype=object), ): with self.subTest(series=series.tolist()): self.assertEqual(QuickAdapterRegressorV3.safe_min_pred(series), -2.0) @@ -1603,40 +1619,33 @@ class RegressorSelectionTest(QaTestCase): # ------------------------------------------------------------------ scalar validators - def test_a_non_finite_scalar_is_refused_in_raise_mode(self): - for value in (np.inf, -np.inf, np.nan): + def test_an_invalid_scalar_is_refused_in_raise_mode(self): + for value in INVALID_REAL_SCALARS: with ( self.subTest(value=value, mode="raise"), - self.assertRaisesRegex(ValueError, "must be finite"), + self.assertRaises(ValueError), ): QuickAdapterRegressorV3._validate_scalar(value, ctx="label_p_order", mode=RAISE) - def test_a_non_finite_scalar_is_warned_and_dropped_in_warn_mode(self): - for value in (np.inf, -np.inf, np.nan): + def test_an_invalid_scalar_is_warned_and_dropped_in_warn_mode(self): + for value in INVALID_REAL_SCALARS: with self.subTest(value=value, mode="warn"): with self.assertLogs(LOGGER_NAME, "WARNING") as captured: warned = QuickAdapterRegressorV3._validate_scalar( value, ctx="label_p_order", mode=WARN ) self.assertIsNone(warned) - self.assertIn("must be finite", captured.output[0]) + self.assertIn("label_p_order", captured.output[0]) - def test_a_non_finite_scalar_is_silently_dropped_in_none_mode(self): - for value in (np.inf, -np.inf, np.nan): + def test_an_invalid_scalar_is_silently_dropped_in_none_mode(self): + for value in INVALID_REAL_SCALARS: with self.subTest(value=value, mode="none"), self.assertNoLogs(LOGGER_NAME, "WARNING"): self.assertIsNone( QuickAdapterRegressorV3._validate_scalar(value, ctx="label_p_order", mode=NONE) ) - # These three used to share one `with` block behind the raising call, so the warn and - # none branches never executed at all: the raise on the first line unwound the block. - # The suite was green and the test name claimed all three modes. Removing the non-finite - # warning in `_validate_scalar`, or turning its `return None` into `return 0.0`, both - # survived — the first because the warning was never asserted, the second because the - # fallback case in the file used a degenerate row below the ideal count. - - def test_a_predicate_violation_is_reported_with_the_supplied_constraint(self): - with self.assertRaisesRegex(ValueError, "must be > 0"): + def test_a_predicate_violation_preserves_raise_and_warn_modes(self): + with self.assertRaises(ValueError): QuickAdapterRegressorV3._validate_scalar( -1.0, ctx="label_p_order", @@ -1654,14 +1663,20 @@ class RegressorSelectionTest(QaTestCase): constraint="must be > 0", ) ) - self.assertIn("must be > 0", captured.output[0]) + self.assertIn("label_p_order", captured.output[0]) def test_a_valid_scalar_is_returned_as_a_float_in_every_mode(self): for mode in (RAISE, WARN, NONE): - with self.subTest(mode=mode), self.assertNoLogs(LOGGER_NAME, "WARNING"): - result = QuickAdapterRegressorV3._validate_scalar(3, ctx="label_p_order", mode=mode) - self.assertIsInstance(result, float) - self.assertAlmostEqual(result, 3.0, places=12) + for value, expected in ((3, 3.0), (np.int64(2), 2.0), (np.float32(0.5), 0.5)): + with ( + self.subTest(mode=mode, value=value), + self.assertNoLogs(LOGGER_NAME, "WARNING"), + ): + result = QuickAdapterRegressorV3._validate_scalar( + value, ctx="label_p_order", mode=mode + ) + self.assertIsInstance(result, float) + self.assertEqual(result, expected) def test_a_missing_scalar_is_never_validated(self): for mode in (RAISE, WARN, NONE): @@ -1671,7 +1686,7 @@ class RegressorSelectionTest(QaTestCase): ) def test_the_minkowski_p_must_be_strictly_positive(self): - with self.assertRaisesRegex(ValueError, "must be > 0"): + with self.assertRaises(ValueError): QuickAdapterRegressorV3._validate_minkowski_p(0.0, ctx="label_p_order") for valid in (1e-9, 1.0, 2.0, np.inf - 0.0): with self.subTest(valid=valid): @@ -1695,10 +1710,21 @@ class RegressorSelectionTest(QaTestCase): for invalid in (-1e-9, 1.0 + 1e-9): with ( self.subTest(invalid=invalid), - self.assertRaisesRegex(ValueError, r"must be in \[0, 1\]"), + self.assertRaises(ValueError), ): QuickAdapterRegressorV3._validate_quantile_q(invalid, ctx="label_quantile") + def test_float_normalization_does_not_hide_quantile_or_positive_order_violations(self): + above_one = np.nextafter(np.longdouble(1), np.longdouble(2)) + with self.assertRaises(ValueError): + QuickAdapterRegressorV3._validate_quantile_q(above_one, ctx="label_quantile") + below_float_range = np.nextafter(np.longdouble(0), np.longdouble(1)) + if float(below_float_range) == 0.0: + with self.assertRaises(ValueError): + QuickAdapterRegressorV3._validate_minkowski_p( + below_float_range, ctx="label_p_order" + ) + def test_the_power_mean_p_is_only_required_to_be_finite(self): # p=0 is the geometric mean and p<0 a harmonic-style mean, so unlike the # Minkowski order there is no sign constraint here. @@ -1712,7 +1738,7 @@ class RegressorSelectionTest(QaTestCase): for invalid in (np.inf, np.nan): with ( self.subTest(invalid=invalid), - self.assertRaisesRegex(ValueError, "must be finite"), + self.assertRaises(ValueError), ): QuickAdapterRegressorV3._validate_power_mean_p(invalid, ctx="label_p_order") diff --git a/quickadapter/tests/test_strategy_reversal.py b/quickadapter/tests/test_strategy_reversal.py index 6e3019e..db163e7 100644 --- a/quickadapter/tests/test_strategy_reversal.py +++ b/quickadapter/tests/test_strategy_reversal.py @@ -4,7 +4,7 @@ import unittest import numpy as np import pandas as pd -from qa_support import QaTestCase +from qa_support import QaTestCase, model_config, temporary_directory from QuickAdapterV3 import QuickAdapterV3 LONG = QuickAdapterV3._TRADE_LONG @@ -48,6 +48,44 @@ def frame(closes): class ReversalConfirmationTest(QaTestCase): + def test_numpy_candle_precision_preserves_real_reversal_decisions(self): + for dtype in (np.float32, np.float64): + for side, closes, opens, passing_rate, failing_rate in ( + (LONG, [100, 102, 104], [99, 101, 103], 110, 104), + (SHORT, [100, 98, 96], [101, 99, 97], 90, 96), + ): + with self.subTest(dtype=dtype, side=side), temporary_directory() as temp: + model = QuickAdapterV3(config=model_config(temp)) + model.freqai_info = model.config["freqai"] + model.bot_start() + df = pd.DataFrame( + { + "date": pd.date_range("2026-01-01", periods=3, freq="5min", tz="UTC"), + "open": np.array(opens, dtype=dtype), + "close": np.array(closes, dtype=dtype), + "natr_label_period_candles": np.ones(3, dtype=dtype), + "label_period_candles": np.full(3, 2, dtype=dtype), + "label_natr_multiplier": np.ones(3, dtype=dtype), + } + ) + for rate, expected in ((passing_rate, True), (failing_rate, False)): + self.assertEqual( + bool( + self._confirm( + model, + df, + side=side, + order=ENTRY, + rate=dtype(rate), + lookback=1, + decay=dtype(1), + lo=dtype(0.5), + hi=dtype(1), + ) + ), + expected, + ) + def _confirm(self, model, df, *, side, order, rate, lookback=0, decay=1.0, lo=0.5, hi=1.0): return model.reversal_confirmed( df, diff --git a/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py b/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py index 9e08372..f3aefe4 100644 --- a/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py +++ b/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py @@ -97,7 +97,9 @@ from Utils import ( LabelWeightSupportError, OptunaNamespace, Regressor, + _NumericValidator, _optuna_quarantine_path, + coerce_finite_float, compose_sample_weights, ensure_datetime_series, enum_error_message, @@ -740,9 +742,10 @@ class QuickAdapterRegressorV3(BaseRegressionModel): @staticmethod def _coerce_int(value: Any, name: str, *, minimum: int) -> int: - if isinstance(value, bool) or not isinstance(value, int) or value < minimum: + validator = _NumericValidator(min_value=minimum, require_int=True) + if not validator(value): raise ValueError( - f"Invalid data_split_parameters.{name} value {value!r}: must be int >= {minimum}" + f"Invalid data_split_parameters.{name} value {value!r}: {validator.message(name)}" ) return value @@ -1114,7 +1117,7 @@ class QuickAdapterRegressorV3(BaseRegressionModel): @staticmethod def _validate_scalar( - value: float | None, + value: Any, *, ctx: str, mode: ValidationMode, @@ -1123,28 +1126,19 @@ class QuickAdapterRegressorV3(BaseRegressionModel): ) -> float | None: if value is None: return None - if mode == _VALIDATION_MODES[2]: # "none" - return ( - float(value) - if (np.isfinite(value) and (predicate is None or predicate(value))) - else None - ) - - if not np.isfinite(value): - msg = f"Invalid {ctx} value {value!r}: must be finite" - if mode == _VALIDATION_MODES[1]: # "raise" - raise ValueError(msg) - logger.warning(f"{msg}, using default") - return None - - if predicate is not None and not predicate(value): + scalar = coerce_finite_float(value) + if scalar is None: + msg = f"Invalid {ctx} value {value!r}: must be a finite real number representable as a float" + elif predicate is not None and (not predicate(value) or not predicate(scalar)): msg = f"Invalid {ctx} value {value!r}: {constraint}" - if mode == _VALIDATION_MODES[1]: # "raise" - raise ValueError(msg) - logger.warning(f"{msg}, using default") + else: + return scalar + if mode == _VALIDATION_MODES[2]: # "none" return None - - return float(value) + if mode == _VALIDATION_MODES[1]: # "raise" + raise ValueError(msg) + logger.warning(f"{msg}, using default") + return None @staticmethod def _validate_minkowski_p( @@ -1461,9 +1455,11 @@ class QuickAdapterRegressorV3(BaseRegressionModel): "label_density_n_neighbors", QuickAdapterRegressorV3.LABEL_DENSITY_N_NEIGHBORS_DEFAULT, ) - if not isinstance(n_neighbors, int) or n_neighbors < 1: + validator = _NumericValidator(min_value=1, require_int=True) + if not validator(n_neighbors): raise ValueError( - f"Invalid label_density_n_neighbors value {n_neighbors!r}: must be int >= 1" + f"Invalid label_density_n_neighbors value {n_neighbors!r}: " + f"{validator.message('label_density_n_neighbors')}" ) config["n_neighbors"] = n_neighbors @@ -1476,12 +1472,12 @@ class QuickAdapterRegressorV3(BaseRegressionModel): if aggregation_param is not None: if aggregation == QuickAdapterRegressorV3._DENSITY_AGG_QUANTILE: - QuickAdapterRegressorV3._validate_quantile_q( + aggregation_param = QuickAdapterRegressorV3._validate_quantile_q( aggregation_param, ctx="label_density_aggregation_param", ) elif aggregation == QuickAdapterRegressorV3._DENSITY_AGG_POWER_MEAN: - QuickAdapterRegressorV3._validate_power_mean_p( + aggregation_param = QuickAdapterRegressorV3._validate_power_mean_p( aggregation_param, ctx="label_density_aggregation_param", ) @@ -1520,15 +1516,18 @@ class QuickAdapterRegressorV3(BaseRegressionModel): label_p_order = self.ft_params.get("label_p_order") if label_weights is not None and not all(np.isfinite(float(w)) for w in label_weights): raise ValueError(f"label_weights contains non-finite values: {label_weights!r}") - if label_p_order is not None and not np.isfinite(float(label_p_order)): - raise ValueError(f"label_p_order is non-finite: {label_p_order!r}") + label_p_order = QuickAdapterRegressorV3._validate_scalar( + label_p_order, + ctx="label_p_order", + mode=_VALIDATION_MODES[1], # "raise" + ) return { "schema_version": _OPTUNA_LABEL_SELECTION_SCHEMA_VERSION, "method_config": self._resolve_label_method_config(label_method), "label_weights": ( [float(w) for w in label_weights] if label_weights is not None else None ), - "label_p_order": (float(label_p_order) if label_p_order is not None else None), + "label_p_order": label_p_order, } @cached_property @@ -2122,14 +2121,8 @@ class QuickAdapterRegressorV3(BaseRegressionModel): @staticmethod def _coerce_holdout_rmse(value: Any) -> float: """Keep genuine zero error; negative, missing and non-finite scores are unavailable.""" - if ( - isinstance(value, (int, float, np.integer, np.floating)) - and not isinstance(value, (bool, np.bool_)) - and np.isfinite(value) - and value >= 0 - ): - return float(value) - return np.inf + score = coerce_finite_float(value) + return score if score is not None and value >= 0 else np.inf @staticmethod def _kitchen_model_identity(dk: FreqaiDataKitchen) -> tuple[str, str]: @@ -4336,7 +4329,7 @@ class QuickAdapterRegressorV3(BaseRegressionModel): @staticmethod def optuna_validate_value(value: Any) -> float | None: - return value if isinstance(value, (int, float)) and np.isfinite(value) else None + return coerce_finite_float(value) def min_max_pred( self, @@ -4502,16 +4495,10 @@ class QuickAdapterRegressorV3(BaseRegressionModel): fallback: float, ) -> float: try: - reduced = reducer(pred_label) + reduced = coerce_finite_float(reducer(pred_label)) except Exception: - reduced = None - if ( - reduced is not None - and isinstance(reduced, (int, float, np.number)) - and np.isfinite(reduced) - ): - return float(reduced) - return fallback + return fallback + return fallback if reduced is None else reduced # ±2.0 fallbacks are out-of-[-1, 1] normalized-range sentinels. @staticmethod diff --git a/quickadapter/user_data/strategies/QuickAdapterV3.py b/quickadapter/user_data/strategies/QuickAdapterV3.py index 88950f7..c63bae1 100644 --- a/quickadapter/user_data/strategies/QuickAdapterV3.py +++ b/quickadapter/user_data/strategies/QuickAdapterV3.py @@ -16,6 +16,7 @@ from typing import ( import numpy as np import pandas_ta as pta import talib.abstract as ta +from freqtrade.constants import EntryExit, LongShort from freqtrade.enums import TRADE_MODES from freqtrade.exchange import ( timeframe_to_minutes, @@ -98,9 +99,7 @@ from Utils import ( zlema, ) -TradeDirection = Literal["long", "short"] InterpolationDirection = Literal["direct", "inverse"] -OrderType = Literal["entry", "exit"] TradingMode = Literal["spot", "margin", "futures"] DfSignature = tuple[int, datetime.datetime | None] @@ -111,7 +110,7 @@ CandleThresholdCacheKey = tuple[str, DfSignature, str, int, float, float] class _FinalTakeProfitState(TypedDict): version: int exit_stage: int - trade_direction: TradeDirection + trade_direction: LongShort best_rate: float retracement_distance: float boundary_candle_date: str @@ -191,20 +190,20 @@ class QuickAdapterV3(IStrategy): INTERFACE_VERSION = 3 - _TRADE_DIRECTIONS: Final[tuple[TradeDirection, ...]] = ("long", "short") - _TRADE_LONG: Final[str] = _TRADE_DIRECTIONS[0] # "long" - _TRADE_SHORT: Final[str] = _TRADE_DIRECTIONS[1] # "short" - _TRADE_DIRECTIONS_SET: Final[frozenset[TradeDirection]] = frozenset(_TRADE_DIRECTIONS) + _TRADE_DIRECTIONS: Final[tuple[LongShort, ...]] = ("long", "short") + _TRADE_LONG: Final[LongShort] = _TRADE_DIRECTIONS[0] # "long" + _TRADE_SHORT: Final[LongShort] = _TRADE_DIRECTIONS[1] # "short" + _TRADE_DIRECTIONS_SET: Final[frozenset[LongShort]] = frozenset(_TRADE_DIRECTIONS) _INTERPOLATION_DIRECTIONS: Final[tuple[InterpolationDirection, ...]] = ( "direct", "inverse", ) _INTERPOLATION_DIRECT: Final[str] = _INTERPOLATION_DIRECTIONS[0] # "direct" _INTERPOLATION_INVERSE: Final[str] = _INTERPOLATION_DIRECTIONS[1] # "inverse" - _ORDER_TYPES: Final[tuple[OrderType, ...]] = ("entry", "exit") - _ORDER_ENTRY: Final[str] = _ORDER_TYPES[0] # "entry" - _ORDER_EXIT: Final[str] = _ORDER_TYPES[1] # "exit" - _ORDER_TYPES_SET: Final[frozenset[OrderType]] = frozenset(_ORDER_TYPES) + _ORDER_TYPES: Final[tuple[EntryExit, ...]] = ("entry", "exit") + _ORDER_ENTRY: Final[EntryExit] = _ORDER_TYPES[0] # "entry" + _ORDER_EXIT: Final[EntryExit] = _ORDER_TYPES[1] # "exit" + _ORDER_TYPES_SET: Final[frozenset[EntryExit]] = frozenset(_ORDER_TYPES) _TRADING_MODES: Final[tuple[TradingMode, ...]] = ("spot", "margin", "futures") _TRADING_MODE_SPOT: Final[str] = _TRADING_MODES[0] # "spot" _TRADING_MODE_MARGIN: Final[str] = _TRADING_MODES[1] # "margin" @@ -1618,7 +1617,7 @@ class QuickAdapterV3(IStrategy): *, best_rate: float, retracement_distance: float, - trade_direction: TradeDirection, + trade_direction: LongShort, ) -> float | None: if ( not np.isfinite(best_rate) @@ -1652,7 +1651,7 @@ class QuickAdapterV3(IStrategy): def _build_final_take_profit_state( *, exit_stage: int, - trade_direction: TradeDirection, + trade_direction: LongShort, current_rate: float, take_profit_distance: float, retracement_fraction: float, @@ -1705,7 +1704,7 @@ class QuickAdapterV3(IStrategy): state: Any, *, exit_stage: int, - trade_direction: TradeDirection, + trade_direction: LongShort, open_rate: float, timeframe: str, minimum_candle_date: datetime.datetime, @@ -2124,7 +2123,7 @@ class QuickAdapterV3(IStrategy): self, df: DataFrame, pair: str, - side: TradeDirection, + side: LongShort, min_natr_multiplier_fraction: float, max_natr_multiplier_fraction: float, candle_idx: int = -1, @@ -2181,8 +2180,8 @@ class QuickAdapterV3(IStrategy): self, df: DataFrame, pair: str, - side: TradeDirection, - order: OrderType, + side: LongShort, + order: EntryExit, rate: float, lookback_period_candles: int, decay_fraction: float, @@ -2210,13 +2209,11 @@ class QuickAdapterV3(IStrategy): return False if order not in QuickAdapterV3._ORDER_TYPES_SET: return False - if not isinstance(rate, (int, float)) or not np.isfinite(rate): + if not is_finite_number(rate): return False if ( - not isinstance(min_natr_multiplier_fraction, (int, float)) - or not isinstance(max_natr_multiplier_fraction, (int, float)) - or not np.isfinite(min_natr_multiplier_fraction) - or not np.isfinite(max_natr_multiplier_fraction) + not is_finite_number(min_natr_multiplier_fraction) + or not is_finite_number(max_natr_multiplier_fraction) or min_natr_multiplier_fraction < 0 or max_natr_multiplier_fraction < 0 or min_natr_multiplier_fraction > max_natr_multiplier_fraction @@ -2232,7 +2229,7 @@ class QuickAdapterV3(IStrategy): ): return False lookback_period_candles = min(lookback_period_candles, max_lookback_period_candles) - if not isinstance(decay_fraction, (int, float)): + if not is_finite_number(decay_fraction): logger.debug(f"[{pair}] Denied {trade_direction} {order}: invalid decay_fraction type") return False if not (0.0 < decay_fraction <= 1.0): @@ -2249,7 +2246,7 @@ class QuickAdapterV3(IStrategy): max_natr_multiplier_fraction=max_natr_multiplier_fraction, candle_idx=-1, ) - current_ok = np.isfinite(current_threshold) and ( + current_ok = is_finite_number(current_threshold) and ( (side == QuickAdapterV3._TRADE_LONG and rate > current_threshold) or (side == QuickAdapterV3._TRADE_SHORT and rate < current_threshold) ) @@ -2270,7 +2267,7 @@ class QuickAdapterV3(IStrategy): unmeasurable_history_ok = order == QuickAdapterV3._ORDER_EXIT and current_ok for k in range(1, lookback_period_candles + 1): close_k = df.iloc[-k].get("close") - if not isinstance(close_k, (int, float)) or not np.isfinite(close_k): + if close_k is None or not is_finite_number(close_k): return unmeasurable_history_ok decay_factor = decay_fraction**k @@ -2290,7 +2287,7 @@ class QuickAdapterV3(IStrategy): max_natr_multiplier_fraction=decayed_max_natr_multiplier_fraction, candle_idx=-(k + 1), ) - if not isinstance(threshold_k, (int, float)) or not np.isfinite(threshold_k): + if not is_finite_number(threshold_k): return unmeasurable_history_ok if (side == QuickAdapterV3._TRADE_LONG and not (close_k > threshold_k)) or ( diff --git a/quickadapter/user_data/strategies/Utils.py b/quickadapter/user_data/strategies/Utils.py index 92cc4cc..507f817 100644 --- a/quickadapter/user_data/strategies/Utils.py +++ b/quickadapter/user_data/strategies/Utils.py @@ -344,6 +344,17 @@ def is_finite_number(value: Any) -> bool: ) +def coerce_finite_float(value: Any) -> float | None: + """Return a finite Python float for a real numeric scalar, otherwise None.""" + if not is_finite_number(value): + return None + try: + result = float(value) + except (TypeError, ValueError, OverflowError): + return None + return result if math.isfinite(result) else None + + @dataclass(frozen=True, slots=True) class _EnumValidator: valid_values: tuple[str, ...] -- 2.53.0