freqtrade/freqtrade

View on GitHub
freqtrade/freqai/data_drawer.py

Summary

Maintainability
D
2 days
Test Coverage

File data_drawer.py has 625 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import collections
import importlib
import logging
import re
import shutil
Severity: Major
Found in freqtrade/freqai/data_drawer.py - About 1 day to fix

    Function purge_old_models has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def purge_old_models(self) -> None:
    
            num_keep = self.freqai_info["purge_old_models"]
            if not num_keep:
                return
    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 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 load_data has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def load_data(self, coin: str, dk: FreqaiDataKitchen) -> Any:  # noqa: C901
            """
            loads all data required to make a prediction on a sub-train time range
            :returns:
            :model: User trained model which can be inferenced for new predictions
    Severity: Minor
    Found in freqtrade/freqai/data_drawer.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 __init__ has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def __init__(self, full_path: Path, config: Config):
    
            self.config = config
            self.freqai_info = config.get("freqai", {})
            # dictionary holding all pair metadata necessary to load in from disk
    Severity: Minor
    Found in freqtrade/freqai/data_drawer.py - About 1 hr to fix

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

          def append_model_predictions(self, pair: str, predictions: DataFrame,
      Severity: Minor
      Found in freqtrade/freqai/data_drawer.py - About 45 mins to fix

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

            def append_model_predictions(self, pair: str, predictions: DataFrame,
                                         do_preds: NDArray[np.int_],
                                         dk: FreqaiDataKitchen, strat_df: DataFrame) -> None:
                """
                Append model predictions to historic predictions dataframe, then set the
        Severity: Minor
        Found in freqtrade/freqai/data_drawer.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

        There are no issues that match your filters.

        Category
        Status