diff --git a/freqtrade/commands/__init__.py b/freqtrade/commands/__init__.py index e0fa0fd51..20eed3533 100644 --- a/freqtrade/commands/__init__.py +++ b/freqtrade/commands/__init__.py @@ -9,19 +9,35 @@ Note: Be careful with file-scoped imports in these subfiles. from freqtrade.commands.analyze_commands import start_analysis_entries_exits from freqtrade.commands.arguments import Arguments from freqtrade.commands.build_config_commands import start_new_config, start_show_config -from freqtrade.commands.data_commands import (start_convert_data, start_convert_trades, - start_download_data, start_list_data) +from freqtrade.commands.data_commands import ( + start_convert_data, + start_convert_trades, + start_download_data, + start_list_data, +) from freqtrade.commands.db_commands import start_convert_db -from freqtrade.commands.deploy_commands import (start_create_userdir, start_install_ui, - start_new_strategy) +from freqtrade.commands.deploy_commands import ( + start_create_userdir, + start_install_ui, + start_new_strategy, +) from freqtrade.commands.hyperopt_commands import start_hyperopt_list, start_hyperopt_show -from freqtrade.commands.list_commands import (start_list_exchanges, start_list_freqAI_models, - start_list_markets, start_list_strategies, - start_list_timeframes, start_show_trades) -from freqtrade.commands.optimize_commands import (start_backtesting, start_backtesting_show, - start_edge, start_hyperopt, - start_lookahead_analysis, - start_recursive_analysis) +from freqtrade.commands.list_commands import ( + start_list_exchanges, + start_list_freqAI_models, + start_list_markets, + start_list_strategies, + start_list_timeframes, + start_show_trades, +) +from freqtrade.commands.optimize_commands import ( + start_backtesting, + start_backtesting_show, + start_edge, + start_hyperopt, + start_lookahead_analysis, + start_recursive_analysis, +) from freqtrade.commands.pairlist_commands import start_test_pairlist from freqtrade.commands.plot_commands import start_plot_dataframe, start_plot_profit from freqtrade.commands.strategy_utils_commands import start_strategy_update diff --git a/freqtrade/commands/arguments.py b/freqtrade/commands/arguments.py index d994c09c0..4a29cc2cf 100755 --- a/freqtrade/commands/arguments.py +++ b/freqtrade/commands/arguments.py @@ -203,19 +203,39 @@ class Arguments: ) self._build_args(optionlist=['version'], parser=self.parser) - from freqtrade.commands import (start_analysis_entries_exits, start_backtesting, - start_backtesting_show, start_convert_data, - start_convert_db, start_convert_trades, - start_create_userdir, start_download_data, start_edge, - start_hyperopt, start_hyperopt_list, start_hyperopt_show, - start_install_ui, start_list_data, start_list_exchanges, - start_list_freqAI_models, start_list_markets, - start_list_strategies, start_list_timeframes, - start_lookahead_analysis, start_new_config, - start_new_strategy, start_plot_dataframe, start_plot_profit, - start_recursive_analysis, start_show_config, - start_show_trades, start_strategy_update, - start_test_pairlist, start_trading, start_webserver) + from freqtrade.commands import ( + start_analysis_entries_exits, + start_backtesting, + start_backtesting_show, + start_convert_data, + start_convert_db, + start_convert_trades, + start_create_userdir, + start_download_data, + start_edge, + start_hyperopt, + start_hyperopt_list, + start_hyperopt_show, + start_install_ui, + start_list_data, + start_list_exchanges, + start_list_freqAI_models, + start_list_markets, + start_list_strategies, + start_list_timeframes, + start_lookahead_analysis, + start_new_config, + start_new_strategy, + start_plot_dataframe, + start_plot_profit, + start_recursive_analysis, + start_show_config, + start_show_trades, + start_strategy_update, + start_test_pairlist, + start_trading, + start_webserver, + ) subparsers = self.parser.add_subparsers(dest='command', # Use custom message when no subhandler is added diff --git a/freqtrade/commands/data_commands.py b/freqtrade/commands/data_commands.py index 6762a83da..f5c3a381d 100644 --- a/freqtrade/commands/data_commands.py +++ b/freqtrade/commands/data_commands.py @@ -5,8 +5,11 @@ from typing import Any, Dict from freqtrade.configuration import TimeRange, setup_utils_configuration from freqtrade.constants import DATETIME_PRINT_FORMAT, DL_DATA_TIMEFRAMES, Config -from freqtrade.data.converter import (convert_ohlcv_format, convert_trades_format, - convert_trades_to_ohlcv) +from freqtrade.data.converter import ( + convert_ohlcv_format, + convert_trades_format, + convert_trades_to_ohlcv, +) from freqtrade.data.history import download_data_main from freqtrade.enums import CandleType, RunMode, TradingMode from freqtrade.exceptions import ConfigurationError diff --git a/freqtrade/configuration/directory_operations.py b/freqtrade/configuration/directory_operations.py index 267a74928..2afc75fc1 100644 --- a/freqtrade/configuration/directory_operations.py +++ b/freqtrade/configuration/directory_operations.py @@ -4,8 +4,14 @@ from pathlib import Path from typing import Optional from freqtrade.configuration.detect_environment import running_in_docker -from freqtrade.constants import (USER_DATA_FILES, USERPATH_FREQAIMODELS, USERPATH_HYPEROPTS, - USERPATH_NOTEBOOKS, USERPATH_STRATEGIES, Config) +from freqtrade.constants import ( + USER_DATA_FILES, + USERPATH_FREQAIMODELS, + USERPATH_HYPEROPTS, + USERPATH_NOTEBOOKS, + USERPATH_STRATEGIES, + Config, +) from freqtrade.exceptions import OperationalException diff --git a/freqtrade/data/converter/__init__.py b/freqtrade/data/converter/__init__.py index 3918e49da..36b7f2f87 100644 --- a/freqtrade/data/converter/__init__.py +++ b/freqtrade/data/converter/__init__.py @@ -1,12 +1,22 @@ -from freqtrade.data.converter.converter import (clean_ohlcv_dataframe, convert_ohlcv_format, - ohlcv_fill_up_missing_data, ohlcv_to_dataframe, - order_book_to_dataframe, reduce_dataframe_footprint, - trim_dataframe, trim_dataframes) -from freqtrade.data.converter.trade_converter import (convert_trades_format, - convert_trades_to_ohlcv, trades_convert_types, - trades_df_remove_duplicates, - trades_dict_to_list, trades_list_to_df, - trades_to_ohlcv) +from freqtrade.data.converter.converter import ( + clean_ohlcv_dataframe, + convert_ohlcv_format, + ohlcv_fill_up_missing_data, + ohlcv_to_dataframe, + order_book_to_dataframe, + reduce_dataframe_footprint, + trim_dataframe, + trim_dataframes, +) +from freqtrade.data.converter.trade_converter import ( + convert_trades_format, + convert_trades_to_ohlcv, + trades_convert_types, + trades_df_remove_duplicates, + trades_dict_to_list, + trades_list_to_df, + trades_to_ohlcv, +) __all__ = [ diff --git a/freqtrade/data/converter/trade_converter.py b/freqtrade/data/converter/trade_converter.py index a7cc97cb8..a94cf284b 100644 --- a/freqtrade/data/converter/trade_converter.py +++ b/freqtrade/data/converter/trade_converter.py @@ -9,8 +9,13 @@ import pandas as pd from pandas import DataFrame, to_datetime from freqtrade.configuration import TimeRange -from freqtrade.constants import (DEFAULT_DATAFRAME_COLUMNS, DEFAULT_TRADES_COLUMNS, TRADES_DTYPES, - Config, TradeList) +from freqtrade.constants import ( + DEFAULT_DATAFRAME_COLUMNS, + DEFAULT_TRADES_COLUMNS, + TRADES_DTYPES, + Config, + TradeList, +) from freqtrade.enums import CandleType, TradingMode from freqtrade.exceptions import OperationalException diff --git a/freqtrade/data/converter/trade_converter_kraken.py b/freqtrade/data/converter/trade_converter_kraken.py index 90f7df28f..332352d47 100644 --- a/freqtrade/data/converter/trade_converter_kraken.py +++ b/freqtrade/data/converter/trade_converter_kraken.py @@ -4,8 +4,10 @@ from pathlib import Path import pandas as pd from freqtrade.constants import DATETIME_PRINT_FORMAT, DEFAULT_TRADES_COLUMNS, Config -from freqtrade.data.converter.trade_converter import (trades_convert_types, - trades_df_remove_duplicates) +from freqtrade.data.converter.trade_converter import ( + trades_convert_types, + trades_df_remove_duplicates, +) from freqtrade.data.history import get_datahandler from freqtrade.enums import TradingMode from freqtrade.exceptions import OperationalException diff --git a/freqtrade/data/dataprovider.py b/freqtrade/data/dataprovider.py index 6fa6e4738..fc906b123 100644 --- a/freqtrade/data/dataprovider.py +++ b/freqtrade/data/dataprovider.py @@ -12,8 +12,12 @@ from typing import Any, Dict, List, Optional, Tuple from pandas import DataFrame, Timedelta, Timestamp, to_timedelta from freqtrade.configuration import TimeRange -from freqtrade.constants import (FULL_DATAFRAME_THRESHOLD, Config, ListPairsWithTimeframes, - PairWithTimeframe) +from freqtrade.constants import ( + FULL_DATAFRAME_THRESHOLD, + Config, + ListPairsWithTimeframes, + PairWithTimeframe, +) from freqtrade.data.history import load_pair_history from freqtrade.enums import CandleType, RPCMessageType, RunMode from freqtrade.exceptions import ExchangeError, OperationalException diff --git a/freqtrade/data/entryexitanalysis.py b/freqtrade/data/entryexitanalysis.py index 36587e573..c85a72834 100644 --- a/freqtrade/data/entryexitanalysis.py +++ b/freqtrade/data/entryexitanalysis.py @@ -8,8 +8,11 @@ from tabulate import tabulate from freqtrade.configuration import TimeRange from freqtrade.constants import Config -from freqtrade.data.btanalysis import (get_latest_backtest_filename, load_backtest_data, - load_backtest_stats) +from freqtrade.data.btanalysis import ( + get_latest_backtest_filename, + load_backtest_data, + load_backtest_stats, +) from freqtrade.exceptions import OperationalException diff --git a/freqtrade/data/history/__init__.py b/freqtrade/data/history/__init__.py index f989fd801..88dddb112 100644 --- a/freqtrade/data/history/__init__.py +++ b/freqtrade/data/history/__init__.py @@ -7,6 +7,14 @@ Includes: """ # flake8: noqa: F401 from .datahandlers import get_datahandler -from .history_utils import (convert_trades_to_ohlcv, download_data_main, get_timerange, load_data, - load_pair_history, refresh_backtest_ohlcv_data, - refresh_backtest_trades_data, refresh_data, validate_backtest_data) +from .history_utils import ( + convert_trades_to_ohlcv, + download_data_main, + get_timerange, + load_data, + load_pair_history, + refresh_backtest_ohlcv_data, + refresh_backtest_trades_data, + refresh_data, + validate_backtest_data, +) diff --git a/freqtrade/data/history/datahandlers/idatahandler.py b/freqtrade/data/history/datahandlers/idatahandler.py index cff26760f..d7c34b7fe 100644 --- a/freqtrade/data/history/datahandlers/idatahandler.py +++ b/freqtrade/data/history/datahandlers/idatahandler.py @@ -16,8 +16,12 @@ from pandas import DataFrame from freqtrade import misc from freqtrade.configuration import TimeRange from freqtrade.constants import DEFAULT_TRADES_COLUMNS, ListPairsWithTimeframes -from freqtrade.data.converter import (clean_ohlcv_dataframe, trades_convert_types, - trades_df_remove_duplicates, trim_dataframe) +from freqtrade.data.converter import ( + clean_ohlcv_dataframe, + trades_convert_types, + trades_df_remove_duplicates, + trim_dataframe, +) from freqtrade.enums import CandleType, TradingMode from freqtrade.exchange import timeframe_to_seconds diff --git a/freqtrade/data/history/history_utils.py b/freqtrade/data/history/history_utils.py index e9ff2b2df..370c47467 100644 --- a/freqtrade/data/history/history_utils.py +++ b/freqtrade/data/history/history_utils.py @@ -7,11 +7,20 @@ from typing import Dict, List, Optional, Tuple from pandas import DataFrame, concat from freqtrade.configuration import TimeRange -from freqtrade.constants import (DATETIME_PRINT_FORMAT, DEFAULT_DATAFRAME_COLUMNS, - DL_DATA_TIMEFRAMES, DOCS_LINK, Config) -from freqtrade.data.converter import (clean_ohlcv_dataframe, convert_trades_to_ohlcv, - ohlcv_to_dataframe, trades_df_remove_duplicates, - trades_list_to_df) +from freqtrade.constants import ( + DATETIME_PRINT_FORMAT, + DEFAULT_DATAFRAME_COLUMNS, + DL_DATA_TIMEFRAMES, + DOCS_LINK, + Config, +) +from freqtrade.data.converter import ( + clean_ohlcv_dataframe, + convert_trades_to_ohlcv, + ohlcv_to_dataframe, + trades_df_remove_duplicates, + trades_list_to_df, +) from freqtrade.data.history.datahandlers import IDataHandler, get_datahandler from freqtrade.enums import CandleType, TradingMode from freqtrade.exceptions import OperationalException diff --git a/freqtrade/exchange/__init__.py b/freqtrade/exchange/__init__.py index 109f3c1e8..33d1e8c4b 100644 --- a/freqtrade/exchange/__init__.py +++ b/freqtrade/exchange/__init__.py @@ -10,18 +10,30 @@ from freqtrade.exchange.bitpanda import Bitpanda from freqtrade.exchange.bitvavo import Bitvavo from freqtrade.exchange.bybit import Bybit from freqtrade.exchange.coinbasepro import Coinbasepro -from freqtrade.exchange.exchange_utils import (ROUND_DOWN, ROUND_UP, amount_to_contract_precision, - amount_to_contracts, amount_to_precision, - available_exchanges, ccxt_exchanges, - contracts_to_amount, date_minus_candles, - is_exchange_known_ccxt, list_available_exchanges, - market_is_active, price_to_precision, - validate_exchange) -from freqtrade.exchange.exchange_utils_timeframe import (timeframe_to_minutes, timeframe_to_msecs, - timeframe_to_next_date, - timeframe_to_prev_date, - timeframe_to_resample_freq, - timeframe_to_seconds) +from freqtrade.exchange.exchange_utils import ( + ROUND_DOWN, + ROUND_UP, + amount_to_contract_precision, + amount_to_contracts, + amount_to_precision, + available_exchanges, + ccxt_exchanges, + contracts_to_amount, + date_minus_candles, + is_exchange_known_ccxt, + list_available_exchanges, + market_is_active, + price_to_precision, + validate_exchange, +) +from freqtrade.exchange.exchange_utils_timeframe import ( + timeframe_to_minutes, + timeframe_to_msecs, + timeframe_to_next_date, + timeframe_to_prev_date, + timeframe_to_resample_freq, + timeframe_to_seconds, +) from freqtrade.exchange.gate import Gate from freqtrade.exchange.hitbtc import Hitbtc from freqtrade.exchange.htx import Htx diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index bd847cffc..5938258ee 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -19,29 +19,67 @@ from ccxt import TICK_SIZE from dateutil import parser from pandas import DataFrame, concat -from freqtrade.constants import (DEFAULT_AMOUNT_RESERVE_PERCENT, NON_OPEN_EXCHANGE_STATES, BidAsk, - BuySell, Config, EntryExit, ExchangeConfig, - ListPairsWithTimeframes, MakerTaker, OBLiteral, PairWithTimeframe) +from freqtrade.constants import ( + DEFAULT_AMOUNT_RESERVE_PERCENT, + NON_OPEN_EXCHANGE_STATES, + BidAsk, + BuySell, + Config, + EntryExit, + ExchangeConfig, + ListPairsWithTimeframes, + MakerTaker, + OBLiteral, + PairWithTimeframe, +) from freqtrade.data.converter import clean_ohlcv_dataframe, ohlcv_to_dataframe, trades_dict_to_list from freqtrade.enums import OPTIMIZE_MODES, CandleType, MarginMode, PriceType, RunMode, TradingMode -from freqtrade.exceptions import (ConfigurationError, DDosProtection, ExchangeError, - InsufficientFundsError, InvalidOrderException, - OperationalException, PricingError, RetryableOrderError, - TemporaryError) -from freqtrade.exchange.common import (API_FETCH_ORDER_RETRY_COUNT, remove_exchange_credentials, - retrier, retrier_async) -from freqtrade.exchange.exchange_utils import (ROUND, ROUND_DOWN, ROUND_UP, CcxtModuleType, - amount_to_contract_precision, amount_to_contracts, - amount_to_precision, contracts_to_amount, - date_minus_candles, is_exchange_known_ccxt, - market_is_active, price_to_precision) -from freqtrade.exchange.exchange_utils_timeframe import (timeframe_to_minutes, timeframe_to_msecs, - timeframe_to_next_date, - timeframe_to_prev_date, - timeframe_to_seconds) +from freqtrade.exceptions import ( + ConfigurationError, + DDosProtection, + ExchangeError, + InsufficientFundsError, + InvalidOrderException, + OperationalException, + PricingError, + RetryableOrderError, + TemporaryError, +) +from freqtrade.exchange.common import ( + API_FETCH_ORDER_RETRY_COUNT, + remove_exchange_credentials, + retrier, + retrier_async, +) +from freqtrade.exchange.exchange_utils import ( + ROUND, + ROUND_DOWN, + ROUND_UP, + CcxtModuleType, + amount_to_contract_precision, + amount_to_contracts, + amount_to_precision, + contracts_to_amount, + date_minus_candles, + is_exchange_known_ccxt, + market_is_active, + price_to_precision, +) +from freqtrade.exchange.exchange_utils_timeframe import ( + timeframe_to_minutes, + timeframe_to_msecs, + timeframe_to_next_date, + timeframe_to_prev_date, + timeframe_to_seconds, +) from freqtrade.exchange.types import OHLCVResponse, OrderBook, Ticker, Tickers -from freqtrade.misc import (chunks, deep_merge_dicts, file_dump_json, file_load_json, - safe_value_fallback2) +from freqtrade.misc import ( + chunks, + deep_merge_dicts, + file_dump_json, + file_load_json, + safe_value_fallback2, +) from freqtrade.plugins.pairlist.pairlist_helpers import expand_pairlist from freqtrade.util import dt_from_ts, dt_now from freqtrade.util.datetime_helpers import dt_humanize_delta, dt_ts diff --git a/freqtrade/exchange/exchange_utils.py b/freqtrade/exchange/exchange_utils.py index 73f61f256..0bb076e6b 100644 --- a/freqtrade/exchange/exchange_utils.py +++ b/freqtrade/exchange/exchange_utils.py @@ -6,11 +6,23 @@ from math import ceil, floor from typing import Any, Dict, List, Optional, Tuple import ccxt -from ccxt import (DECIMAL_PLACES, ROUND, ROUND_DOWN, ROUND_UP, SIGNIFICANT_DIGITS, TICK_SIZE, - TRUNCATE, decimal_to_precision) +from ccxt import ( + DECIMAL_PLACES, + ROUND, + ROUND_DOWN, + ROUND_UP, + SIGNIFICANT_DIGITS, + TICK_SIZE, + TRUNCATE, + decimal_to_precision, +) -from freqtrade.exchange.common import (BAD_EXCHANGES, EXCHANGE_HAS_OPTIONAL, EXCHANGE_HAS_REQUIRED, - SUPPORTED_EXCHANGES) +from freqtrade.exchange.common import ( + BAD_EXCHANGES, + EXCHANGE_HAS_OPTIONAL, + EXCHANGE_HAS_REQUIRED, + SUPPORTED_EXCHANGES, +) from freqtrade.exchange.exchange_utils_timeframe import timeframe_to_minutes, timeframe_to_prev_date from freqtrade.types import ValidExchangesType from freqtrade.util import FtPrecise diff --git a/freqtrade/exchange/okx.py b/freqtrade/exchange/okx.py index d919a73cc..3c9c782c1 100644 --- a/freqtrade/exchange/okx.py +++ b/freqtrade/exchange/okx.py @@ -6,8 +6,12 @@ import ccxt from freqtrade.constants import BuySell from freqtrade.enums import CandleType, MarginMode, PriceType, TradingMode -from freqtrade.exceptions import (DDosProtection, OperationalException, RetryableOrderError, - TemporaryError) +from freqtrade.exceptions import ( + DDosProtection, + OperationalException, + RetryableOrderError, + TemporaryError, +) from freqtrade.exchange import Exchange, date_minus_candles from freqtrade.exchange.common import retrier from freqtrade.misc import safe_value_fallback2 diff --git a/freqtrade/freqai/prediction_models/PyTorchMLPClassifier.py b/freqtrade/freqai/prediction_models/PyTorchMLPClassifier.py index a03a0c742..d56f24a30 100644 --- a/freqtrade/freqai/prediction_models/PyTorchMLPClassifier.py +++ b/freqtrade/freqai/prediction_models/PyTorchMLPClassifier.py @@ -4,8 +4,10 @@ import torch from freqtrade.freqai.base_models.BasePyTorchClassifier import BasePyTorchClassifier from freqtrade.freqai.data_kitchen import FreqaiDataKitchen -from freqtrade.freqai.torch.PyTorchDataConvertor import (DefaultPyTorchDataConvertor, - PyTorchDataConvertor) +from freqtrade.freqai.torch.PyTorchDataConvertor import ( + DefaultPyTorchDataConvertor, + PyTorchDataConvertor, +) from freqtrade.freqai.torch.PyTorchMLPModel import PyTorchMLPModel from freqtrade.freqai.torch.PyTorchModelTrainer import PyTorchModelTrainer diff --git a/freqtrade/freqai/prediction_models/PyTorchMLPRegressor.py b/freqtrade/freqai/prediction_models/PyTorchMLPRegressor.py index ec5c0ba81..e36f3a124 100644 --- a/freqtrade/freqai/prediction_models/PyTorchMLPRegressor.py +++ b/freqtrade/freqai/prediction_models/PyTorchMLPRegressor.py @@ -4,8 +4,10 @@ import torch from freqtrade.freqai.base_models.BasePyTorchRegressor import BasePyTorchRegressor from freqtrade.freqai.data_kitchen import FreqaiDataKitchen -from freqtrade.freqai.torch.PyTorchDataConvertor import (DefaultPyTorchDataConvertor, - PyTorchDataConvertor) +from freqtrade.freqai.torch.PyTorchDataConvertor import ( + DefaultPyTorchDataConvertor, + PyTorchDataConvertor, +) from freqtrade.freqai.torch.PyTorchMLPModel import PyTorchMLPModel from freqtrade.freqai.torch.PyTorchModelTrainer import PyTorchModelTrainer diff --git a/freqtrade/freqai/prediction_models/PyTorchTransformerRegressor.py b/freqtrade/freqai/prediction_models/PyTorchTransformerRegressor.py index 8f245ed83..0ad6c77d7 100644 --- a/freqtrade/freqai/prediction_models/PyTorchTransformerRegressor.py +++ b/freqtrade/freqai/prediction_models/PyTorchTransformerRegressor.py @@ -7,8 +7,10 @@ import torch from freqtrade.freqai.base_models.BasePyTorchRegressor import BasePyTorchRegressor from freqtrade.freqai.data_kitchen import FreqaiDataKitchen -from freqtrade.freqai.torch.PyTorchDataConvertor import (DefaultPyTorchDataConvertor, - PyTorchDataConvertor) +from freqtrade.freqai.torch.PyTorchDataConvertor import ( + DefaultPyTorchDataConvertor, + PyTorchDataConvertor, +) from freqtrade.freqai.torch.PyTorchModelTrainer import PyTorchTransformerTrainer from freqtrade.freqai.torch.PyTorchTransformerModel import PyTorchTransformerModel diff --git a/freqtrade/freqai/tensorboard/__init__.py b/freqtrade/freqai/tensorboard/__init__.py index 59862bc0d..8c3fe5b73 100644 --- a/freqtrade/freqai/tensorboard/__init__.py +++ b/freqtrade/freqai/tensorboard/__init__.py @@ -4,8 +4,10 @@ try: TBLogger = TensorboardLogger TBCallback = TensorBoardCallback except ModuleNotFoundError: - from freqtrade.freqai.tensorboard.base_tensorboard import (BaseTensorBoardCallback, - BaseTensorboardLogger) + from freqtrade.freqai.tensorboard.base_tensorboard import ( + BaseTensorBoardCallback, + BaseTensorboardLogger, + ) TBLogger = BaseTensorboardLogger # type: ignore TBCallback = BaseTensorBoardCallback # type: ignore diff --git a/freqtrade/freqai/tensorboard/tensorboard.py b/freqtrade/freqai/tensorboard/tensorboard.py index 3ad896108..5da7c74c9 100644 --- a/freqtrade/freqai/tensorboard/tensorboard.py +++ b/freqtrade/freqai/tensorboard/tensorboard.py @@ -5,8 +5,10 @@ from typing import Any from torch.utils.tensorboard import SummaryWriter from xgboost import callback -from freqtrade.freqai.tensorboard.base_tensorboard import (BaseTensorBoardCallback, - BaseTensorboardLogger) +from freqtrade.freqai.tensorboard.base_tensorboard import ( + BaseTensorBoardCallback, + BaseTensorboardLogger, +) logger = logging.getLogger(__name__) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 810ce0ae5..579a50844 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -18,12 +18,29 @@ from freqtrade.constants import BuySell, Config, EntryExecuteMode, ExchangeConfi from freqtrade.data.converter import order_book_to_dataframe from freqtrade.data.dataprovider import DataProvider from freqtrade.edge import Edge -from freqtrade.enums import (ExitCheckTuple, ExitType, RPCMessageType, SignalDirection, State, - TradingMode) -from freqtrade.exceptions import (DependencyException, ExchangeError, InsufficientFundsError, - InvalidOrderException, PricingError) -from freqtrade.exchange import (ROUND_DOWN, ROUND_UP, remove_exchange_credentials, - timeframe_to_minutes, timeframe_to_next_date, timeframe_to_seconds) +from freqtrade.enums import ( + ExitCheckTuple, + ExitType, + RPCMessageType, + SignalDirection, + State, + TradingMode, +) +from freqtrade.exceptions import ( + DependencyException, + ExchangeError, + InsufficientFundsError, + InvalidOrderException, + PricingError, +) +from freqtrade.exchange import ( + ROUND_DOWN, + ROUND_UP, + remove_exchange_credentials, + timeframe_to_minutes, + timeframe_to_next_date, + timeframe_to_seconds, +) from freqtrade.misc import safe_value_fallback, safe_value_fallback2 from freqtrade.mixins import LoggingMixin from freqtrade.persistence import Order, PairLocks, Trade, init_db @@ -33,12 +50,18 @@ from freqtrade.plugins.protectionmanager import ProtectionManager from freqtrade.resolvers import ExchangeResolver, StrategyResolver from freqtrade.rpc import RPCManager from freqtrade.rpc.external_message_consumer import ExternalMessageConsumer -from freqtrade.rpc.rpc_types import (ProfitLossStr, RPCCancelMsg, RPCEntryMsg, RPCExitCancelMsg, - RPCExitMsg, RPCProtectionMsg) +from freqtrade.rpc.rpc_types import ( + ProfitLossStr, + RPCCancelMsg, + RPCEntryMsg, + RPCExitCancelMsg, + RPCExitMsg, + RPCProtectionMsg, +) from freqtrade.strategy.interface import IStrategy from freqtrade.strategy.strategy_wrapper import strategy_safe_wrapper from freqtrade.util import MeasureTime -from freqtrade.util.migrations import migrate_binance_futures_names +from freqtrade.util.migrations.binance_mig import migrate_binance_futures_names from freqtrade.wallets import Wallets diff --git a/freqtrade/optimize/analysis/lookahead.py b/freqtrade/optimize/analysis/lookahead.py index 9fa4235e7..bb2ee0899 100755 --- a/freqtrade/optimize/analysis/lookahead.py +++ b/freqtrade/optimize/analysis/lookahead.py @@ -9,8 +9,10 @@ from pandas import DataFrame from freqtrade.data.history import get_timerange from freqtrade.exchange import timeframe_to_minutes -from freqtrade.loggers.set_log_levels import (reduce_verbosity_for_bias_tester, - restore_verbosity_for_bias_tester) +from freqtrade.loggers.set_log_levels import ( + reduce_verbosity_for_bias_tester, + restore_verbosity_for_bias_tester, +) from freqtrade.optimize.backtesting import Backtesting from freqtrade.optimize.base_analysis import BaseAnalysis, VarHolder diff --git a/freqtrade/optimize/analysis/recursive.py b/freqtrade/optimize/analysis/recursive.py index 5a41f8795..e359d358b 100644 --- a/freqtrade/optimize/analysis/recursive.py +++ b/freqtrade/optimize/analysis/recursive.py @@ -8,8 +8,10 @@ from typing import Any, Dict, List from pandas import DataFrame from freqtrade.exchange import timeframe_to_minutes -from freqtrade.loggers.set_log_levels import (reduce_verbosity_for_bias_tester, - restore_verbosity_for_bias_tester) +from freqtrade.loggers.set_log_levels import ( + reduce_verbosity_for_bias_tester, + restore_verbosity_for_bias_tester, +) from freqtrade.optimize.backtesting import Backtesting from freqtrade.optimize.base_analysis import BaseAnalysis, VarHolder diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 131a88b47..39c7aa8bc 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -20,22 +20,41 @@ from freqtrade.data.btanalysis import find_existing_backtest_stats, trade_list_t from freqtrade.data.converter import trim_dataframe, trim_dataframes from freqtrade.data.dataprovider import DataProvider from freqtrade.data.metrics import combined_dataframes_with_rel_mean -from freqtrade.enums import (BacktestState, CandleType, ExitCheckTuple, ExitType, RunMode, - TradingMode) +from freqtrade.enums import ( + BacktestState, + CandleType, + ExitCheckTuple, + ExitType, + RunMode, + TradingMode, +) from freqtrade.exceptions import DependencyException, OperationalException -from freqtrade.exchange import (amount_to_contract_precision, price_to_precision, - timeframe_to_seconds) +from freqtrade.exchange import ( + amount_to_contract_precision, + price_to_precision, + timeframe_to_seconds, +) from freqtrade.exchange.exchange import Exchange from freqtrade.mixins import LoggingMixin from freqtrade.optimize.backtest_caching import get_strategy_run_id from freqtrade.optimize.bt_progress import BTProgress -from freqtrade.optimize.optimize_reports import (generate_backtest_stats, generate_rejected_signals, - generate_trade_signal_candles, - show_backtest_results, - store_backtest_analysis_results, - store_backtest_stats) -from freqtrade.persistence import (CustomDataWrapper, LocalTrade, Order, PairLocks, Trade, - disable_database_use, enable_database_use) +from freqtrade.optimize.optimize_reports import ( + generate_backtest_stats, + generate_rejected_signals, + generate_trade_signal_candles, + show_backtest_results, + store_backtest_analysis_results, + store_backtest_stats, +) +from freqtrade.persistence import ( + CustomDataWrapper, + LocalTrade, + Order, + PairLocks, + Trade, + disable_database_use, + enable_database_use, +) from freqtrade.plugins.pairlistmanager import PairListManager from freqtrade.plugins.protectionmanager import ProtectionManager from freqtrade.resolvers import ExchangeResolver, StrategyResolver diff --git a/freqtrade/optimize/hyperopt.py b/freqtrade/optimize/hyperopt.py index 5d5d15b03..3725d1f16 100644 --- a/freqtrade/optimize/hyperopt.py +++ b/freqtrade/optimize/hyperopt.py @@ -18,8 +18,15 @@ from colorama import init as colorama_init from joblib import Parallel, cpu_count, delayed, dump, load, wrap_non_picklable_objects from joblib.externals import cloudpickle from pandas import DataFrame -from rich.progress import (BarColumn, MofNCompleteColumn, Progress, TaskProgressColumn, TextColumn, - TimeElapsedColumn, TimeRemainingColumn) +from rich.progress import ( + BarColumn, + MofNCompleteColumn, + Progress, + TaskProgressColumn, + TextColumn, + TimeElapsedColumn, + TimeRemainingColumn, +) from freqtrade.constants import DATETIME_PRINT_FORMAT, FTHYPT_FILEVERSION, LAST_BT_RESULT_FN, Config from freqtrade.data.converter import trim_dataframes @@ -29,11 +36,15 @@ from freqtrade.enums import HyperoptState from freqtrade.exceptions import OperationalException from freqtrade.misc import deep_merge_dicts, file_dump_json, plural from freqtrade.optimize.backtesting import Backtesting + # Import IHyperOpt and IHyperOptLoss to allow unpickling classes from these modules from freqtrade.optimize.hyperopt_auto import HyperOptAuto from freqtrade.optimize.hyperopt_loss_interface import IHyperOptLoss -from freqtrade.optimize.hyperopt_tools import (HyperoptStateContainer, HyperoptTools, - hyperopt_serializer) +from freqtrade.optimize.hyperopt_tools import ( + HyperoptStateContainer, + HyperoptTools, + hyperopt_serializer, +) from freqtrade.optimize.optimize_reports import generate_strategy_stats from freqtrade.resolvers.hyperopt_resolver import HyperOptLossResolver diff --git a/freqtrade/optimize/optimize_reports/__init__.py b/freqtrade/optimize/optimize_reports/__init__.py index bb91bf33c..6f3278a1c 100644 --- a/freqtrade/optimize/optimize_reports/__init__.py +++ b/freqtrade/optimize/optimize_reports/__init__.py @@ -1,17 +1,30 @@ # flake8: noqa: F401 -from freqtrade.optimize.optimize_reports.bt_output import (generate_edge_table, - generate_wins_draws_losses, - show_backtest_result, - show_backtest_results, - show_sorted_pairlist, - text_table_add_metrics, - text_table_bt_results, - text_table_periodic_breakdown, - text_table_strategy, text_table_tags) -from freqtrade.optimize.optimize_reports.bt_storage import (store_backtest_analysis_results, - store_backtest_stats) +from freqtrade.optimize.optimize_reports.bt_output import ( + generate_edge_table, + generate_wins_draws_losses, + show_backtest_result, + show_backtest_results, + show_sorted_pairlist, + text_table_add_metrics, + text_table_bt_results, + text_table_periodic_breakdown, + text_table_strategy, + text_table_tags, +) +from freqtrade.optimize.optimize_reports.bt_storage import ( + store_backtest_analysis_results, + store_backtest_stats, +) from freqtrade.optimize.optimize_reports.optimize_reports import ( - generate_all_periodic_breakdown_stats, generate_backtest_stats, generate_daily_stats, - generate_pair_metrics, generate_periodic_breakdown_stats, generate_rejected_signals, - generate_strategy_comparison, generate_strategy_stats, generate_tag_metrics, - generate_trade_signal_candles, generate_trading_stats) + generate_all_periodic_breakdown_stats, + generate_backtest_stats, + generate_daily_stats, + generate_pair_metrics, + generate_periodic_breakdown_stats, + generate_rejected_signals, + generate_strategy_comparison, + generate_strategy_stats, + generate_tag_metrics, + generate_trade_signal_candles, + generate_trading_stats, +) diff --git a/freqtrade/optimize/optimize_reports/optimize_reports.py b/freqtrade/optimize/optimize_reports/optimize_reports.py index 1bf73d714..b6a2312af 100644 --- a/freqtrade/optimize/optimize_reports/optimize_reports.py +++ b/freqtrade/optimize/optimize_reports/optimize_reports.py @@ -7,9 +7,16 @@ import numpy as np from pandas import DataFrame, Series, concat, to_datetime from freqtrade.constants import BACKTEST_BREAKDOWNS, DATETIME_PRINT_FORMAT -from freqtrade.data.metrics import (calculate_cagr, calculate_calmar, calculate_csum, - calculate_expectancy, calculate_market_change, - calculate_max_drawdown, calculate_sharpe, calculate_sortino) +from freqtrade.data.metrics import ( + calculate_cagr, + calculate_calmar, + calculate_csum, + calculate_expectancy, + calculate_market_change, + calculate_max_drawdown, + calculate_sharpe, + calculate_sortino, +) from freqtrade.types import BacktestResultType from freqtrade.util import decimals_per_coin, fmt_coin diff --git a/freqtrade/persistence/__init__.py b/freqtrade/persistence/__init__.py index d5584c22c..3612544ee 100644 --- a/freqtrade/persistence/__init__.py +++ b/freqtrade/persistence/__init__.py @@ -5,5 +5,8 @@ from freqtrade.persistence.key_value_store import KeyStoreKeys, KeyValueStore from freqtrade.persistence.models import init_db from freqtrade.persistence.pairlock_middleware import PairLocks from freqtrade.persistence.trade_model import LocalTrade, Order, Trade -from freqtrade.persistence.usedb_context import (FtNoDBContext, disable_database_use, - enable_database_use) +from freqtrade.persistence.usedb_context import ( + FtNoDBContext, + disable_database_use, + enable_database_use, +) diff --git a/freqtrade/persistence/trade_model.py b/freqtrade/persistence/trade_model.py index 3ca681df5..b5346660e 100644 --- a/freqtrade/persistence/trade_model.py +++ b/freqtrade/persistence/trade_model.py @@ -8,18 +8,39 @@ from datetime import datetime, timedelta, timezone from math import isclose from typing import Any, ClassVar, Dict, List, Optional, Sequence, cast -from sqlalchemy import (Enum, Float, ForeignKey, Integer, ScalarResult, Select, String, - UniqueConstraint, desc, func, select) +from sqlalchemy import ( + Enum, + Float, + ForeignKey, + Integer, + ScalarResult, + Select, + String, + UniqueConstraint, + desc, + func, + select, +) from sqlalchemy.orm import Mapped, lazyload, mapped_column, relationship, validates from typing_extensions import Self -from freqtrade.constants import (CANCELED_EXCHANGE_STATES, CUSTOM_TAG_MAX_LENGTH, - DATETIME_PRINT_FORMAT, MATH_CLOSE_PREC, NON_OPEN_EXCHANGE_STATES, - BuySell, LongShort) +from freqtrade.constants import ( + CANCELED_EXCHANGE_STATES, + CUSTOM_TAG_MAX_LENGTH, + DATETIME_PRINT_FORMAT, + MATH_CLOSE_PREC, + NON_OPEN_EXCHANGE_STATES, + BuySell, + LongShort, +) from freqtrade.enums import ExitType, TradingMode from freqtrade.exceptions import DependencyException, OperationalException -from freqtrade.exchange import (ROUND_DOWN, ROUND_UP, amount_to_contract_precision, - price_to_precision) +from freqtrade.exchange import ( + ROUND_DOWN, + ROUND_UP, + amount_to_contract_precision, + price_to_precision, +) from freqtrade.leverage import interest from freqtrade.misc import safe_value_fallback from freqtrade.persistence.base import ModelBase, SessionType diff --git a/freqtrade/plot/plotting.py b/freqtrade/plot/plotting.py index 4d29337a7..aa3eea3ec 100644 --- a/freqtrade/plot/plotting.py +++ b/freqtrade/plot/plotting.py @@ -7,13 +7,20 @@ import pandas as pd from freqtrade.configuration import TimeRange from freqtrade.constants import Config -from freqtrade.data.btanalysis import (analyze_trade_parallelism, extract_trades_of_period, - load_trades) +from freqtrade.data.btanalysis import ( + analyze_trade_parallelism, + extract_trades_of_period, + load_trades, +) from freqtrade.data.converter import trim_dataframe from freqtrade.data.dataprovider import DataProvider from freqtrade.data.history import get_timerange, load_data -from freqtrade.data.metrics import (calculate_max_drawdown, calculate_underwater, - combine_dataframes_with_mean, create_cum_profit) +from freqtrade.data.metrics import ( + calculate_max_drawdown, + calculate_underwater, + combine_dataframes_with_mean, + create_cum_profit, +) from freqtrade.enums import CandleType from freqtrade.exceptions import OperationalException from freqtrade.exchange import timeframe_to_prev_date, timeframe_to_seconds diff --git a/freqtrade/rpc/api_server/api_background_tasks.py b/freqtrade/rpc/api_server/api_background_tasks.py index c2ee0a4c2..7acf82f2e 100644 --- a/freqtrade/rpc/api_server/api_background_tasks.py +++ b/freqtrade/rpc/api_server/api_background_tasks.py @@ -9,9 +9,14 @@ from freqtrade.constants import Config from freqtrade.enums import CandleType from freqtrade.exceptions import OperationalException from freqtrade.persistence import FtNoDBContext -from freqtrade.rpc.api_server.api_schemas import (BackgroundTaskStatus, BgJobStarted, - ExchangeModePayloadMixin, PairListsPayload, - PairListsResponse, WhitelistEvaluateResponse) +from freqtrade.rpc.api_server.api_schemas import ( + BackgroundTaskStatus, + BgJobStarted, + ExchangeModePayloadMixin, + PairListsPayload, + PairListsResponse, + WhitelistEvaluateResponse, +) from freqtrade.rpc.api_server.deps import get_config, get_exchange from freqtrade.rpc.api_server.webserver_bgwork import ApiBG diff --git a/freqtrade/rpc/api_server/api_backtest.py b/freqtrade/rpc/api_server/api_backtest.py index 345f835a4..ef42a7a09 100644 --- a/freqtrade/rpc/api_server/api_backtest.py +++ b/freqtrade/rpc/api_server/api_backtest.py @@ -10,16 +10,25 @@ from fastapi.exceptions import HTTPException from freqtrade.configuration.config_validation import validate_config_consistency from freqtrade.constants import Config -from freqtrade.data.btanalysis import (delete_backtest_result, get_backtest_market_change, - get_backtest_result, get_backtest_resultlist, - load_and_merge_backtest_result, update_backtest_metadata) +from freqtrade.data.btanalysis import ( + delete_backtest_result, + get_backtest_market_change, + get_backtest_result, + get_backtest_resultlist, + load_and_merge_backtest_result, + update_backtest_metadata, +) from freqtrade.enums import BacktestState from freqtrade.exceptions import ConfigurationError, DependencyException, OperationalException from freqtrade.exchange.common import remove_exchange_credentials from freqtrade.misc import deep_merge_dicts, is_file_in_dir -from freqtrade.rpc.api_server.api_schemas import (BacktestHistoryEntry, BacktestMarketChange, - BacktestMetadataUpdate, BacktestRequest, - BacktestResponse) +from freqtrade.rpc.api_server.api_schemas import ( + BacktestHistoryEntry, + BacktestMarketChange, + BacktestMetadataUpdate, + BacktestRequest, + BacktestResponse, +) from freqtrade.rpc.api_server.deps import get_config from freqtrade.rpc.api_server.webserver_bgwork import ApiBG from freqtrade.rpc.rpc import RPCException diff --git a/freqtrade/rpc/api_server/api_v1.py b/freqtrade/rpc/api_server/api_v1.py index 2d3ba32fc..e46f9e9af 100644 --- a/freqtrade/rpc/api_server/api_v1.py +++ b/freqtrade/rpc/api_server/api_v1.py @@ -10,18 +10,45 @@ from freqtrade.data.history import get_datahandler from freqtrade.enums import CandleType, TradingMode from freqtrade.exceptions import OperationalException from freqtrade.rpc import RPC -from freqtrade.rpc.api_server.api_schemas import (AvailablePairs, Balances, BlacklistPayload, - BlacklistResponse, Count, DailyWeeklyMonthly, - DeleteLockRequest, DeleteTrade, Entry, - ExchangeListResponse, Exit, ForceEnterPayload, - ForceEnterResponse, ForceExitPayload, - FreqAIModelListResponse, Health, Locks, - LocksPayload, Logs, MixTag, OpenTradeSchema, - PairCandlesRequest, PairHistory, - PairHistoryRequest, PerformanceEntry, Ping, - PlotConfig, Profit, ResultMsg, ShowConfig, Stats, - StatusMsg, StrategyListResponse, StrategyResponse, - SysInfo, Version, WhitelistResponse) +from freqtrade.rpc.api_server.api_schemas import ( + AvailablePairs, + Balances, + BlacklistPayload, + BlacklistResponse, + Count, + DailyWeeklyMonthly, + DeleteLockRequest, + DeleteTrade, + Entry, + ExchangeListResponse, + Exit, + ForceEnterPayload, + ForceEnterResponse, + ForceExitPayload, + FreqAIModelListResponse, + Health, + Locks, + LocksPayload, + Logs, + MixTag, + OpenTradeSchema, + PairCandlesRequest, + PairHistory, + PairHistoryRequest, + PerformanceEntry, + Ping, + PlotConfig, + Profit, + ResultMsg, + ShowConfig, + Stats, + StatusMsg, + StrategyListResponse, + StrategyResponse, + SysInfo, + Version, + WhitelistResponse, +) from freqtrade.rpc.api_server.deps import get_config, get_exchange, get_rpc, get_rpc_optional from freqtrade.rpc.rpc import RPCException diff --git a/freqtrade/rpc/api_server/api_ws.py b/freqtrade/rpc/api_server/api_ws.py index 16aeb56f3..1c8a2ba92 100644 --- a/freqtrade/rpc/api_server/api_ws.py +++ b/freqtrade/rpc/api_server/api_ws.py @@ -12,9 +12,13 @@ from freqtrade.rpc.api_server.api_auth import validate_ws_token from freqtrade.rpc.api_server.deps import get_message_stream, get_rpc from freqtrade.rpc.api_server.ws.channel import WebSocketChannel, create_channel from freqtrade.rpc.api_server.ws.message_stream import MessageStream -from freqtrade.rpc.api_server.ws_schemas import (WSAnalyzedDFMessage, WSErrorMessage, - WSMessageSchema, WSRequestSchema, - WSWhitelistMessage) +from freqtrade.rpc.api_server.ws_schemas import ( + WSAnalyzedDFMessage, + WSErrorMessage, + WSMessageSchema, + WSRequestSchema, + WSWhitelistMessage, +) from freqtrade.rpc.rpc import RPC diff --git a/freqtrade/rpc/api_server/ws/channel.py b/freqtrade/rpc/api_server/ws/channel.py index 01bc7d276..16cc883c1 100644 --- a/freqtrade/rpc/api_server/ws/channel.py +++ b/freqtrade/rpc/api_server/ws/channel.py @@ -10,8 +10,10 @@ from fastapi import WebSocketDisconnect from websockets.exceptions import ConnectionClosed from freqtrade.rpc.api_server.ws.proxy import WebSocketProxy -from freqtrade.rpc.api_server.ws.serializer import (HybridJSONWebSocketSerializer, - WebSocketSerializer) +from freqtrade.rpc.api_server.ws.serializer import ( + HybridJSONWebSocketSerializer, + WebSocketSerializer, +) from freqtrade.rpc.api_server.ws.types import WebSocketType from freqtrade.rpc.api_server.ws_schemas import WSMessageSchemaType diff --git a/freqtrade/rpc/external_message_consumer.py b/freqtrade/rpc/external_message_consumer.py index bb0b3139f..fc7cf10c6 100644 --- a/freqtrade/rpc/external_message_consumer.py +++ b/freqtrade/rpc/external_message_consumer.py @@ -19,10 +19,15 @@ from freqtrade.enums import RPCMessageType from freqtrade.misc import remove_entry_exit_signals from freqtrade.rpc.api_server.ws.channel import WebSocketChannel, create_channel from freqtrade.rpc.api_server.ws.message_stream import MessageStream -from freqtrade.rpc.api_server.ws_schemas import (WSAnalyzedDFMessage, WSAnalyzedDFRequest, - WSMessageSchema, WSRequestSchema, - WSSubscribeRequest, WSWhitelistMessage, - WSWhitelistRequest) +from freqtrade.rpc.api_server.ws_schemas import ( + WSAnalyzedDFMessage, + WSAnalyzedDFRequest, + WSMessageSchema, + WSRequestSchema, + WSSubscribeRequest, + WSWhitelistMessage, + WSWhitelistRequest, +) if TYPE_CHECKING: diff --git a/freqtrade/rpc/rpc.py b/freqtrade/rpc/rpc.py index da37d9e96..161a314be 100644 --- a/freqtrade/rpc/rpc.py +++ b/freqtrade/rpc/rpc.py @@ -19,8 +19,15 @@ from freqtrade.configuration.timerange import TimeRange from freqtrade.constants import CANCEL_REASON, DEFAULT_DATAFRAME_COLUMNS, Config from freqtrade.data.history import load_data from freqtrade.data.metrics import calculate_expectancy, calculate_max_drawdown -from freqtrade.enums import (CandleType, ExitCheckTuple, ExitType, MarketDirection, SignalDirection, - State, TradingMode) +from freqtrade.enums import ( + CandleType, + ExitCheckTuple, + ExitType, + MarketDirection, + SignalDirection, + State, + TradingMode, +) from freqtrade.exceptions import ExchangeError, PricingError from freqtrade.exchange import timeframe_to_minutes, timeframe_to_msecs from freqtrade.exchange.types import Tickers diff --git a/freqtrade/rpc/telegram.py b/freqtrade/rpc/telegram.py index 9ac70f89d..5b9cf2763 100644 --- a/freqtrade/rpc/telegram.py +++ b/freqtrade/rpc/telegram.py @@ -18,8 +18,14 @@ from threading import Thread from typing import Any, Callable, Coroutine, Dict, List, Literal, Optional, Union from tabulate import tabulate -from telegram import (CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup, KeyboardButton, - ReplyKeyboardMarkup, Update) +from telegram import ( + CallbackQuery, + InlineKeyboardButton, + InlineKeyboardMarkup, + KeyboardButton, + ReplyKeyboardMarkup, + Update, +) from telegram.constants import MessageLimit, ParseMode from telegram.error import BadRequest, NetworkError, TelegramError from telegram.ext import Application, CallbackContext, CallbackQueryHandler, CommandHandler diff --git a/freqtrade/strategy/__init__.py b/freqtrade/strategy/__init__.py index 2d23bcd4d..bb21100c4 100644 --- a/freqtrade/strategy/__init__.py +++ b/freqtrade/strategy/__init__.py @@ -1,9 +1,22 @@ # flake8: noqa: F401 -from freqtrade.exchange import (timeframe_to_minutes, timeframe_to_msecs, timeframe_to_next_date, - timeframe_to_prev_date, timeframe_to_seconds) +from freqtrade.exchange import ( + timeframe_to_minutes, + timeframe_to_msecs, + timeframe_to_next_date, + timeframe_to_prev_date, + timeframe_to_seconds, +) from freqtrade.strategy.informative_decorator import informative from freqtrade.strategy.interface import IStrategy -from freqtrade.strategy.parameters import (BooleanParameter, CategoricalParameter, DecimalParameter, - IntParameter, RealParameter) -from freqtrade.strategy.strategy_helper import (merge_informative_pair, stoploss_from_absolute, - stoploss_from_open) +from freqtrade.strategy.parameters import ( + BooleanParameter, + CategoricalParameter, + DecimalParameter, + IntParameter, + RealParameter, +) +from freqtrade.strategy.strategy_helper import ( + merge_informative_pair, + stoploss_from_absolute, + stoploss_from_open, +) diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index f8a890d5d..ea8e6ce6a 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -11,16 +11,28 @@ from pandas import DataFrame from freqtrade.constants import CUSTOM_TAG_MAX_LENGTH, Config, IntOrInf, ListPairsWithTimeframes from freqtrade.data.dataprovider import DataProvider -from freqtrade.enums import (CandleType, ExitCheckTuple, ExitType, MarketDirection, RunMode, - SignalDirection, SignalTagType, SignalType, TradingMode) +from freqtrade.enums import ( + CandleType, + ExitCheckTuple, + ExitType, + MarketDirection, + RunMode, + SignalDirection, + SignalTagType, + SignalType, + TradingMode, +) from freqtrade.exceptions import OperationalException, StrategyError from freqtrade.exchange import timeframe_to_minutes, timeframe_to_next_date, timeframe_to_seconds from freqtrade.misc import remove_entry_exit_signals from freqtrade.persistence import Order, PairLocks, Trade from freqtrade.strategy.hyper import HyperStrategyMixin -from freqtrade.strategy.informative_decorator import (InformativeData, PopulateIndicators, - _create_and_merge_informative_pair, - _format_pair_name) +from freqtrade.strategy.informative_decorator import ( + InformativeData, + PopulateIndicators, + _create_and_merge_informative_pair, + _format_pair_name, +) from freqtrade.strategy.strategy_wrapper import strategy_safe_wrapper from freqtrade.util import dt_now from freqtrade.wallets import Wallets diff --git a/freqtrade/strategy/parameters.py b/freqtrade/strategy/parameters.py index 796fb9514..019b01050 100644 --- a/freqtrade/strategy/parameters.py +++ b/freqtrade/strategy/parameters.py @@ -12,7 +12,8 @@ from freqtrade.optimize.hyperopt_tools import HyperoptStateContainer with suppress(ImportError): - from skopt.space import Integer, Real, Categorical + from skopt.space import Categorical, Integer, Real + from freqtrade.optimize.space import SKDecimal from freqtrade.exceptions import OperationalException diff --git a/freqtrade/types/__init__.py b/freqtrade/types/__init__.py index 02343f52f..6420baba0 100644 --- a/freqtrade/types/__init__.py +++ b/freqtrade/types/__init__.py @@ -1,5 +1,8 @@ # flake8: noqa: F401 -from freqtrade.types.backtest_result_type import (BacktestHistoryEntryType, BacktestMetadataType, - BacktestResultType, - get_BacktestResultType_default) +from freqtrade.types.backtest_result_type import ( + BacktestHistoryEntryType, + BacktestMetadataType, + BacktestResultType, + get_BacktestResultType_default, +) from freqtrade.types.valid_exchanges_type import ValidExchangesType diff --git a/freqtrade/util/__init__.py b/freqtrade/util/__init__.py index 6f523cd8e..97209be2c 100644 --- a/freqtrade/util/__init__.py +++ b/freqtrade/util/__init__.py @@ -1,6 +1,16 @@ -from freqtrade.util.datetime_helpers import (dt_floor_day, dt_from_ts, dt_humanize_delta, dt_now, - dt_ts, dt_ts_def, dt_ts_none, dt_utc, format_date, - format_ms_time, shorten_date) +from freqtrade.util.datetime_helpers import ( + dt_floor_day, + dt_from_ts, + dt_humanize_delta, + dt_now, + dt_ts, + dt_ts_def, + dt_ts_none, + dt_utc, + format_date, + format_ms_time, + shorten_date, +) from freqtrade.util.formatters import decimals_per_coin, fmt_coin, round_value from freqtrade.util.ft_precise import FtPrecise from freqtrade.util.measure_time import MeasureTime diff --git a/freqtrade/util/migrations/__init__.py b/freqtrade/util/migrations/__init__.py index 9bd6f6288..d8c7dfad3 100644 --- a/freqtrade/util/migrations/__init__.py +++ b/freqtrade/util/migrations/__init__.py @@ -1,7 +1,6 @@ from typing import Optional from freqtrade.exchange import Exchange -from freqtrade.util.migrations.binance_mig import migrate_binance_futures_names # noqa F401 from freqtrade.util.migrations.binance_mig import migrate_binance_futures_data from freqtrade.util.migrations.funding_rate_mig import migrate_funding_fee_timeframe diff --git a/tests/utils/test_binance_mig.py b/tests/utils/test_binance_mig.py index a9ea3ddbd..d7447a4d3 100644 --- a/tests/utils/test_binance_mig.py +++ b/tests/utils/test_binance_mig.py @@ -3,11 +3,8 @@ import shutil import pytest from freqtrade.persistence import Trade -from freqtrade.util.migrations import ( - migrate_binance_futures_data, - migrate_binance_futures_names, - migrate_data, -) +from freqtrade.util.migrations import migrate_binance_futures_data, migrate_data +from freqtrade.util.migrations.binance_mig import migrate_binance_futures_names from tests.conftest import create_mock_trades_usdt, log_has