freqtrade/freqtrade

View on GitHub

Showing 505 of 505 total issues

Function _fetch_and_calculate_funding_fees has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def _fetch_and_calculate_funding_fees(
Severity: Minor
Found in freqtrade/exchange/exchange.py - About 45 mins to fix

    Function get_ui_download_url has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_ui_download_url(version: Optional[str] = None) -> Tuple[str, str]:
        base_url = 'https://api.github.com/repos/freqtrade/frequi/'
        # Get base UI Repo path
    
        resp = requests.get(f"{base_url}releases", timeout=req_timeout)
    Severity: Minor
    Found in freqtrade/commands/deploy_commands.py - About 45 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 _check_empty_df has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def _check_empty_df(
    Severity: Minor
    Found in freqtrade/data/history/datahandlers/idatahandler.py - About 45 mins to fix

      Function load_object has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def load_object(cls, object_name: str, config: Config, *, kwargs: dict,
      Severity: Minor
      Found in freqtrade/resolvers/iresolver.py - About 45 mins to fix

        Function get_dry_market_fill_price has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def get_dry_market_fill_price(self, pair: str, side: str, amount: float, rate: float,
        Severity: Minor
        Found in freqtrade/exchange/exchange.py - About 45 mins to fix

          Function validate_config_schema has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def validate_config_schema(conf: Dict[str, Any], preliminary: bool = False) -> Dict[str, Any]:
              """
              Validate the configuration follow the Config Schema
              :param conf: Config in JSON format
              :return: Returns the config if valid, otherwise throw an exception
          Severity: Minor
          Found in freqtrade/configuration/config_validation.py - About 45 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

          Avoid deeply nested control flow statements.
          Open

                                  if pair_fees.get(takerOrMaker) is not None:
                                      trades[idx]['fee'] = {
                                          'currency': self.get_pair_quote_currency(pair),
                                          'cost': trade['cost'] * pair_fees[takerOrMaker],
                                          'rate': pair_fees[takerOrMaker],
          Severity: Major
          Found in freqtrade/exchange/gate.py - About 45 mins to fix

            Function __price_to_precision_significant_digits has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def __price_to_precision_significant_digits(
                price: float,
                price_precision: float,
                *,
                rounding_mode: int = ROUND,
            Severity: Minor
            Found in freqtrade/exchange/exchange_utils.py - About 45 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 sanitize_config has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def sanitize_config(config: Config, *, show_sensitive: bool = False) -> Config:
                """
                Remove sensitive information from the config.
                :param config: Configuration
                :param show_sensitive: Show sensitive information
            Severity: Minor
            Found in freqtrade/configuration/config_secrets.py - About 45 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 check_conflicting_settings has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def check_conflicting_settings(config: Config,
                                           section_old: Optional[str], name_old: str,
                                           section_new: Optional[str], name_new: str) -> None:
                section_new_config = config.get(section_new, {}) if section_new else config
                section_old_config = config.get(section_old, {}) if section_old else config
            Severity: Minor
            Found in freqtrade/configuration/deprecated_settings.py - About 45 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 calculate_funding_fees has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def calculate_funding_fees(
            Severity: Minor
            Found in freqtrade/exchange/kraken.py - About 45 mins to fix

              Consider simplifying this complex logical expression.
              Open

                      if (
                          (self._position_stacking or len(LocalTrade.bt_trades_open_pp[pair]) == 0)
                          and is_first
                          and current_time != end_date
                          and trade_dir is not None
              Severity: Major
              Found in freqtrade/optimize/backtesting.py - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                            if (
                                not self.strategy.use_custom_stoploss and self.strategy.trailing_stop
                                and self.strategy.trailing_only_offset_is_reached
                                and self.strategy.trailing_stop_positive_offset is not None
                                and self.strategy.trailing_stop_positive
                Severity: Major
                Found in freqtrade/optimize/backtesting.py - About 40 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                          if PairLocks.use_db:
                              return PairLock.query_pair_locks(pair, now, side).all()
                          else:
                              locks = [lock for lock in PairLocks.locks if (
                                  lock.lock_end_time >= now
                  Severity: Major
                  Found in freqtrade/persistence/pairlock_middleware.py - About 40 mins to fix

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                            if hasattr(self.estimators_[0], "n_features_in_"):
                                self.n_features_in_ = self.estimators_[0].n_features_in_
                    Severity: Minor
                    Found in freqtrade/freqai/base_models/FreqaiMultiOutputRegressor.py and 1 other location - About 40 mins to fix
                    freqtrade/freqai/base_models/FreqaiMultiOutputRegressor.py on lines 60..61

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 34.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                            if hasattr(self.estimators_[0], "feature_names_in_"):
                                self.feature_names_in_ = self.estimators_[0].feature_names_in_
                    Severity: Minor
                    Found in freqtrade/freqai/base_models/FreqaiMultiOutputRegressor.py and 1 other location - About 40 mins to fix
                    freqtrade/freqai/base_models/FreqaiMultiOutputRegressor.py on lines 58..59

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 34.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                        def __init__(self, exchange, pairlistmanager,
                    Severity: Minor
                    Found in freqtrade/plugins/pairlist/PerformanceFilter.py - About 35 mins to fix

                      Function get_trade_stake_amount has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def get_trade_stake_amount(
                      Severity: Minor
                      Found in freqtrade/wallets.py - About 35 mins to fix

                        Function _call has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def _call(self, method, apipath, params: Optional[dict] = None, data=None, files=None):
                        Severity: Minor
                        Found in ft_client/freqtrade_client/ft_rest_client.py - About 35 mins to fix

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

                              def __init__(self, exchange, pairlistmanager,
                          Severity: Minor
                          Found in freqtrade/plugins/pairlist/SpreadFilter.py - About 35 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language