From a63affc5f14156b671c805de9256d3e611d05c93 Mon Sep 17 00:00:00 2001 From: froggleston Date: Sat, 16 Apr 2022 16:32:04 +0100 Subject: [PATCH] Fix flake8 complaints --- freqtrade/optimize/backtesting.py | 13 ++++++++----- freqtrade/optimize/optimize_reports.py | 3 ++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index f19cd488e..7e19e26e4 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -8,7 +8,6 @@ from collections import defaultdict from copy import deepcopy from datetime import datetime, timedelta, timezone from typing import Any, Dict, List, Optional, Tuple -import pickle from numpy import nan from pandas import DataFrame @@ -20,14 +19,16 @@ from freqtrade.data import history from freqtrade.data.btanalysis import find_existing_backtest_stats, trade_list_to_dataframe from freqtrade.data.converter import trim_dataframe, trim_dataframes from freqtrade.data.dataprovider import DataProvider -from freqtrade.enums import BacktestState, CandleType, ExitCheckTuple, ExitType, TradingMode, RunMode +from freqtrade.enums import (BacktestState, CandleType, ExitCheckTuple, ExitType, TradingMode, + RunMode) from freqtrade.exceptions import DependencyException, OperationalException from freqtrade.exchange import timeframe_to_minutes, timeframe_to_seconds from freqtrade.misc import get_strategy_run_id from freqtrade.mixins import LoggingMixin from freqtrade.optimize.bt_progress import BTProgress from freqtrade.optimize.optimize_reports import (generate_backtest_stats, show_backtest_results, - store_backtest_stats, store_backtest_signal_candles) + store_backtest_stats, + store_backtest_signal_candles) from freqtrade.persistence import LocalTrade, Order, PairLocks, Trade from freqtrade.plugins.pairlistmanager import PairListManager from freqtrade.plugins.protectionmanager import ProtectionManager @@ -1075,7 +1076,8 @@ class Backtesting: }) self.all_results[self.strategy.get_strategy_name()] = results - if self.backtest_signal_candle_export_enable and self.dataprovider.runmode == RunMode.BACKTEST: + if self.backtest_signal_candle_export_enable and + self.dataprovider.runmode == RunMode.BACKTEST: signal_candles_only = {} for pair in preprocessed_tmp.keys(): signal_candles_only_df = DataFrame() @@ -1157,7 +1159,8 @@ class Backtesting: if self.config.get('export', 'none') == 'trades': store_backtest_stats(self.config['exportfilename'], self.results) - if self.backtest_signal_candle_export_enable and self.dataprovider.runmode == RunMode.BACKTEST: + if self.backtest_signal_candle_export_enable and + self.dataprovider.runmode == RunMode.BACKTEST: store_backtest_signal_candles(self.config['exportfilename'], self.processed_dfs) # Results may be mixed up now. Sort them so they follow --strategy-list order. diff --git a/freqtrade/optimize/optimize_reports.py b/freqtrade/optimize/optimize_reports.py index f870bd1f5..06b393b60 100644 --- a/freqtrade/optimize/optimize_reports.py +++ b/freqtrade/optimize/optimize_reports.py @@ -51,7 +51,8 @@ def store_backtest_signal_candles(recordfilename: Path, candles: Dict[str, Dict] Stores backtest trade signal candles :param recordfilename: Path object, which can either be a filename or a directory. Filenames will be appended with a timestamp right before the suffix - while for directories, /backtest-result-_signals.pkl will be used as filename + while for directories, /backtest-result-_signals.pkl will be used + as filename :param stats: Dict containing the backtesting signal candles """ if recordfilename.is_dir():