siruku6/fx_alarm_py

View on GitHub

Showing 38 of 38 total issues

Function repulsion_exist has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def repulsion_exist(
    trend: str,
    previous_ema: float,
    two_before_high: float,
    previous_high: float,
Severity: Minor
Found in src/trade_rules/scalping.py - About 55 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 __play_swing_trade has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def __play_swing_trade(
        self,
        candles: pd.DataFrame,
        indicators: pd.DataFrame,
    ) -> None:
Severity: Minor
Found in src/real_trader.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 __draw_one_chart has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __draw_one_chart(
Severity: Minor
Found in src/result_processor.py - About 45 mins to fix

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

    def repulsion_exist(
    Severity: Minor
    Found in src/trade_rules/scalping.py - About 45 mins to fix

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

      def step_trailing(
      Severity: Minor
      Found in src/trade_rules/stoploss.py - About 35 mins to fix

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

        def detect_thrust(trend, previous_high, high, previous_low, low):
        Severity: Minor
        Found in src/trade_rules/base.py - About 35 mins to fix

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

          def thrusting_exist(trend, two_before_high, previous_high, two_before_low, previous_low):
          Severity: Minor
          Found in src/trade_rules/wait_close.py - About 35 mins to fix

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

            def ask_granularity() -> str:
                while True:
                    error_msg: str = "Invalid granularity !\n"
            
                    print("取得スパンは?(ex: M5): ", end="")
            Severity: Minor
            Found in src/lib/interface.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 draw_positions_df has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def draw_positions_df(self, positions_df, plot_type=PLOT_TYPE["long"], size=20, nolabel=None):
                    if plot_type == FigureDrawer.PLOT_TYPE["long"]:
                        color = "white"
                        edgecolors = "green"
                        label = "long"
            Severity: Minor
            Found in src/drawer.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 _create_position has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def _create_position(
                    self, previous_candle: pd.Series, direction: str, last_indicators: pd.Series = None
                ) -> None:
                    """
                    Order Oanda to create position
            Severity: Minor
            Found in src/real_trader.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 calc_indicators has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def calc_indicators(self, candles, long_span_candles=None, stoc_only=False):
                    if candles is None or candles.empty:
                        print("[ERROR] Analyzer: 分析対象データがありません")
                        exit()
            
            
            Severity: Minor
            Found in src/analyzer.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

            Remove this commented out code.
            Open

                    # # Trendline
            Severity: Major
            Found in src/analyzer.py by sonar-python

            Programmers should not comment out code as it bloats programs and reduces readability.

            Unused code should be deleted and can be retrieved from source control history if required.

            See

            • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
            • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
            • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
            • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

            Remove this commented out code.
            Open

            # from scipy.stats import linregress
            Severity: Major
            Found in src/analyzer.py by sonar-python

            Programmers should not comment out code as it bloats programs and reduces readability.

            Unused code should be deleted and can be retrieved from source control history if required.

            See

            • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
            • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
            • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
            • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

            Refactor this function to reduce its Cognitive Complexity from 20 to the 15 allowed.
            Open

                def __calc_parabolic(self):
            Severity: Critical
            Found in src/analyzer.py by sonar-python

            Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

            See

            Remove this commented out code.
            Open

                # def __get_local_extremum(self, start, end, bool_high):
            Severity: Major
            Found in src/analyzer.py by sonar-python

            Programmers should not comment out code as it bloats programs and reduces readability.

            Unused code should be deleted and can be retrieved from source control history if required.

            See

            • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
            • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
            • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
            • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

            Remove this commented out code.
            Open

                # def __get_breakpoints(self):
            Severity: Major
            Found in src/analyzer.py by sonar-python

            Programmers should not comment out code as it bloats programs and reduces readability.

            Unused code should be deleted and can be retrieved from source control history if required.

            See

            • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
            • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
            • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
            • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

            Remove this commented out code.
            Open

            # def the_previous_satisfy_rules(preconditions):
            Severity: Major
            Found in src/trade_rules/wait_close.py by sonar-python

            Programmers should not comment out code as it bloats programs and reduces readability.

            Unused code should be deleted and can be retrieved from source control history if required.

            See

            • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
            • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
            • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
            • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

            Remove this commented out code.
            Open

                    # result = self.__calc_trendlines()
            Severity: Major
            Found in src/analyzer.py by sonar-python

            Programmers should not comment out code as it bloats programs and reduces readability.

            Unused code should be deleted and can be retrieved from source control history if required.

            See

            • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
            • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
            • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
            • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"
            Severity
            Category
            Status
            Source
            Language