freqtrade/persistence/trade_model.py
File trade_model.py
has 1642 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
"""
This module contains the class to persist trades into SQLite
"""
import logging
from collections import defaultdict
Function to_json
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def to_json(self, entry_side: str, minified: bool = False) -> Dict[str, Any]:
"""
:param minified: If True, only return a subset of the data is returned.
Only used for backtesting.
"""
- 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 parse_from_ccxt_object
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def parse_from_ccxt_object(
Function update_from_ccxt_object
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def update_from_ccxt_object(self, order):
"""
Update Order from ccxt response
Only updates if fields are available from ccxt -
"""
- 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 update_fee
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def update_fee(self, fee_cost: float, fee_currency: Optional[str], fee_rate: Optional[float],
Function adjust_stop_loss
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def adjust_stop_loss(self, current_price: float, stoploss: Optional[float],
Function get_trades_proxy
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def get_trades_proxy(*, pair: Optional[str] = None, is_open: Optional[bool] = None,
Function get_trades_proxy
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def get_trades_proxy(*, pair: Optional[str] = None, is_open: Optional[bool] = None,