Revert unnecessary formatting changes

This commit is contained in:
Matthias 2021-11-28 15:53:13 +01:00
parent c20157e64f
commit cb4efa6d56
4 changed files with 12 additions and 53 deletions

View File

@ -105,6 +105,8 @@ class DataProvider:
"""
Return pair candle (OHLCV) data, either live or cached historical -- depending
on the runmode.
Only combinations in the pairlist or which have been specified as informative pairs
will be available.
:param pair: pair to get the data for
:param timeframe: timeframe to get data for
:return: Dataframe for this pair
@ -120,23 +122,17 @@ class DataProvider:
logger.warning(f"No data found for ({pair}, {timeframe}, {candle_type}).")
return data
def get_analyzed_dataframe(
self,
pair: str,
timeframe: str,
candle_type: str = ''
) -> Tuple[DataFrame, datetime]:
def get_analyzed_dataframe(self, pair: str, timeframe: str) -> Tuple[DataFrame, datetime]:
"""
Retrieve the analyzed dataframe. Returns the full dataframe in trade mode (live / dry),
and the last 1000 candles (up to the time evaluated at this moment) in all other modes.
:param pair: pair to get the data for
:param timeframe: timeframe to get data for
:param candle_type: '', mark, index, premiumIndex, or funding_rate
:return: Tuple of (Analyzed Dataframe, lastrefreshed) for the requested pair / timeframe
combination.
Returns empty dataframe and Epoch 0 (1970-01-01) if no dataframe was cached.
"""
pair_key = (pair, timeframe, candle_type)
pair_key = (pair, timeframe, '')
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

@ -37,12 +37,7 @@ class HDF5DataHandler(IDataHandler):
if match and len(match.groups()) > 1]
@classmethod
def ohlcv_get_pairs(
cls,
datadir: Path,
timeframe: str,
candle_type: str = ''
) -> List[str]:
def ohlcv_get_pairs(cls, datadir: Path, timeframe: str, candle_type: str = '') -> List[str]:
"""
Returns a list of all pairs with ohlcv data available in this datadir
for the specified timeframe
@ -88,8 +83,7 @@ class HDF5DataHandler(IDataHandler):
ds.close()
def _ohlcv_load(self, pair: str, timeframe: str,
timerange: Optional[TimeRange] = None,
candle_type: str = '') -> pd.DataFrame:
timerange: Optional[TimeRange] = None, candle_type: str = '') -> pd.DataFrame:
"""
Internal method used to load data for one pair from disk.
Implements the loading and conversion to a Pandas dataframe.

View File

@ -38,12 +38,7 @@ class IDataHandler(ABC):
"""
@abstractclassmethod
def ohlcv_get_pairs(
cls,
datadir: Path,
timeframe: str,
candle_type: str = ''
) -> List[str]:
def ohlcv_get_pairs(cls, datadir: Path, timeframe: str, candle_type: str = '') -> List[str]:
"""
Returns a list of all pairs with ohlcv data available in this datadir
for the specified timeframe
@ -217,12 +212,7 @@ class IDataHandler(ABC):
if timerange_startup:
self._validate_pairdata(pair, pairdf, timerange_startup)
pairdf = trim_dataframe(pairdf, timerange_startup)
if self._check_empty_df(
pairdf,
pair,
timeframe,
warn_no_data
):
if self._check_empty_df(pairdf, pair, timeframe, warn_no_data):
return pairdf
# incomplete candles should only be dropped if we didn't trim the end beforehand.
@ -234,13 +224,7 @@ class IDataHandler(ABC):
self._check_empty_df(pairdf, pair, timeframe, warn_no_data)
return pairdf
def _check_empty_df(
self,
pairdf: DataFrame,
pair: str,
timeframe: str,
warn_no_data: bool
):
def _check_empty_df(self, pairdf: DataFrame, pair: str, timeframe: str, warn_no_data: bool):
"""
Warn on empty dataframe
"""
@ -253,12 +237,7 @@ class IDataHandler(ABC):
return True
return False
def _validate_pairdata(
self,
pair,
pairdata: DataFrame,
timerange: TimeRange
):
def _validate_pairdata(self, pair, pairdata: DataFrame, timerange: TimeRange):
"""
Validates pairdata for missing data at start end end and logs warnings.
:param pairdata: Dataframe to validate

View File

@ -37,12 +37,7 @@ class JsonDataHandler(IDataHandler):
if match and len(match.groups()) > 1]
@classmethod
def ohlcv_get_pairs(
cls,
datadir: Path,
timeframe: str,
candle_type: str = ''
) -> List[str]:
def ohlcv_get_pairs(cls, datadir: Path, timeframe: str, candle_type: str = '') -> List[str]:
"""
Returns a list of all pairs with ohlcv data available in this datadir
for the specified timeframe
@ -78,12 +73,7 @@ class JsonDataHandler(IDataHandler):
:param candle_type: '', mark, index, premiumIndex, or funding_rate
:return: None
"""
filename = self._pair_data_filename(
self._datadir,
pair,
timeframe,
candle_type
)
filename = self._pair_data_filename(self._datadir, pair, timeframe, candle_type)
_data = data.copy()
# Convert date to int
_data['date'] = _data['date'].view(np.int64) // 1000 // 1000