nabehide/TradeDerPy

View on GitHub

Showing 10 of 28 total issues

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

# -*- coding: utf-8 -*-

import re
import random
from datetime import datetime
Severity: Minor
Found in TradeDerPy/TradeDerPy.py - About 4 hrs to fix

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

        def search(self, variables):
            queryTraded = "&traded=true" if variables["traded"] else ""
            queryCommand = "&command=" + variables["command"]
            queryIdx1 = "&idx1=true" if variables["idx1"] else "&idx1=" if variables["idx1"] is None else "&idx1=false"
            queryMinUnitPrice = "&lospl=" if variables["minUnitPrice"] is None else "&lospl=" + str(variables["minUnitPrice"])
    Severity: Minor
    Found in TradeDerPy/TradeDerPy.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

    TradeDerPy has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class TradeDerPy(object):
    
        def __init__(self, account, config):
            self.username = account["username"]
            self.password = account["password"]
    Severity: Minor
    Found in TradeDerPy/TradeDerPy.py - About 2 hrs to fix

      Function getHold has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def getHold(self):
              self.hold = pd.DataFrame(columns=self.columnsHold)
      
              self.driver.get(mainURL + PositionHoldPath)
              soup, text = self._getSoupText()
      Severity: Minor
      Found in TradeDerPy/TradeDerPy.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 getSuggested has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def getSuggested(self):
              self.suggested = pd.DataFrame(columns=self.columnsSuggested)
      
              variables = defaultSearchVariables
              variables["suggest"] = 2
      Severity: Minor
      Found in TradeDerPy/TradeDerPy.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 getStatus has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def getStatus(self):
              self.driver.get(mainURL + dashboardsPath)
              soup, text = self._getSoupText()
              try:
                  self.status = False
      Severity: Minor
      Found in TradeDerPy/TradeDerPy.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 sellProfitable has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def sellProfitable(self):
              candidate = self.hold[
                  # (self.hold["star"] <= 1) & (10 < self.hold["rateHold"][:-2])
                  (self.hold["star"] <= 1) & (10 < self.hold["rateHold"])
              ]
      Severity: Minor
      Found in TradeDerPy/TradeDerPy.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 sellCutLoss has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def sellCutLoss(self):
              candidate = self.hold[self.hold["star"] <= 0]
      
              if len(candidate) == 0:
                  message = timeStamp() + "Fail sell CutLoss: No candidate"
      Severity: Minor
      Found in TradeDerPy/TradeDerPy.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 routineDay has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def routineDay(self):
              try:
                  self.getStatus()
                  if self.status:
                      ret = ""
      Severity: Minor
      Found in TradeDerPy/TradeDerPy.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 getOrder has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def getOrder(self):
              self.orderURL = {}
      
              self.driver.get(mainURL + orderPath)
              soup, text = self._getSoupText()
      Severity: Minor
      Found in TradeDerPy/TradeDerPy.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

      Severity
      Category
      Status
      Source
      Language