diff --git a/freqtrade/constants.py b/freqtrade/constants.py index 15c17d691..fab490ae2 100644 --- a/freqtrade/constants.py +++ b/freqtrade/constants.py @@ -3,7 +3,7 @@ """ bot constants """ -from typing import Any, Dict, List, Literal, Tuple, Optional +from typing import Any, Dict, List, Literal, Optional, Tuple from freqtrade.enums import CandleType, PriceType, RPCMessageType diff --git a/freqtrade/data/converter/__init__.py b/freqtrade/data/converter/__init__.py index 3a330554f..722a99bd7 100644 --- a/freqtrade/data/converter/__init__.py +++ b/freqtrade/data/converter/__init__.py @@ -1,8 +1,10 @@ -from freqtrade.data.converter.converter import (clean_duplicate_trades, clean_ohlcv_dataframe, convert_ohlcv_format, - ohlcv_fill_up_missing_data, ohlcv_to_dataframe, - order_book_to_dataframe, - populate_dataframe_with_trades, public_trades_to_dataframe, - reduce_dataframe_footprint, trim_dataframe, trim_dataframes) +from freqtrade.data.converter.converter import (clean_duplicate_trades, clean_ohlcv_dataframe, + convert_ohlcv_format, ohlcv_fill_up_missing_data, + ohlcv_to_dataframe, order_book_to_dataframe, + populate_dataframe_with_trades, + public_trades_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, diff --git a/freqtrade/data/converter/converter.py b/freqtrade/data/converter/converter.py index 96f73e8b1..d55ace896 100644 --- a/freqtrade/data/converter/converter.py +++ b/freqtrade/data/converter/converter.py @@ -1,6 +1,7 @@ """ Functions to convert data from one format to another """ +import itertools import logging import time from typing import Dict @@ -8,11 +9,11 @@ from typing import Dict import numpy as np import pandas as pd from pandas import DataFrame, to_datetime -import itertools -from freqtrade.constants import DEFAULT_ORDERFLOW_COLUMNS, DEFAULT_TRADES_COLUMNS, DEFAULT_DATAFRAME_COLUMNS, Config -from freqtrade.enums import CandleType, TradingMode +from freqtrade.constants import (DEFAULT_DATAFRAME_COLUMNS, DEFAULT_ORDERFLOW_COLUMNS, + DEFAULT_TRADES_COLUMNS, Config) from freqtrade.data.converter.trade_converter import trades_df_remove_duplicates +from freqtrade.enums import CandleType, TradingMode logger = logging.getLogger(__name__) diff --git a/freqtrade/data/dataprovider.py b/freqtrade/data/dataprovider.py index ac4c279e7..01226cc7e 100644 --- a/freqtrade/data/dataprovider.py +++ b/freqtrade/data/dataprovider.py @@ -12,10 +12,11 @@ from typing import Any, Dict, List, Optional, Tuple from pandas import DataFrame, Timedelta, Timestamp, to_timedelta from freqtrade.configuration import TimeRange -from freqtrade.data.history.idatahandler import get_datahandler from freqtrade.constants import (FULL_DATAFRAME_THRESHOLD, Config, ListPairsWithTimeframes, - PairWithTimeframe, ListTicksWithTimeframes) + ListTicksWithTimeframes, PairWithTimeframe) +from freqtrade.data.converter import public_trades_to_dataframe from freqtrade.data.history import load_pair_history +from freqtrade.data.history.idatahandler import get_datahandler from freqtrade.enums import CandleType, RPCMessageType, RunMode from freqtrade.exceptions import ExchangeError, OperationalException from freqtrade.exchange import Exchange, timeframe_to_prev_date, timeframe_to_seconds @@ -25,7 +26,6 @@ from freqtrade.rpc import RPCManager from freqtrade.rpc.rpc_types import RPCAnalyzedDFMsg from freqtrade.util import PeriodicCache -from freqtrade.data.converter import public_trades_to_dataframe logger = logging.getLogger(__name__) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index a7f89b4b6..29afa35e2 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -10,7 +10,7 @@ from copy import deepcopy from datetime import datetime, timedelta, timezone from math import floor from threading import Lock -from typing import Any, Coroutine, Dict, List, Literal, Optional, Tuple, Union, Callable +from typing import Any, Callable, Coroutine, Dict, List, Literal, Optional, Tuple, Union import ccxt import ccxt.async_support as ccxt_async @@ -19,14 +19,15 @@ from ccxt import TICK_SIZE from dateutil import parser from pandas import DataFrame, concat -from freqtrade.constants import (DEFAULT_TRADES_COLUMNS, DEFAULT_AMOUNT_RESERVE_PERCENT, NON_OPEN_EXCHANGE_STATES, BidAsk, - BuySell, Config, EntryExit, ExchangeConfig, - ListPairsWithTimeframes, MakerTaker, OBLiteral, PairWithTimeframe) - -from freqtrade.data.converter import clean_duplicate_trades, clean_ohlcv_dataframe, ohlcv_to_dataframe, trades_dict_to_list, public_trades_to_dataframe +from freqtrade.constants import (DEFAULT_AMOUNT_RESERVE_PERCENT, DEFAULT_TRADES_COLUMNS, + NON_OPEN_EXCHANGE_STATES, BidAsk, BuySell, Config, EntryExit, + ExchangeConfig, ListPairsWithTimeframes, MakerTaker, OBLiteral, + PairWithTimeframe) +from freqtrade.data.converter import (clean_duplicate_trades, clean_ohlcv_dataframe, + ohlcv_to_dataframe, public_trades_to_dataframe, + trades_dict_to_list) from freqtrade.data.converter.converter import _calculate_ohlcv_candle_start_and_end from freqtrade.enums import OPTIMIZE_MODES, CandleType, MarginMode, PriceType, RunMode, TradingMode - from freqtrade.exceptions import (DDosProtection, ExchangeError, InsufficientFundsError, InvalidOrderException, OperationalException, PricingError, RetryableOrderError, TemporaryError) diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index d49b49bdc..28ca8bef1 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -10,12 +10,13 @@ from typing import Dict, List, Optional, Tuple, Union from pandas import DataFrame from freqtrade.constants import CUSTOM_TAG_MAX_LENGTH, Config, IntOrInf, ListPairsWithTimeframes +from freqtrade.data import converter from freqtrade.data.dataprovider import DataProvider 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, timeframe_to_msecs -from freqtrade.data import converter +from freqtrade.exchange import (timeframe_to_minutes, timeframe_to_msecs, 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 diff --git a/tests/data/test_converter_public_trades.py b/tests/data/test_converter_public_trades.py index d0eb75b52..858eeb0fa 100644 --- a/tests/data/test_converter_public_trades.py +++ b/tests/data/test_converter_public_trades.py @@ -9,10 +9,8 @@ from pandas import DataFrame from freqtrade.configuration import Configuration from freqtrade.constants import DEFAULT_ORDERFLOW_COLUMNS -from freqtrade.data.converter import ( - populate_dataframe_with_trades, public_trades_to_dataframe) -from freqtrade.data.converter.converter import ( - trades_to_volumeprofile_with_total_delta_bid_ask) +from freqtrade.data.converter import populate_dataframe_with_trades, public_trades_to_dataframe +from freqtrade.data.converter.converter import trades_to_volumeprofile_with_total_delta_bid_ask from freqtrade.enums import CandleType, MarginMode, TradingMode from freqtrade.exchange.exchange import timeframe_to_minutes