freqtrade/freqtrade

View on GitHub

Showing 341 of 341 total issues

File exchange.py has 2286 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# pragma pylint: disable=W0603
"""
Cryptocurrency Exchanges support
"""
import asyncio
Severity: Major
Found in freqtrade/exchange/exchange.py - About 6 days to fix

    File freqtradebot.py has 1428 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """
    Freqtrade is the main module of this bot. It contains the class Freqtrade()
    """
    import copy
    import logging
    Severity: Major
    Found in freqtrade/freqtradebot.py - About 3 days to fix

      File telegram.py has 1424 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # pragma pylint: disable=unused-argument, unused-variable, protected-access, invalid-name
      
      """
      This module manage Telegram communication
      """
      Severity: Major
      Found in freqtrade/rpc/telegram.py - About 3 days to fix

        File trade_model.py has 1146 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        """
        This module contains the class to persist trades into SQLite
        """
        import logging
        from datetime import datetime, timedelta, timezone
        Severity: Major
        Found in freqtrade/persistence/trade_model.py - About 2 days to fix

          File backtesting.py has 991 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # pragma pylint: disable=missing-docstring, W0212, too-many-arguments
          
          """
          This module contains the backtesting logic
          """
          Severity: Major
          Found in freqtrade/optimize/backtesting.py - About 2 days to fix

            File interface.py has 955 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            """
            IStrategy interface
            This module defines the interface to apply for strategies
            """
            import logging
            Severity: Major
            Found in freqtrade/strategy/interface.py - About 2 days to fix

              File rpc.py has 902 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              """
              This module contains class to define a RPC communications
              """
              import logging
              from abc import abstractmethod
              Severity: Major
              Found in freqtrade/rpc/rpc.py - About 2 days to fix

                File optimize_reports.py has 768 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import logging
                from copy import deepcopy
                from datetime import datetime, timedelta, timezone
                from pathlib import Path
                from typing import Any, Dict, List, Union
                Severity: Major
                Found in freqtrade/optimize/optimize_reports.py - About 1 day to fix

                  File cli_options.py has 626 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  """
                  Definition of cli arguments used in arguments.py
                  """
                  from argparse import SUPPRESS, ArgumentTypeError
                  
                  
                  Severity: Major
                  Found in freqtrade/commands/cli_options.py - About 1 day to fix

                    File plotting.py has 590 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import logging
                    from pathlib import Path
                    from typing import Any, Dict, List, Optional
                    
                    import pandas as pd
                    Severity: Major
                    Found in freqtrade/plot/plotting.py - About 1 day to fix

                      File constants.py has 509 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      # pragma pylint: disable=too-few-public-methods
                      
                      """
                      bot constants
                      """
                      Severity: Major
                      Found in freqtrade/constants.py - About 1 day to fix

                        Function _rpc_status_table has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def _rpc_status_table(self, stake_currency: str,
                                                  fiat_display_currency: str) -> Tuple[List, List, float]:
                                trades: List[Trade] = Trade.get_open_trades()
                                nonspot = self._config.get('trading_mode', TradingMode.SPOT) != TradingMode.SPOT
                                if not trades:
                        Severity: Minor
                        Found in freqtrade/rpc/rpc.py - About 7 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 hyperopt.py has 440 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        # pragma pylint: disable=too-many-instance-attributes, pointless-string-statement
                        
                        """
                        This module contains the hyperopt logic
                        """
                        Severity: Minor
                        Found in freqtrade/optimize/hyperopt.py - About 6 hrs to fix

                          File hyperopt_tools.py has 411 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import io
                          import logging
                          from copy import deepcopy
                          from datetime import datetime, timezone
                          from pathlib import Path
                          Severity: Minor
                          Found in freqtrade/optimize/hyperopt_tools.py - About 5 hrs to fix

                            File history_utils.py has 400 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import logging
                            import operator
                            from datetime import datetime, timezone
                            from pathlib import Path
                            from typing import Dict, List, Optional, Tuple
                            Severity: Minor
                            Found in freqtrade/data/history/history_utils.py - About 5 hrs to fix

                              Function backtest has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def backtest(self, processed: Dict,
                                               start_date: datetime, end_date: datetime,
                                               max_open_trades: int = 0, position_stacking: bool = False,
                                               enable_protections: bool = False) -> Dict[str, Any]:
                                      """
                              Severity: Minor
                              Found in freqtrade/optimize/backtesting.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

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

                                  def _rpc_trade_statistics(
                                          self, stake_currency: str, fiat_display_currency: str,
                                          start_date: datetime = datetime.fromtimestamp(0)) -> Dict[str, Any]:
                                      """ Returns cumulative profit statistics """
                                      trade_filter = ((Trade.is_open.is_(False) & (Trade.close_date >= start_date)) |
                              Severity: Minor
                              Found in freqtrade/rpc/rpc.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

                              IStrategy has 40 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              class IStrategy(ABC, HyperStrategyMixin):
                                  """
                                  Interface for freqtrade strategies
                                  Defines the mandatory structure must follow any custom strategies
                              
                              
                              Severity: Minor
                              Found in freqtrade/strategy/interface.py - About 5 hrs to fix

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

                                class FtRestClient():
                                
                                    def __init__(self, serverurl, username=None, password=None):
                                
                                        self._serverurl = serverurl
                                Severity: Minor
                                Found in scripts/rest_client.py - About 5 hrs to fix

                                  File configuration.py has 375 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 5 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language