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.
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]

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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