BaptisteZloch/Quant-Invest-Lab

View on GitHub
quant_invest_lab/indicators.py

Summary

Maintainability
D
2 days
Test Coverage

File indicators.py has 597 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import pandas as pd
import numpy as np
import numpy.typing as npt
from typing import Literal, Callable, Optional
from scipy import stats, signal
Severity: Major
Found in quant_invest_lab/indicators.py - About 1 day to fix

    Function detect_fractal_support_resistance has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def detect_fractal_support_resistance(high: pd.Series, low: pd.Series) -> list[float]:
        """Detects the supports and resistances according to the fractal 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 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 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 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

      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 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

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

        def detect_profiled_support_resistance(
            close: pd.Series,
            volume: Optional[pd.Series] = None,
            kde_factor: float = 0.075,
            total_levels: str | int = "all",
        Severity: Minor
        Found in quant_invest_lab/indicators.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