freqtrade/freqtrade

View on GitHub

Showing 514 of 516 total issues

Function get_liquidation_price has 15 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def get_liquidation_price(
Severity: Major
Found in freqtrade/exchange/exchange.py - About 1 hr to fix

    Function __init__ has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def __init__(self, config: Config) -> None:
            self.config = config
            self.assert_config(self.config)
            self.freqai_info: Dict[str, Any] = config["freqai"]
            self.data_split_parameters: Dict[str, Any] = config.get("freqai", {}).get(
    Severity: Minor
    Found in freqtrade/freqai/freqai_interface.py - About 1 hr to fix

      Function migrate_trades_and_orders_table has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def migrate_trades_and_orders_table(
          decl_base,
          inspector,
          engine,
          trade_back_name: str,
      Severity: Minor
      Found in freqtrade/persistence/migrations.py - About 1 hr to fix

        Function __init__ has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def __init__(self, config: Config, exchange: Optional[Exchange] = None) -> None:
                LoggingMixin.show_output = False
                self.config = config
                self.results: BacktestResultType = get_BacktestResultType_default()
                self.trade_id_counter: int = 0
        Severity: Minor
        Found in freqtrade/optimize/backtesting.py - About 1 hr to fix

          Function _send_msg has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              def _send_msg(self, payload: dict) -> None:
                  """do the actual call to the webhook"""
          
                  success = False
                  attempts = 0
          Severity: Minor
          Found in freqtrade/rpc/webhook.py - About 1 hr 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 check_order_replace has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              def check_order_replace(
                  self, trade: LocalTrade, order: Order, current_time, row: Tuple
              ) -> bool:
                  """
                  Check if current analyzed entry order has to be replaced and do so.
          Severity: Minor
          Found in freqtrade/optimize/backtesting.py - About 1 hr 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 14 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(self, config: Config, exchange: Optional[Exchange] = None) -> None:
                  LoggingMixin.show_output = False
                  self.config = config
                  self.results: BacktestResultType = get_BacktestResultType_default()
                  self.trade_id_counter: int = 0
          Severity: Minor
          Found in freqtrade/optimize/backtesting.py - About 1 hr 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 dry_run_liquidation_price has 14 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def dry_run_liquidation_price(
          Severity: Major
          Found in freqtrade/exchange/exchange.py - About 1 hr to fix

            Function dry_run_liquidation_price has 14 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def dry_run_liquidation_price(
            Severity: Major
            Found in freqtrade/exchange/binance.py - About 1 hr to fix

              Function __init__ has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def __init__(self, config: Config) -> None:
                      self.buy_space: List[Dimension] = []
                      self.sell_space: List[Dimension] = []
                      self.protection_space: List[Dimension] = []
                      self.roi_space: List[Dimension] = []
              Severity: Minor
              Found in freqtrade/optimize/hyperopt.py - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                            if trade_dur == 0 and (
                                (
                                    is_short
                                    # Red candle (for longs)
                                    and row[OPEN_IDX] < row[CLOSE_IDX]  # Red candle
                Severity: Critical
                Found in freqtrade/optimize/backtesting.py - About 1 hr to fix

                  Function _rpc_trade_statistics has 41 lines of code (exceeds 25 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 1 hr to fix

                    Function __init__ has 13 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def __init__(
                    Severity: Major
                    Found in freqtrade/freqai/RL/BaseEnvironment.py - About 1 hr to fix

                      Function dry_run_liquidation_price has 13 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def dry_run_liquidation_price(
                      Severity: Major
                      Found in freqtrade/exchange/bybit.py - About 1 hr to fix

                        Function expand_pairlist has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def expand_pairlist(
                            wildcardpl: List[str], available_pairs: List[str], keep_invalid: bool = False
                        ) -> List[str]:
                            """
                            Expand pairlist potentially containing wildcards based on available markets.
                        Severity: Minor
                        Found in freqtrade/plugins/pairlist/pairlist_helpers.py - About 1 hr 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 filter_pairlist has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def filter_pairlist(self, pairlist: List[str], tickers: Dict) -> List[str]:
                                """
                                Filters and sorts pairlist and returns the whitelist again.
                                Called on each bot iteration - please use internal caching if necessary
                                :param pairlist: pairlist to filter or sort
                        Severity: Minor
                        Found in freqtrade/plugins/pairlist/RemotePairList.py - About 1 hr 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 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def __init__(self, config: Config) -> None:
                                self.config = config
                                # Dict to determine if analysis is necessary
                                self._last_candle_seen_per_pair: Dict[str, datetime] = {}
                                super().__init__(config)
                        Severity: Minor
                        Found in freqtrade/strategy/interface.py - About 1 hr 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 strategy_safe_wrapper has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def strategy_safe_wrapper(f: F, message: str = "", default_retval=None, supress_error=False) -> F:
                            """
                            Wrapper around user-provided methods and functions.
                            Caches all exceptions and returns either the default_retval (if it's not None) or raises
                            a StrategyError exception, which then needs to be handled by the calling method.
                        Severity: Minor
                        Found in freqtrade/strategy/strategy_wrapper.py - About 1 hr 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_stats has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def _rpc_stats(self) -> Dict[str, Any]:
                                """
                                Generate generic stats for trades in database
                                """
                        
                        
                        Severity: Minor
                        Found in freqtrade/rpc/rpc.py - About 1 hr 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 send_msg has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def send_msg(self, msg) -> None:
                                if fields := self._config["discord"].get(msg["type"].value):
                                    logger.info(f"Sending discord message: {msg}")
                        
                                    msg["strategy"] = self.strategy
                        Severity: Minor
                        Found in freqtrade/rpc/discord.py - About 1 hr 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