freqtrade/freqtrade

View on GitHub

Showing 515 of 517 total issues

File dataprovider.py has 439 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
Dataprovider
Responsible to provide data to the bot
including ticker and orderbook data, live and historical candle (OHLCV) data
Common Interface for bot and strategy to access data.
Severity: Minor
Found in freqtrade/data/dataprovider.py - About 6 hrs to fix

    FtRestClient has 47 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class FtRestClient:
    
        def __init__(self, serverurl, username=None, password=None, *,
                     pool_connections=10, pool_maxsize=10):
    
    
    Severity: Minor
    Found in ft_client/freqtrade_client/ft_rest_client.py - About 6 hrs to fix

      File idatahandler.py has 426 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """
      Abstract datahandler interface.
      It's subclasses handle and storing data from disk.
      
      """
      Severity: Minor
      Found in freqtrade/data/history/datahandlers/idatahandler.py - About 6 hrs to fix

        Function _rpc_trade_statistics has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
        Open

            def _rpc_trade_statistics(
                    self, stake_currency: str, fiat_display_currency: str,
                    start_date: Optional[datetime] = None) -> Dict[str, Any]:
                """ Returns cumulative profit statistics """
        
        
        Severity: Minor
        Found in freqtrade/rpc/rpc.py - About 6 hrs 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 get_result_table has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_result_table(config: Config, results: list, total_epochs: int, highlight_best: bool,
                                 print_colorized: bool, remove_header: int) -> str:
                """
                Log result table
                """
        Severity: Minor
        Found in freqtrade/optimize/hyperopt_tools.py - About 5 hrs 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

        File BaseReinforcementLearningModel.py has 384 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import copy
        import importlib
        import logging
        from abc import abstractmethod
        from datetime import datetime, timezone
        Severity: Minor
        Found in freqtrade/freqai/RL/BaseReinforcementLearningModel.py - About 5 hrs to fix

          File btanalysis.py has 383 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          """
          Helpers when analyzing backtest data
          """
          import logging
          from copy import copy
          Severity: Minor
          Found in freqtrade/data/btanalysis.py - About 5 hrs to fix

            File arguments.py has 382 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            """
            This module contains the argument manager class
            """
            import argparse
            from functools import partial
            Severity: Minor
            Found in freqtrade/commands/arguments.py - About 5 hrs to fix

              Function _rpc_trade_status has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _rpc_trade_status(self, trade_ids: Optional[List[int]] = None) -> List[Dict[str, Any]]:
                      """
                      Below follows the RPC backend it is prefixed with rpc_ to raise awareness that it is
                      a remotely exposed function
                      """
              Severity: Minor
              Found in freqtrade/rpc/rpc.py - About 4 hrs 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

              File configuration.py has 360 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              """
              This module contains the configuration class
              """
              import logging
              import warnings
              Severity: Minor
              Found in freqtrade/configuration/configuration.py - About 4 hrs to fix

                File edge_positioning.py has 353 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # pragma pylint: disable=W0603
                """ Edge positioning package """
                import logging
                from collections import defaultdict
                from copy import deepcopy
                Severity: Minor
                Found in freqtrade/edge/edge_positioning.py - About 4 hrs to fix

                  Function _build_subcommands has 111 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def _build_subcommands(self) -> None:
                          """
                          Builds and attaches all subcommands.
                          :return: None
                          """
                  Severity: Major
                  Found in freqtrade/commands/arguments.py - About 4 hrs to fix

                    Exchange has 34 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class Exchange:
                    
                        # Parameters to add directly to buy/sell calls (like agreeing to trading agreement)
                        _params: Dict = {}
                    
                    
                    Severity: Minor
                    Found in freqtrade/exchange/exchange.py - About 4 hrs to fix

                      Function start_backtesting has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def start_backtesting(
                              self, dataframe: DataFrame, metadata: dict, dk: FreqaiDataKitchen, strategy: IStrategy
                          ) -> FreqaiDataKitchen:
                              """
                              The main broad execution for backtesting. For backtesting, each pair enters and then gets
                      Severity: Minor
                      Found in freqtrade/freqai/freqai_interface.py - About 4 hrs 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

                      File ft_rest_client.py has 338 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      """
                      A Rest Client for Freqtrade bot
                      
                      Should not import anything from freqtrade,
                      so it can be used as a standalone script, and can be installed independently.
                      Severity: Minor
                      Found in ft_client/freqtrade_client/ft_rest_client.py - About 4 hrs to fix

                        File config_validation.py has 323 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import logging
                        from collections import Counter
                        from copy import deepcopy
                        from typing import Any, Dict
                        
                        
                        Severity: Minor
                        Found in freqtrade/configuration/config_validation.py - About 3 hrs to fix

                          Function _get_exit_for_signal has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def _get_exit_for_signal(
                                      self, trade: LocalTrade, row: Tuple, exit_: ExitCheckTuple,
                                      current_time: datetime,
                                      amount: Optional[float] = None) -> Optional[LocalTrade]:
                          
                          
                          Severity: Minor
                          Found in freqtrade/optimize/backtesting.py - About 3 hrs 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 setup_logging has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def setup_logging(config: Config) -> None:
                              """
                              Process -v/--verbose, --logfile options
                              """
                              # Log level
                          Severity: Minor
                          Found in freqtrade/loggers/__init__.py - About 3 hrs 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 parse_timerange has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def parse_timerange(cls, text: Optional[str]) -> Self:
                                  """
                                  Parse the value of the argument --timerange to determine what is the range desired
                                  :param text: value from --timerange
                                  :return: Start and End range period
                          Severity: Minor
                          Found in freqtrade/configuration/timerange.py - About 3 hrs 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

                          File bt_output.py has 315 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import logging
                          from typing import Any, Dict, List
                          
                          from tabulate import tabulate
                          
                          
                          Severity: Minor
                          Found in freqtrade/optimize/optimize_reports/bt_output.py - About 3 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language