There is a bug in trim_tickerlist, it will throw an index out of range exception and crash the programe if passed a start / stop date outside the range of those records in the cached json pair file.
This change calls a function that sanitizes the dates prior to calling trim_tickerlist.
trim_tickerlist throws an index out of range error when parsing a json file for a timerange outside its current contents.
This patch test for that condition and returns the the file as-is with a log warning to refresh-cache on fail
Here is an example of the error prior to path and after patching.
This is from binannce using the pair "ZEN/BTC" and timerange "20180522-20180523"
"""
File "/Users/creslin/PycharmProjects/freqtrade/freqtrade/optimize/__init__.py", line 107, in load_data
pairdata = load_tickerdata_file(datadir, pair, ticker_interval, timerange=timerange)
File "/Users/creslin/PycharmProjects/freqtrade/freqtrade/optimize/__init__.py", line 84, in load_tickerdata_file
pairdata = trim_tickerlist(pairdata, timerange)
File "/Users/creslin/PycharmProjects/freqtrade/freqtrade/optimize/__init__.py", line 36, in trim_tickerlist
while tickerlist[start_index][0] < start * 1000:
IndexError: list index out of range
""""
"""
2018-05-31 22:01:07,060 - freqtrade.configuration - INFO - Parameter --timerange detected: 20180522-20180523 ...
2018-05-31 22:01:07,060 - freqtrade.configuration - INFO - Parameter --datadir detected: freqtrade/tests/testdata ...
2018-05-31 22:01:13,168 - freqtrade.optimize - WARNING - start timerange for ZEN/BTC not in cache, to update cache use
2018-05-31 22:01:13,168 - freqtrade.optimize - INFO - --refresh-pairs-cached. *Nb The coin may be newer to the exchange
"""
* remove obsolete helper functions and make _state a public member.
* remove function assertions
* revert worker() changes
* Update pytest from 3.4.2 to 3.5.0
* Adapt exchange functions to ccxt API
Remove get_market_summaries and get_wallet_health, add exception handling
* Add NetworkException
* Change pair format in constants.py
* Add tests for exchange functions that comply with ccxt
* Remove bittrex tests
* Remove Bittrex and Interface classes
* Add retrier decorator
* Remove cache from get_ticker
* Remove unused and duplicate imports
* Add keyword arguments for get_fee
* Implement 'get_pair_detail_url'
* Change get_ticker_history format to ccxt format
* Fix exchange urls dict, don't need to initialize exchanges
* Add "Using Exchange ..." logging line