freqtrade/freqtrade

View on GitHub
freqtrade/edge/edge_positioning.py

Summary

Maintainability
C
1 day
Test Coverage

File edge_positioning.py has 353 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# pragma pylint: disable=W0603
""" Edge positioning package """
import logging
from collections import defaultdict
from copy import deepcopy
Severity: Minor
Found in freqtrade/edge/edge_positioning.py - About 4 hrs to fix

    Function _detect_next_stop_or_sell_point has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def _detect_next_stop_or_sell_point(self, buy_column, sell_column, date_column,
                                            ohlc_columns, stoploss, pair: str):
            """
            Iterate through ohlc_columns in order to find the next trade
            Next trade opens from the first buy signal noticed to
    Severity: Minor
    Found in freqtrade/edge/edge_positioning.py - About 2 hrs 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 calculate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def calculate(self, pairs: List[str]) -> bool:
            if self.fee is None and pairs:
                self.fee = self.exchange.get_fee(pairs[0])
    
            heartbeat = self.edge_config.get('process_throttle_secs')
    Severity: Minor
    Found in freqtrade/edge/edge_positioning.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_next_stop_or_sell_point has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def _detect_next_stop_or_sell_point(self, buy_column, sell_column, date_column,
    Severity: Major
    Found in freqtrade/edge/edge_positioning.py - About 50 mins to fix

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

          def adjust(self, pairs: List[str]) -> list:
              """
              Filters out and sorts "pairs" according to Edge calculated pairs
              """
              final = []
      Severity: Minor
      Found in freqtrade/edge/edge_positioning.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 stake_amount has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def stake_amount(self, pair: str, free_capital: float,
      Severity: Minor
      Found in freqtrade/edge/edge_positioning.py - About 35 mins to fix

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

            def __init__(self, config: Config, exchange, strategy) -> None:
        
                self.config = config
                self.exchange = exchange
                self.strategy: IStrategy = strategy
        Severity: Minor
        Found in freqtrade/edge/edge_positioning.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