diff --git a/freqtrade/data/converter.py b/freqtrade/data/converter.py index 7abd0453f..90db82f74 100644 --- a/freqtrade/data/converter.py +++ b/freqtrade/data/converter.py @@ -174,9 +174,10 @@ def trades_to_ohlcv(trades: List, timeframe: str) -> DataFrame: """ from freqtrade.exchange import timeframe_to_minutes timeframe_minutes = timeframe_to_minutes(timeframe) - df = pd.DataFrame(trades) - df['datetime'] = pd.to_datetime(df['datetime']) - df = df.set_index('datetime') + df = pd.DataFrame(trades, columns=DEFAULT_TRADES_COLUMNS) + df['timestamp'] = pd.to_datetime(df['timestamp'], unit='ms', + utc=True,) + df = df.set_index('timestamp') df_new = df['price'].resample(f'{timeframe_minutes}min').ohlc() df_new['volume'] = df['amount'].resample(f'{timeframe_minutes}min').sum() diff --git a/freqtrade/data/history/history_utils.py b/freqtrade/data/history/history_utils.py index 86d90f8aa..a7490f17b 100644 --- a/freqtrade/data/history/history_utils.py +++ b/freqtrade/data/history/history_utils.py @@ -264,7 +264,11 @@ def _download_trades_history(exchange: Exchange, # TradesList columns are defined in constants.DEFAULT_TRADES_COLUMNS # DEFAULT_TRADES_COLUMNS: 0 -> timestamp # DEFAULT_TRADES_COLUMNS: 1 -> id + from_id = trades[-1][1] if trades else None + if trades and since < trades[-1][0]: + # Reset since to the last available point + since = trades[-1][0] logger.debug("Current Start: %s", trades[0][0] if trades else 'None') logger.debug("Current End: %s", trades[-1][0] if trades else 'None') diff --git a/freqtrade/data/history/jsondatahandler.py b/freqtrade/data/history/jsondatahandler.py index d4aa21a1d..50a32603b 100644 --- a/freqtrade/data/history/jsondatahandler.py +++ b/freqtrade/data/history/jsondatahandler.py @@ -9,7 +9,7 @@ from pandas import DataFrame, read_json, to_datetime from freqtrade import misc from freqtrade.configuration import TimeRange from freqtrade.constants import DEFAULT_DATAFRAME_COLUMNS -from freqtrade.converter import trades_dict_to_list +from freqtrade.data.converter import trades_dict_to_list from .idatahandler import IDataHandler, TradeList