fix: using whole data instead of timerange

This commit is contained in:
Joe Schr 2021-04-08 18:45:15 +02:00
parent 588c221df0
commit 1e3af792ac

View File

@ -132,13 +132,12 @@ def trim_dataframe(df: DataFrame, timerange, df_date_col: str = 'date',
:param startup_candles: When not 0, is used instead the timerange start date :param startup_candles: When not 0, is used instead the timerange start date
:return: trimmed dataframe :return: trimmed dataframe
""" """
if timerange.starttype == 'date':
start = datetime.fromtimestamp(timerange.startts, tz=timezone.utc)
df = df.loc[df[df_date_col] >= start, :]
if startup_candles: if startup_candles:
# Trim candles instead of timeframe in case of given startup_candle count # Trim candles instead of timeframe in case of given startup_candle count
df = df.iloc[startup_candles:, :] df = df.iloc[startup_candles:, :]
else:
if timerange.starttype == 'date':
start = datetime.fromtimestamp(timerange.startts, tz=timezone.utc)
df = df.loc[df[df_date_col] >= start, :]
if timerange.stoptype == 'date': if timerange.stoptype == 'date':
stop = datetime.fromtimestamp(timerange.stopts, tz=timezone.utc) stop = datetime.fromtimestamp(timerange.stopts, tz=timezone.utc)
df = df.loc[df[df_date_col] <= stop, :] df = df.loc[df[df_date_col] <= stop, :]