freqtrade/freqtrade

View on GitHub
freqtrade/data/dataprovider.py

Summary

Maintainability
C
1 day
Test Coverage

File dataprovider.py has 439 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
Dataprovider
Responsible to provide data to the bot
including ticker and orderbook data, live and historical candle (OHLCV) data
Common Interface for bot and strategy to access data.
Severity: Minor
Found in freqtrade/data/dataprovider.py - About 6 hrs to fix

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

        def _add_external_df(
    Severity: Minor
    Found in freqtrade/data/dataprovider.py - About 45 mins to fix

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

          def get_analyzed_dataframe(self, pair: str, timeframe: str) -> Tuple[DataFrame, datetime]:
              """
              Retrieve the analyzed dataframe. Returns the full dataframe in trade mode (live / dry),
              and the last 1000 candles (up to the time evaluated at this moment) in all other modes.
              :param pair: pair to get the data for
      Severity: Minor
      Found in freqtrade/data/dataprovider.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 _replace_external_df has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def _replace_external_df(
      Severity: Minor
      Found in freqtrade/data/dataprovider.py - About 45 mins to fix

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

            def ohlcv(
        Severity: Minor
        Found in freqtrade/data/dataprovider.py - About 35 mins to fix

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

              def _add_external_df(
                  self,
                  pair: str,
                  dataframe: DataFrame,
                  last_analyzed: datetime,
          Severity: Minor
          Found in freqtrade/data/dataprovider.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 (True, 0)
          Severity: Major
          Found in freqtrade/data/dataprovider.py - About 30 mins to fix

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

                def ohlcv(
                    self,
                    pair: str,
                    timeframe: Optional[str] = None,
                    copy: bool = True,
            Severity: Minor
            Found in freqtrade/data/dataprovider.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 get_pair_dataframe has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def get_pair_dataframe(
                    self,
                    pair: str,
                    timeframe: Optional[str] = None,
                    candle_type: str = ''
            Severity: Minor
            Found in freqtrade/data/dataprovider.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