File freqai_interface.py
has 829 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
import threading
import time
from abc import ABC, abstractmethod
from collections import deque
Function start_backtesting
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def start_backtesting(
self, dataframe: DataFrame, metadata: dict, dk: FreqaiDataKitchen, strategy: IStrategy
) -> FreqaiDataKitchen:
"""
The main broad execution for backtesting. For backtesting, each pair enters and then gets
- 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 __init__
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(self, config: Config) -> None:
self.config = config
self.assert_config(self.config)
self.freqai_info: Dict[str, Any] = config["freqai"]
Function _start_scanning
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _start_scanning(self, strategy: IStrategy) -> None:
"""
Function designed to constantly scan pairs for retraining on a separate thread (intracandle)
to improve model youth. This function is agnostic to data preparation/collection/storage,
it simply trains on what ever data is available in the self.dd.
- 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 extract_data_and_train_model
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def extract_data_and_train_model(
Function start_live
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def start_live(
Function start_backtesting
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def start_backtesting(
Function set_initial_historic_predictions
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def set_initial_historic_predictions(
Function train
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def train(self, unfiltered_df: DataFrame, pair: str,
Function build_strategy_return_arrays
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def build_strategy_return_arrays(
Function log_backtesting_progress
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def log_backtesting_progress(self, tr_train: TimeRange, pair: str,
Function start
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def start(self, dataframe: DataFrame, metadata: dict, strategy: IStrategy) -> DataFrame:
"""
Entry point to the FreqaiModel from a specific pair, it will train a new model if
necessary before making the prediction.
- 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"