freqtrade/freqtrade

View on GitHub

Showing 505 of 505 total issues

Function get_valid_price_and_stake has 11 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def get_valid_price_and_stake(
Severity: Major
Found in freqtrade/optimize/backtesting.py - About 1 hr to fix

    Function load_pair_history has 11 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def load_pair_history(
    Severity: Major
    Found in freqtrade/data/history/history_utils.py - About 1 hr to fix

      Function load_data has 11 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def load_data(
      Severity: Major
      Found in freqtrade/data/history/history_utils.py - About 1 hr to fix

        Function should_exit has 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def should_exit(
        Severity: Major
        Found in freqtrade/strategy/interface.py - About 1 hr to fix

          Function stop_per_pair has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def stop_per_pair(
                  self, pair, now: Optional[datetime] = None, side: LongShort = "long"
              ) -> Optional[PairLock]:
                  if not now:
                      now = datetime.now(timezone.utc)
          Severity: Minor
          Found in freqtrade/plugins/protectionmanager.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 confirm_trade_entry has 10 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def confirm_trade_entry(
          Severity: Major
          Found in freqtrade/strategy/interface.py - About 1 hr to fix

            Function adjust_entry_price has 10 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def adjust_entry_price(
            Severity: Major
            Found in freqtrade/strategy/interface.py - About 1 hr to fix

              Function confirm_trade_exit has 10 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def confirm_trade_exit(
              Severity: Major
              Found in freqtrade/strategy/interface.py - About 1 hr to fix

                Function __run_backtest_bg has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                def __run_backtest_bg(btconfig: Config):
                    from freqtrade.data.metrics import combined_dataframes_with_rel_mean
                    from freqtrade.optimize.optimize_reports import generate_backtest_stats, store_backtest_stats
                    from freqtrade.resolvers import StrategyResolver
                
                
                Severity: Minor
                Found in freqtrade/rpc/api_server/api_backtest.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 load_bt_data_detail has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    def load_bt_data_detail(self) -> None:
                        """
                        Loads backtest detail data (smaller timeframe) if necessary.
                        """
                        if self.timeframe_detail:
                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 _check_trade_exit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _check_trade_exit(
                        self, trade: LocalTrade, row: Tuple, current_time: datetime
                    ) -> Optional[LocalTrade]:
                        self._run_funding_fees(trade, current_time)
                
                
                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 export_csv_file has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    def export_csv_file(config: Config, results: list, csv_file: str) -> None:
                        """
                        Log result to csv-file
                        """
                        if not results:
                Severity: Minor
                Found in freqtrade/optimize/hyperopt_tools.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 generate_strategy_stats has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                def generate_strategy_stats(
                    pairlist: List[str],
                    strategy: str,
                    content: Dict[str, Any],
                    min_date: datetime,
                Severity: Minor
                Found in freqtrade/optimize/optimize_reports/optimize_reports.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 to_json has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    def to_json(self, entry_side: str, minified: bool = False) -> Dict[str, Any]:
                        """
                        :param minified: If True, only return a subset of the data is returned.
                                         Only used for backtesting.
                        """
                Severity: Minor
                Found in freqtrade/persistence/trade_model.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 create_order has 10 arguments (exceeds 4 allowed). Consider refactoring.
                Open

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

                  Function load_data has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def load_data(
                      datadir: Path,
                      timeframe: str,
                      pairs: List[str],
                      *,
                  Severity: Minor
                  Found in freqtrade/data/history/history_utils.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 refresh_backtest_ohlcv_data has 10 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def refresh_backtest_ohlcv_data(
                  Severity: Major
                  Found in freqtrade/data/history/history_utils.py - About 1 hr to fix

                    Function additional_exchange_init has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def additional_exchange_init(self) -> None:
                            """
                            Additional exchange initialization logic.
                            .api will be available at this point.
                            Must be overridden in child methods if required.
                    Severity: Minor
                    Found in freqtrade/exchange/binance.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 _flat_vars_to_nested_dict has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def _flat_vars_to_nested_dict(env_dict: Dict[str, Any], prefix: str) -> Dict[str, Any]:
                        """
                        Environment variables must be prefixed with FREQTRADE.
                        FREQTRADE__{section}__{key}
                        :param env_dict: Dictionary to validate - usually os.environ
                    Severity: Minor
                    Found in freqtrade/configuration/environment_vars.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 export_csv_file has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def export_csv_file(config: Config, results: list, csv_file: str) -> None:
                            """
                            Log result to csv-file
                            """
                            if not results:
                    Severity: Minor
                    Found in freqtrade/optimize/hyperopt_tools.py - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language