freqtrade/freqtrade

View on GitHub
freqtrade/data/history/history_utils.py

Summary

Maintainability
D
2 days
Test Coverage

File history_utils.py has 462 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import logging
import operator
from datetime import datetime, timedelta
from pathlib import Path
from typing import Dict, List, Optional, Tuple
Severity: Minor
Found in freqtrade/data/history/history_utils.py - About 7 hrs to fix

    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 _download_pair_history has 12 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def _download_pair_history(pair: str, *,
    Severity: Major
    Found in freqtrade/data/history/history_utils.py - About 1 hr to fix

      Function load_data has 11 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def load_data(datadir: Path,
      Severity: Major
      Found in freqtrade/data/history/history_utils.py - About 1 hr to fix

        Function load_pair_history has 11 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def load_pair_history(pair: str,
        Severity: Major
        Found in freqtrade/data/history/history_utils.py - About 1 hr to fix

          Function refresh_backtest_ohlcv_data has 10 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def refresh_backtest_ohlcv_data(exchange: Exchange, pairs: List[str], timeframes: List[str],
          Severity: Major
          Found in freqtrade/data/history/history_utils.py - About 1 hr to fix

            Function load_data has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            def load_data(datadir: Path,
                          timeframe: str,
                          pairs: List[str], *,
                          timerange: Optional[TimeRange] = None,
                          fill_up_missing: bool = True,
            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 refresh_backtest_trades_data has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def refresh_backtest_trades_data(exchange: Exchange, pairs: List[str], datadir: Path,
            Severity: Major
            Found in freqtrade/data/history/history_utils.py - About 1 hr to fix

              Function refresh_data has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def refresh_data(*, datadir: Path,
              Severity: Major
              Found in freqtrade/data/history/history_utils.py - About 1 hr to fix

                Function _download_trades_history has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def _download_trades_history(exchange: Exchange,
                Severity: Major
                Found in freqtrade/data/history/history_utils.py - About 50 mins to fix

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

                  def _load_cached_data_for_updating(
                  Severity: Minor
                  Found in freqtrade/data/history/history_utils.py - About 45 mins to fix

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

                    def validate_backtest_data(data: DataFrame, pair: str, min_date: datetime,
                    Severity: Minor
                    Found in freqtrade/data/history/history_utils.py - About 35 mins to fix

                      There are no issues that match your filters.

                      Category
                      Status