freqtrade/freqtrade

View on GitHub

Showing 514 of 516 total issues

Avoid too many return statements within this function.
Open

                return float(pnl * factor)
Severity: Major
Found in freqtrade/freqai/RL/BaseReinforcementLearningModel.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return stoploss_value
    Severity: Major
    Found in freqtrade/optimize/backtesting.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return 0.0
      Severity: Major
      Found in freqtrade/freqai/RL/BaseReinforcementLearningModel.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        return float(pnl * factor)
        Severity: Major
        Found in freqtrade/freqai/prediction_models/ReinforcementLearner.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return 0.0
          Severity: Major
          Found in freqtrade/freqai/prediction_models/ReinforcementLearner.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return (True, 0)
            Severity: Major
            Found in freqtrade/data/dataprovider.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return kv.int_value
              Severity: Major
              Found in freqtrade/persistence/key_value_store.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                return __price_to_precision_significant_digits(
                Severity: Major
                Found in freqtrade/exchange/exchange_utils.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return price
                  Severity: Major
                  Found in freqtrade/exchange/exchange_utils.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                    return floor(ticks) / (10**ndigits)
                    Severity: Major
                    Found in freqtrade/exchange/exchange_utils.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return val
                      Severity: Major
                      Found in freqtrade/configuration/environment_vars.py - About 30 mins to fix

                        Function load_params_from_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def load_params_from_file(self) -> Dict:
                                filename_str = getattr(self, "__file__", "")
                                if not filename_str:
                                    return {}
                                filename = Path(filename_str).with_suffix(".json")
                        Severity: Minor
                        Found in freqtrade/strategy/hyper.py - About 25 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Function _force_entry_validations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def _force_entry_validations(self, pair: str, order_side: SignalDirection):
                                if not self._freqtrade.config.get("force_entry_enable", False):
                                    raise RPCException("Force_entry not enabled.")
                        
                                if self._freqtrade.state != State.RUNNING:
                        Severity: Minor
                        Found in freqtrade/rpc/rpc.py - About 25 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Function __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def __init__(
                                self,
                                exchange,
                                pairlistmanager,
                                config: Config,
                        Severity: Minor
                        Found in freqtrade/plugins/pairlist/RemotePairList.py - About 25 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Function confirm_trade_entry has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def confirm_trade_entry(
                                self,
                                pair: str,
                                order_type: str,
                                amount: float,
                        Severity: Minor
                        Found in freqtrade/templates/FreqaiExampleStrategy.py - About 25 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Function deep_merge_dicts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def deep_merge_dicts(source, destination, allow_null_overrides: bool = True):
                            """
                            Values from Source override destination, destination is returned (and modified!!)
                            Sample:
                            >>> a = { 'first' : { 'rows' : { 'pass' : 'dog', 'number' : '1' } } }
                        Severity: Minor
                        Found in freqtrade/misc.py - About 25 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Function fetch_pairlist has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def fetch_pairlist(self) -> Tuple[List[str], float]:
                                headers = {"User-Agent": "Freqtrade/" + __version__ + " Remotepairlist"}
                        
                                if self._bearer_token:
                                    headers["Authorization"] = f"Bearer {self._bearer_token}"
                        Severity: Minor
                        Found in freqtrade/plugins/pairlist/RemotePairList.py - About 25 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Function _rpc_force_exit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def _rpc_force_exit(
                                self, trade_id: str, ordertype: Optional[str] = None, *, amount: Optional[float] = None
                            ) -> Dict[str, str]:
                                """
                                Handler for forceexit <id>.
                        Severity: Minor
                        Found in freqtrade/rpc/rpc.py - About 25 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Function validate_stake_amount has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def validate_stake_amount(
                                self,
                                pair: str,
                                stake_amount: Optional[float],
                                min_stake_amount: Optional[float],
                        Severity: Minor
                        Found in freqtrade/wallets.py - About 25 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Function __informative_pairs_freqai has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def __informative_pairs_freqai(self) -> ListPairsWithTimeframes:
                                """
                                Create informative-pairs needed for FreqAI
                                """
                                if self.config.get("freqai", {}).get("enabled", False):
                        Severity: Minor
                        Found in freqtrade/strategy/interface.py - About 25 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Severity
                        Category
                        Status
                        Source
                        Language