freqtrade/freqtrade

View on GitHub

Showing 504 of 504 total issues

Function dry_run_liquidation_price has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def dry_run_liquidation_price(
        self,
        pair: str,
        open_rate: float,   # Entry price of position
        is_short: bool,
Severity: Minor
Found in freqtrade/exchange/bybit.py - About 35 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 log_config_error_range has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def log_config_error_range(path: str, errmsg: str) -> str:
    """
    Parses configuration file and prints range around error
    """
    if path != '-':
Severity: Minor
Found in freqtrade/configuration/load_config.py - About 35 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 _get_posSide has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_posSide(self, side: BuySell, reduceOnly: bool):
        if self.net_only:
            return 'net'
        if not reduceOnly:
            # Enter
Severity: Minor
Found in freqtrade/exchange/okx.py - About 35 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 create_userdata_dir has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def create_userdata_dir(directory: str, create_dir: bool = False) -> Path:
    """
    Create userdata directory structure.
    if create_dir is True, then the parent-directory will be created if it does not exist.
    Sub-directories will always be created if the parent directory exists.
Severity: Minor
Found in freqtrade/configuration/directory_operations.py - About 35 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 _get_var_typed has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _get_var_typed(val):
    try:
        return int(val)
    except ValueError:
        try:
Severity: Minor
Found in freqtrade/configuration/environment_vars.py - About 35 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 too many return statements within this function.
Open

                return float(pnl * factor)
Severity: Major
Found in freqtrade/freqai/prediction_models/ReinforcementLearner.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return 0.
    Severity: Major
    Found in freqtrade/freqai/RL/BaseEnvironment.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                      return float(pnl * factor)
      Severity: Major
      Found in freqtrade/freqai/prediction_models/ReinforcementLearner.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return 0.
        Severity: Major
        Found in freqtrade/freqai/prediction_models/ReinforcementLearner.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          return -1 * trade_duration / max_trade_duration
          Severity: Major
          Found in freqtrade/freqai/prediction_models/ReinforcementLearner.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return trade
            Severity: Major
            Found in freqtrade/optimize/backtesting.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return stoploss_value
              Severity: Major
              Found in freqtrade/optimize/backtesting.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return kv.int_value
                Severity: Major
                Found in freqtrade/persistence/key_value_store.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return (True, 0)
                  Severity: Major
                  Found in freqtrade/data/dataprovider.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                    return floor(ticks) / (10**ndigits)
                    Severity: Major
                    Found in freqtrade/exchange/exchange_utils.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return price
                      Severity: Major
                      Found in freqtrade/exchange/exchange_utils.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                        return __price_to_precision_significant_digits(
                        Severity: Major
                        Found in freqtrade/exchange/exchange_utils.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return val
                          Severity: Major
                          Found in freqtrade/configuration/environment_vars.py - About 30 mins to fix

                            Function _whitelist_for_active_markets has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def _whitelist_for_active_markets(self, pairlist: List[str]) -> List[str]:
                                    """
                                    Check available markets and remove pair from whitelist if necessary
                                    :param pairlist: the sorted list of pairs the user might want to trade
                                    :return: the list of pairs the user wants to trade without those unavailable or
                            Severity: Minor
                            Found in freqtrade/plugins/pairlist/IPairList.py - About 25 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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def __init__(self, exchange, pairlistmanager,
                                             config: Config, pairlistconfig: Dict[str, Any],
                                             pairlist_pos: int) -> None:
                                    super().__init__(exchange, pairlistmanager, config, pairlistconfig, pairlist_pos)
                            
                            
                            Severity: Minor
                            Found in freqtrade/plugins/pairlist/RemotePairList.py - About 25 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

                            Severity
                            Category
                            Status
                            Source
                            Language