Fix flake8 complaints
This commit is contained in:
parent
f55a9940a7
commit
a63affc5f1
@ -8,7 +8,6 @@ from collections import defaultdict
|
|||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
from typing import Any, Dict, List, Optional, Tuple
|
from typing import Any, Dict, List, Optional, Tuple
|
||||||
import pickle
|
|
||||||
|
|
||||||
from numpy import nan
|
from numpy import nan
|
||||||
from pandas import DataFrame
|
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.btanalysis import find_existing_backtest_stats, trade_list_to_dataframe
|
||||||
from freqtrade.data.converter import trim_dataframe, trim_dataframes
|
from freqtrade.data.converter import trim_dataframe, trim_dataframes
|
||||||
from freqtrade.data.dataprovider import DataProvider
|
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.exceptions import DependencyException, OperationalException
|
||||||
from freqtrade.exchange import timeframe_to_minutes, timeframe_to_seconds
|
from freqtrade.exchange import timeframe_to_minutes, timeframe_to_seconds
|
||||||
from freqtrade.misc import get_strategy_run_id
|
from freqtrade.misc import get_strategy_run_id
|
||||||
from freqtrade.mixins import LoggingMixin
|
from freqtrade.mixins import LoggingMixin
|
||||||
from freqtrade.optimize.bt_progress import BTProgress
|
from freqtrade.optimize.bt_progress import BTProgress
|
||||||
from freqtrade.optimize.optimize_reports import (generate_backtest_stats, show_backtest_results,
|
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.persistence import LocalTrade, Order, PairLocks, Trade
|
||||||
from freqtrade.plugins.pairlistmanager import PairListManager
|
from freqtrade.plugins.pairlistmanager import PairListManager
|
||||||
from freqtrade.plugins.protectionmanager import ProtectionManager
|
from freqtrade.plugins.protectionmanager import ProtectionManager
|
||||||
@ -1075,7 +1076,8 @@ class Backtesting:
|
|||||||
})
|
})
|
||||||
self.all_results[self.strategy.get_strategy_name()] = results
|
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 = {}
|
signal_candles_only = {}
|
||||||
for pair in preprocessed_tmp.keys():
|
for pair in preprocessed_tmp.keys():
|
||||||
signal_candles_only_df = DataFrame()
|
signal_candles_only_df = DataFrame()
|
||||||
@ -1157,7 +1159,8 @@ class Backtesting:
|
|||||||
if self.config.get('export', 'none') == 'trades':
|
if self.config.get('export', 'none') == 'trades':
|
||||||
store_backtest_stats(self.config['exportfilename'], self.results)
|
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)
|
store_backtest_signal_candles(self.config['exportfilename'], self.processed_dfs)
|
||||||
|
|
||||||
# Results may be mixed up now. Sort them so they follow --strategy-list order.
|
# Results may be mixed up now. Sort them so they follow --strategy-list order.
|
||||||
|
@ -51,7 +51,8 @@ def store_backtest_signal_candles(recordfilename: Path, candles: Dict[str, Dict]
|
|||||||
Stores backtest trade signal candles
|
Stores backtest trade signal candles
|
||||||
:param recordfilename: Path object, which can either be a filename or a directory.
|
:param recordfilename: Path object, which can either be a filename or a directory.
|
||||||
Filenames will be appended with a timestamp right before the suffix
|
Filenames will be appended with a timestamp right before the suffix
|
||||||
while for directories, <directory>/backtest-result-<datetime>_signals.pkl will be used as filename
|
while for directories, <directory>/backtest-result-<datetime>_signals.pkl will be used
|
||||||
|
as filename
|
||||||
:param stats: Dict containing the backtesting signal candles
|
:param stats: Dict containing the backtesting signal candles
|
||||||
"""
|
"""
|
||||||
if recordfilename.is_dir():
|
if recordfilename.is_dir():
|
||||||
|
Loading…
Reference in New Issue
Block a user