BaptisteZloch/Quant-Invest-Lab

View on GitHub

Showing 42 of 42 total issues

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

def extreme_euphoria_pattern(
    open: pd.Series,
    close: pd.Series,
    euphoria_side: Literal["bull", "bear"] = "bull",
    n_candles: int = 3,
Severity: Minor
Found in quant_invest_lab/indicators.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_brownian_candle_from_dataframe has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def generate_brownian_candle_from_dataframe(
    dataframe: pd.DataFrame,
    timeframe: Timeframe = "1day",
    generated_dataframe_length: int = 5000,
    date_index: bool = True,
Severity: Minor
Found in quant_invest_lab/simulation.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_backtest_report has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def print_backtest_report(
    trades_df: pd.DataFrame,
    ohlcv_df: pd.DataFrame,
    timeframe: Timeframe,
    initial_equity: Union[int, float] = 1000,
Severity: Minor
Found in quant_invest_lab/reports.py - About 1 hr to fix

    Function price_long_only_backtester has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def price_long_only_backtester(
        df: pd.DataFrame,
        price_column: str,
        long_entry_function: Callable[[pd.Series, pd.Series], bool],
        long_exit_function: Callable[[pd.Series, pd.Series, int], bool],
    Severity: Minor
    Found in quant_invest_lab/backtest.py - About 1 hr to fix

      Function price_short_only_backtester has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def price_short_only_backtester(
          df: pd.DataFrame,
          price_column: str,
          short_entry_function: Callable[[pd.Series, pd.Series], bool],
          short_exit_function: Callable[[pd.Series, pd.Series, int], bool],
      Severity: Minor
      Found in quant_invest_lab/backtest.py - About 1 hr to fix

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

        def detect_windowing_support_resistance(high: pd.Series, low: pd.Series) -> list[float]:
            """Detects the supports and resistances according to the windowing method
        
            Args:
                high (pd.Series): The high series from the OHLCV Data.
        Severity: Minor
        Found in quant_invest_lab/indicators.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 ohlc_short_only_backtester has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def ohlc_short_only_backtester(
            df: pd.DataFrame,
            short_entry_function: Callable[[pd.Series, pd.Series], bool],
            short_exit_function: Callable[[pd.Series, pd.Series, int], bool],
            timeframe: Timeframe,
        Severity: Minor
        Found in quant_invest_lab/backtest.py - About 1 hr to fix

          Function ohlc_long_only_backtester has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def ohlc_long_only_backtester(
              df: pd.DataFrame,
              long_entry_function: Callable[[pd.Series, pd.Series], bool],
              long_exit_function: Callable[[pd.Series, pd.Series, int], bool],
              timeframe: Timeframe,
          Severity: Minor
          Found in quant_invest_lab/backtest.py - About 1 hr to fix

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

            def __ohlc_backtest_one_position_type(
            Severity: Major
            Found in quant_invest_lab/backtest.py - About 1 hr to fix

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

              def generate_brownian_paths(
              Severity: Major
              Found in quant_invest_lab/simulation.py - About 1 hr to fix

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

                def __price_backtest_one_position_type(
                Severity: Major
                Found in quant_invest_lab/backtest.py - About 1 hr to fix

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

                  def fibonacci_distance_indicator(
                  Severity: Minor
                  Found in quant_invest_lab/indicators.py - About 45 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if base_currency == None and quote_currency == None:
                                return symbols
                            elif base_currency == None and quote_currency is not None:
                                return list(
                                    filter(
                    Severity: Major
                    Found in quant_invest_lab/data_provider.py - About 40 mins to fix

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

                      def garman_klass_volatility_indicator(
                      Severity: Minor
                      Found in quant_invest_lab/indicators.py - About 35 mins to fix

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

                        def download_crypto_historical_data(
                        Severity: Minor
                        Found in quant_invest_lab/data_provider.py - About 35 mins to fix

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

                          def generate_brownian_candle_from_dataframe(
                          Severity: Minor
                          Found in quant_invest_lab/simulation.py - About 35 mins to fix

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

                            def support_resistance_breakout_indicator(
                                support_resistance_levels: list[float], open: pd.Series, low: pd.Series
                            ) -> pd.Series:
                                """Generate support resistance breakout rolling indicator.
                            
                            
                            Severity: Minor
                            Found in quant_invest_lab/indicators.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 ohlcv_df
                            Severity: Major
                            Found in quant_invest_lab/backtest.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return ohlcv_df
                              Severity: Major
                              Found in quant_invest_lab/backtest.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                        return price_df
                                Severity: Major
                                Found in quant_invest_lab/backtest.py - About 30 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language