freqtrade/freqtrade

View on GitHub

Showing 515 of 517 total issues

Function add_indicators has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def add_indicators(fig, row, indicators: Dict[str, Dict], data: pd.DataFrame) -> make_subplots:
    """
    Generate all the indicators selected by the user for a specific row, based on the configuration
    :param fig: Plot figure to append to
    :param row: row number for this plot
Severity: Minor
Found in freqtrade/plot/plotting.py - About 2 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 update_historic_data has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def update_historic_data(self, strategy: IStrategy, dk: FreqaiDataKitchen) -> None:
        """
        Append new candles to our stores historic data (in memory) so that
        we do not need to load candle history from disk and we dont need to
        pinging exchange multiple times for the same candle.
Severity: Minor
Found in freqtrade/freqai/data_drawer.py - About 2 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 get_valid_price_and_stake has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def get_valid_price_and_stake(
        self,
        pair: str,
        row: Tuple,
        propose_rate: float,
Severity: Minor
Found in freqtrade/optimize/backtesting.py - About 2 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 _detect_next_stop_or_sell_point has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def _detect_next_stop_or_sell_point(
        self, buy_column, sell_column, date_column, ohlc_columns, stoploss, pair: str
    ):
        """
        Iterate through ohlc_columns in order to find the next trade
Severity: Minor
Found in freqtrade/edge/edge_positioning.py - About 2 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 import_kraken_trades_from_csv has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def import_kraken_trades_from_csv(config: Config, convert_to: str):
    """
    Import kraken trades from csv
    """
    if config["exchange"]["name"] != "kraken":
Severity: Minor
Found in freqtrade/data/converter/trade_converter_kraken.py - About 2 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 _worker has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def _worker(self, old_state: Optional[State]) -> State:
        """
        The main routine that runs each throttling iteration and handles the states.
        :param old_state: the previous service state from the previous call
        :return: current service state
Severity: Minor
Found in freqtrade/worker.py - About 2 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 merge_informative_pair has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def merge_informative_pair(
    dataframe: pd.DataFrame,
    informative: pd.DataFrame,
    timeframe: str,
    timeframe_inf: str,
Severity: Minor
Found in freqtrade/strategy/strategy_helper.py - About 2 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 _validate_pair has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def _validate_pair(self, pair: str, ticker: Optional[Ticker]) -> bool:
        """
        Check if one price-step (pip) is > than a certain barrier.
        :param pair: Pair that's currently validated
        :param ticker: ticker dict as returned from ccxt.fetch_ticker
Severity: Minor
Found in freqtrade/plugins/pairlist/PriceFilter.py - About 2 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 start_list_exchanges has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def start_list_exchanges(args: Dict[str, Any]) -> None:
    """
    Print available exchanges
    :param args: Cli args from Arguments()
    :return: None
Severity: Minor
Found in freqtrade/commands/list_commands.py - About 2 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 _search_all_objects has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def _search_all_objects(
        cls,
        directory: Path,
        enum_failed: bool,
        recursive: bool = False,
Severity: Minor
Found in freqtrade/resolvers/iresolver.py - About 2 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 list_commands.py has 252 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import csv
import logging
import sys
from typing import Any, Dict, List, Union

Severity: Minor
Found in freqtrade/commands/list_commands.py - About 2 hrs to fix

    File build_config_commands.py has 252 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import logging
    import secrets
    from pathlib import Path
    from typing import Any, Dict, List
    
    
    Severity: Minor
    Found in freqtrade/commands/build_config_commands.py - About 2 hrs to fix

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

          def __init__(
              self,
              config: Config,
              *,
              exchange_config: Optional[ExchangeConfig] = None,
      Severity: Minor
      Found in freqtrade/exchange/exchange.py - About 1 hr to fix

        Function __exec_force_exit has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def __exec_force_exit(
                self, trade: Trade, ordertype: Optional[str], amount: Optional[float] = None
            ) -> bool:
                # Check if there is there are open orders
                trade_entry_cancelation_registry = []
        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 generate_optimizer has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def generate_optimizer(self, raw_params: List[Any]) -> Dict[str, Any]:
                """
                Used Optimize function.
                Called once per epoch to optimize whatever is configured.
                Keep this function as optimized as possible!
        Severity: Minor
        Found in freqtrade/optimize/hyperopt.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 is_tradesignal has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def is_tradesignal(self, action: int) -> bool:
                """
                Determine if the signal is a trade signal
                e.g.: agent wants a Actions.Long_exit while it is in a Positions.short
                """
        Severity: Minor
        Found in freqtrade/freqai/RL/Base4ActionRLEnv.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 calculate_reward has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

                def calculate_reward(self, action: int) -> float:
                    """
                    An example reward function. This is the one function that users will likely
                    wish to inject their own creativity into.
        
        
        Severity: Minor
        Found in freqtrade/freqai/prediction_models/ReinforcementLearner.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_cached_data_for_updating has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

        def _load_cached_data_for_updating(
            pair: str,
            timeframe: str,
            timerange: Optional[TimeRange],
            data_handler: IDataHandler,
        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 setup_analyze_configuration has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

        def setup_analyze_configuration(args: Dict[str, Any], method: RunMode) -> Dict[str, Any]:
            """
            Prepare the configuration for the entry/exit reason analysis module
            :param args: Cli args from Arguments()
            :param method: Bot running mode
        Severity: Minor
        Found in freqtrade/commands/analyze_commands.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 get_trades_for_order has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_trades_for_order(
                self, order_id: str, pair: str, since: datetime, params: Optional[Dict] = None
            ) -> List:
                trades = super().get_trades_for_order(order_id, pair, since, params)
        
        
        Severity: Minor
        Found in freqtrade/exchange/gate.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