Showing 17 of 38 total issues
File real_trader.py
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
import dataclasses
from datetime import datetime, timedelta
from pprint import pprint
from typing import Any, Callable, Dict, List, Literal, Optional, Union
File history_visualizer.py
has 292 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime
from datetime import timedelta
from typing import List, Optional, Tuple, TypedDict
from oanda_accessor_pyv20 import OandaInterface
Function __calc_parabolic
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def __calc_parabolic(self):
candles = self.__base_candles
# 初期値
acceleration_factor = Analyzer.INITIAL_AF
# INFO: 初期状態は上昇トレンドと仮定して計算
- Read upRead up
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
Visualizer
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Visualizer:
DRAWABLE_ROWS = 200
def __init__(
self,
File drawer.py
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime
import matplotlib
import matplotlib.pyplot as plt
import mplfinance.original_flavor as mpf
Function __append_performance_result_to_csv
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __append_performance_result_to_csv(
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,
- Read upRead up
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:
- Read upRead up
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(
Function repulsion_exist
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def repulsion_exist(
Function step_trailing
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def step_trailing(
Function detect_thrust
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def detect_thrust(trend, previous_high, high, previous_low, low):
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):
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="")
- Read upRead up
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"
- Read upRead up
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
- Read upRead up
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()
- Read upRead up
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"