Skip to content

Commit

Permalink
Fix small bug and test
Browse files Browse the repository at this point in the history
  • Loading branch information
xmatthias committed Dec 28, 2019
1 parent c648d97 commit df085a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion freqtrade/data/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,12 @@ def _load_cached_data_for_updating(pair: str, timeframe: str, timerange: Optiona
timerange=None, fill_missing=False,
drop_incomplete=True, warn_no_data=False)
if not data.empty:
if start < data.iloc[0]['date']:
if start and start < data.iloc[0]['date']:
# Earlier data than existing data requested, redownload all
return DataFrame(columns=DEFAULT_DATAFRAME_COLUMNS), None

start = data.iloc[-1]['date']

start_ms = int(start.timestamp() * 1000) if start else None
return data, start_ms

Expand Down
4 changes: 3 additions & 1 deletion tests/data/test_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,9 @@ def test_download_pair_history2(mocker, default_conf, testdatadir) -> None:
[1509836520000, 0.00162008, 0.00162008, 0.00162008, 0.00162008, 108.14853839],
[1509836580000, 0.00161, 0.00161, 0.00161, 0.00161, 82.390199]
]
json_dump_mock = mocker.patch('freqtrade.misc.file_dump_json', return_value=None)
json_dump_mock = mocker.patch(
'freqtrade.data.datahandlers.jsondatahandler.JsonDataHandler.ohlcv_store',
return_value=None)
mocker.patch('freqtrade.exchange.Exchange.get_historic_ohlcv', return_value=tick)
exchange = get_patched_exchange(mocker, default_conf)
_download_pair_history(testdatadir, exchange, pair="UNITTEST/BTC", timeframe='1m')
Expand Down

0 comments on commit df085a6

Please sign in to comment.