From dda7283f3e88ab7fb7df22fe9ac9cdf58cb9317f Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 7 Dec 2021 20:30:58 +0100 Subject: [PATCH] Remove unnecessary default parameters --- freqtrade/data/dataprovider.py | 2 +- freqtrade/data/history/hdf5datahandler.py | 17 +++-------------- freqtrade/data/history/idatahandler.py | 18 ++++-------------- freqtrade/data/history/jsondatahandler.py | 17 +++-------------- tests/data/test_history.py | 2 +- 5 files changed, 12 insertions(+), 44 deletions(-) diff --git a/freqtrade/data/dataprovider.py b/freqtrade/data/dataprovider.py index 12b02f744..63f95ad0a 100644 --- a/freqtrade/data/dataprovider.py +++ b/freqtrade/data/dataprovider.py @@ -134,7 +134,7 @@ class DataProvider: combination. Returns empty dataframe and Epoch 0 (1970-01-01) if no dataframe was cached. """ - pair_key = (pair, timeframe, CandleType.SPOT) + pair_key = (pair, timeframe, CandleType.SPOT_) if pair_key in self.__cached_pairs: if self.runmode in (RunMode.DRY_RUN, RunMode.LIVE): df, date = self.__cached_pairs[pair_key] diff --git a/freqtrade/data/history/hdf5datahandler.py b/freqtrade/data/history/hdf5datahandler.py index 73b8aedba..b735a19f1 100644 --- a/freqtrade/data/history/hdf5datahandler.py +++ b/freqtrade/data/history/hdf5datahandler.py @@ -44,12 +44,7 @@ class HDF5DataHandler(IDataHandler): ) for match in _tmp if match and len(match.groups()) > 1] @classmethod - def ohlcv_get_pairs( - cls, - datadir: Path, - timeframe: str, - candle_type: CandleType - ) -> List[str]: + def ohlcv_get_pairs(cls, datadir: Path, timeframe: str, candle_type: CandleType) -> List[str]: """ Returns a list of all pairs with ohlcv data available in this datadir for the specified timeframe @@ -69,12 +64,7 @@ class HDF5DataHandler(IDataHandler): return [cls.rebuild_pair_from_filename(match[0]) for match in _tmp if match] def ohlcv_store( - self, - pair: str, - timeframe: str, - data: pd.DataFrame, - candle_type: CandleType = CandleType.SPOT_ - ) -> None: + self, pair: str, timeframe: str, data: pd.DataFrame, candle_type: CandleType) -> None: """ Store data in hdf5 file. :param pair: Pair - used to generate filename @@ -94,8 +84,7 @@ class HDF5DataHandler(IDataHandler): ) def _ohlcv_load(self, pair: str, timeframe: str, - timerange: Optional[TimeRange] = None, - candle_type: CandleType = CandleType.SPOT_ + timerange: Optional[TimeRange], candle_type: CandleType ) -> pd.DataFrame: """ Internal method used to load data for one pair from disk. diff --git a/freqtrade/data/history/idatahandler.py b/freqtrade/data/history/idatahandler.py index 59a4bc5e4..a65bdd65e 100644 --- a/freqtrade/data/history/idatahandler.py +++ b/freqtrade/data/history/idatahandler.py @@ -48,12 +48,7 @@ class IDataHandler(ABC): """ @abstractclassmethod - def ohlcv_get_pairs( - cls, - datadir: Path, - timeframe: str, - candle_type: CandleType - ) -> List[str]: + def ohlcv_get_pairs(cls, datadir: Path, timeframe: str, candle_type: CandleType) -> List[str]: """ Returns a list of all pairs with ohlcv data available in this datadir for the specified timeframe @@ -65,12 +60,7 @@ class IDataHandler(ABC): @abstractmethod def ohlcv_store( - self, - pair: str, - timeframe: str, - data: DataFrame, - candle_type: CandleType = CandleType.SPOT_ - ) -> None: + self, pair: str, timeframe: str, data: DataFrame, candle_type: CandleType) -> None: """ Store ohlcv data. :param pair: Pair - used to generate filename @@ -81,8 +71,8 @@ class IDataHandler(ABC): """ @abstractmethod - def _ohlcv_load(self, pair: str, timeframe: str, timerange: Optional[TimeRange] = None, - candle_type: CandleType = CandleType.SPOT_ + def _ohlcv_load(self, pair: str, timeframe: str, timerange: Optional[TimeRange], + candle_type: CandleType ) -> DataFrame: """ Internal method used to load data for one pair from disk. diff --git a/freqtrade/data/history/jsondatahandler.py b/freqtrade/data/history/jsondatahandler.py index f329d4879..afaa89f0f 100644 --- a/freqtrade/data/history/jsondatahandler.py +++ b/freqtrade/data/history/jsondatahandler.py @@ -45,12 +45,7 @@ class JsonDataHandler(IDataHandler): ) for match in _tmp if match and len(match.groups()) > 1] @classmethod - def ohlcv_get_pairs( - cls, - datadir: Path, - timeframe: str, - candle_type: CandleType - ) -> List[str]: + def ohlcv_get_pairs(cls, datadir: Path, timeframe: str, candle_type: CandleType) -> List[str]: """ Returns a list of all pairs with ohlcv data available in this datadir for the specified timeframe @@ -70,12 +65,7 @@ class JsonDataHandler(IDataHandler): return [cls.rebuild_pair_from_filename(match[0]) for match in _tmp if match] def ohlcv_store( - self, - pair: str, - timeframe: str, - data: DataFrame, - candle_type: CandleType = CandleType.SPOT_ - ) -> None: + self, pair: str, timeframe: str, data: DataFrame, candle_type: CandleType) -> None: """ Store data in json format "values". format looks as follows: @@ -98,8 +88,7 @@ class JsonDataHandler(IDataHandler): compression='gzip' if self._use_zip else None) def _ohlcv_load(self, pair: str, timeframe: str, - timerange: Optional[TimeRange] = None, - candle_type: CandleType = CandleType.SPOT_ + timerange: Optional[TimeRange], candle_type: CandleType ) -> DataFrame: """ Internal method used to load data for one pair from disk. diff --git a/tests/data/test_history.py b/tests/data/test_history.py index 89b02f295..138f62a6a 100644 --- a/tests/data/test_history.py +++ b/tests/data/test_history.py @@ -922,7 +922,7 @@ def test_hdf5datahandler_ohlcv_load_and_resave( tmpdir2 = tmpdir1 / 'futures' tmpdir2.mkdir() dh = HDF5DataHandler(testdatadir) - ohlcv = dh._ohlcv_load(pair, timeframe, candle_type=candle_type) + ohlcv = dh._ohlcv_load(pair, timeframe, None, candle_type=candle_type) assert isinstance(ohlcv, DataFrame) assert len(ohlcv) > 0