freqtrade/freqtrade

View on GitHub
freqtrade/data/entryexitanalysis.py

Summary

Maintainability
D
1 day
Test Coverage

Function _do_group_table_output has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

def _do_group_table_output(bigdf, glist, csv_path: Path, to_csv=False, ):
    for g in glist:
        # 0: summary wins/losses grouped by enter tag
        if g == "0":
            group_mask = ['enter_reason']
Severity: Minor
Found in freqtrade/data/entryexitanalysis.py - About 3 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 print_results has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def print_results(res_df: pd.DataFrame, analysis_groups: List[str], indicator_list: List[str],
                  csv_path: Path, rejected_signals=None, to_csv=False):
    if res_df.shape[0] > 0:
        if analysis_groups:
            _do_group_table_output(res_df, analysis_groups, to_csv=to_csv, csv_path=csv_path)
Severity: Minor
Found in freqtrade/data/entryexitanalysis.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 _analyze_candles_and_indicators has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def _analyze_candles_and_indicators(pair, trades: pd.DataFrame, signal_candles: pd.DataFrame):
    buyf = signal_candles

    if len(buyf) > 0:
        buyf = buyf.set_index('date', drop=False)
Severity: Minor
Found in freqtrade/data/entryexitanalysis.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 entryexitanalysis.py has 252 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import logging
from pathlib import Path
from typing import List

import joblib
Severity: Minor
Found in freqtrade/data/entryexitanalysis.py - About 2 hrs to fix

    Function process_entry_exit_reasons has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def process_entry_exit_reasons(config: Config):
        try:
            analysis_groups = config.get('analysis_groups', [])
            enter_reason_list = config.get('enter_reason_list', ["all"])
            exit_reason_list = config.get('exit_reason_list', ["all"])
    Severity: Minor
    Found in freqtrade/data/entryexitanalysis.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 _print_table has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def _print_table(df: pd.DataFrame, sortcols=None, *, show_index=False, name=None,
    Severity: Major
    Found in freqtrade/data/entryexitanalysis.py - About 50 mins to fix

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

      def print_results(res_df: pd.DataFrame, analysis_groups: List[str], indicator_list: List[str],
      Severity: Minor
      Found in freqtrade/data/entryexitanalysis.py - About 45 mins to fix

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

        def prepare_results(analysed_trades, stratname,
        Severity: Minor
        Found in freqtrade/data/entryexitanalysis.py - About 35 mins to fix

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

          def _print_table(df: pd.DataFrame, sortcols=None, *, show_index=False, name=None,
                           to_csv=False, csv_path: Path):
              if (sortcols is not None):
                  data = df.sort_values(sortcols)
              else:
          Severity: Minor
          Found in freqtrade/data/entryexitanalysis.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

          There are no issues that match your filters.

          Category
          Status