Remove unnecessary default parameters

This commit is contained in:
Matthias 2021-12-07 20:30:58 +01:00
parent ac2fb08aea
commit dda7283f3e
5 changed files with 12 additions and 44 deletions

View File

@ -134,7 +134,7 @@ class DataProvider:
combination. combination.
Returns empty dataframe and Epoch 0 (1970-01-01) if no dataframe was cached. 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 pair_key in self.__cached_pairs:
if self.runmode in (RunMode.DRY_RUN, RunMode.LIVE): if self.runmode in (RunMode.DRY_RUN, RunMode.LIVE):
df, date = self.__cached_pairs[pair_key] df, date = self.__cached_pairs[pair_key]

View File

@ -44,12 +44,7 @@ class HDF5DataHandler(IDataHandler):
) for match in _tmp if match and len(match.groups()) > 1] ) for match in _tmp if match and len(match.groups()) > 1]
@classmethod @classmethod
def ohlcv_get_pairs( def ohlcv_get_pairs(cls, datadir: Path, timeframe: str, candle_type: CandleType) -> List[str]:
cls,
datadir: Path,
timeframe: str,
candle_type: CandleType
) -> List[str]:
""" """
Returns a list of all pairs with ohlcv data available in this datadir Returns a list of all pairs with ohlcv data available in this datadir
for the specified timeframe 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] return [cls.rebuild_pair_from_filename(match[0]) for match in _tmp if match]
def ohlcv_store( def ohlcv_store(
self, self, pair: str, timeframe: str, data: pd.DataFrame, candle_type: CandleType) -> None:
pair: str,
timeframe: str,
data: pd.DataFrame,
candle_type: CandleType = CandleType.SPOT_
) -> None:
""" """
Store data in hdf5 file. Store data in hdf5 file.
:param pair: Pair - used to generate filename :param pair: Pair - used to generate filename
@ -94,8 +84,7 @@ class HDF5DataHandler(IDataHandler):
) )
def _ohlcv_load(self, pair: str, timeframe: str, def _ohlcv_load(self, pair: str, timeframe: str,
timerange: Optional[TimeRange] = None, timerange: Optional[TimeRange], candle_type: CandleType
candle_type: CandleType = CandleType.SPOT_
) -> pd.DataFrame: ) -> pd.DataFrame:
""" """
Internal method used to load data for one pair from disk. Internal method used to load data for one pair from disk.

View File

@ -48,12 +48,7 @@ class IDataHandler(ABC):
""" """
@abstractclassmethod @abstractclassmethod
def ohlcv_get_pairs( def ohlcv_get_pairs(cls, datadir: Path, timeframe: str, candle_type: CandleType) -> List[str]:
cls,
datadir: Path,
timeframe: str,
candle_type: CandleType
) -> List[str]:
""" """
Returns a list of all pairs with ohlcv data available in this datadir Returns a list of all pairs with ohlcv data available in this datadir
for the specified timeframe for the specified timeframe
@ -65,12 +60,7 @@ class IDataHandler(ABC):
@abstractmethod @abstractmethod
def ohlcv_store( def ohlcv_store(
self, self, pair: str, timeframe: str, data: DataFrame, candle_type: CandleType) -> None:
pair: str,
timeframe: str,
data: DataFrame,
candle_type: CandleType = CandleType.SPOT_
) -> None:
""" """
Store ohlcv data. Store ohlcv data.
:param pair: Pair - used to generate filename :param pair: Pair - used to generate filename
@ -81,8 +71,8 @@ class IDataHandler(ABC):
""" """
@abstractmethod @abstractmethod
def _ohlcv_load(self, pair: str, timeframe: str, timerange: Optional[TimeRange] = None, def _ohlcv_load(self, pair: str, timeframe: str, timerange: Optional[TimeRange],
candle_type: CandleType = CandleType.SPOT_ candle_type: CandleType
) -> DataFrame: ) -> DataFrame:
""" """
Internal method used to load data for one pair from disk. Internal method used to load data for one pair from disk.

View File

@ -45,12 +45,7 @@ class JsonDataHandler(IDataHandler):
) for match in _tmp if match and len(match.groups()) > 1] ) for match in _tmp if match and len(match.groups()) > 1]
@classmethod @classmethod
def ohlcv_get_pairs( def ohlcv_get_pairs(cls, datadir: Path, timeframe: str, candle_type: CandleType) -> List[str]:
cls,
datadir: Path,
timeframe: str,
candle_type: CandleType
) -> List[str]:
""" """
Returns a list of all pairs with ohlcv data available in this datadir Returns a list of all pairs with ohlcv data available in this datadir
for the specified timeframe 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] return [cls.rebuild_pair_from_filename(match[0]) for match in _tmp if match]
def ohlcv_store( def ohlcv_store(
self, self, pair: str, timeframe: str, data: DataFrame, candle_type: CandleType) -> None:
pair: str,
timeframe: str,
data: DataFrame,
candle_type: CandleType = CandleType.SPOT_
) -> None:
""" """
Store data in json format "values". Store data in json format "values".
format looks as follows: format looks as follows:
@ -98,8 +88,7 @@ class JsonDataHandler(IDataHandler):
compression='gzip' if self._use_zip else None) compression='gzip' if self._use_zip else None)
def _ohlcv_load(self, pair: str, timeframe: str, def _ohlcv_load(self, pair: str, timeframe: str,
timerange: Optional[TimeRange] = None, timerange: Optional[TimeRange], candle_type: CandleType
candle_type: CandleType = CandleType.SPOT_
) -> DataFrame: ) -> DataFrame:
""" """
Internal method used to load data for one pair from disk. Internal method used to load data for one pair from disk.

View File

@ -922,7 +922,7 @@ def test_hdf5datahandler_ohlcv_load_and_resave(
tmpdir2 = tmpdir1 / 'futures' tmpdir2 = tmpdir1 / 'futures'
tmpdir2.mkdir() tmpdir2.mkdir()
dh = HDF5DataHandler(testdatadir) 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 isinstance(ohlcv, DataFrame)
assert len(ohlcv) > 0 assert len(ohlcv) > 0