stable/freqtrade
creslin ba31c809cb
avoid list index out of range in trim_tickerlist
trim_tickerlist is called from load_datafile. 
 trim_tickerlist will throw an index out of range error when parsing a json file for a timerange outside its contents.
This patch to load_datafile checks the timerange is in the file or not handles the exception as:
 - first time hit: 
---- Return None existing code will try to download file/timerange from exchange
 - second time hit: 
---- Log that the exchange does not have the timerange requested 
---- Bypass trim_tickerlist function to avoid triggering the index out of range function 

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 14:08:04,680 - freqtrade.optimize - INFO - Start timerange not in cached data
2018-05-31 14:08:04,680 - freqtrade.optimize - INFO - Download the pair: "ZEN/BTC", Interval: 5m
dumping json to "/Users/creslin/PycharmProjects/freqtrade/freqtrade/tests/testdata/ZEN_BTC-5m.json"
2018-05-31 14:08:08,225 - freqtrade.optimize - INFO - Start timerange unavailable from exchange
"""
2018-05-31 14:33:22 +03:00
..
exchange Reduce verbosity of get_ticker_history 2018-05-12 20:15:59 +02:00
optimize avoid list index out of range in trim_tickerlist 2018-05-31 14:33:22 +03:00
rpc Make telegram message beautiful 2018-05-15 13:37:34 +03:00
strategy Merge branch 'develop' into feat/objectify-ccxt 2018-05-02 22:49:55 +02:00
tests Add test for invalid order_fee dict 2018-05-15 20:13:43 +02:00
vendor add missing import 2017-11-20 22:26:32 +01:00
__init__.py Freqtrade: ccxt release shall be called 0.17.0 2018-05-12 09:57:10 +03:00
analyze.py Merge branch 'develop' into feat/objectify-ccxt 2018-05-02 22:49:55 +02:00
arguments.py Make plot_dataframe able to show trades stored in database. (#692) 2018-05-19 09:14:42 +03:00
configuration.py Merge branch 'develop' into feat/objectify-ccxt 2018-05-02 22:49:55 +02:00
constants.py Add USDT to the list of fiat currencies 2018-05-30 10:42:51 +03:00
fiat_convert.py Fix coinmarketcap ticker 2018-05-13 20:00:38 +02:00
freqtradebot.py Fix bug pointed out in #679 2018-05-15 19:49:28 +02:00
indicator_helpers.py indicator_helpers: apply correct typehints 2018-03-20 19:48:03 +01:00
main.py use native python logger 2018-04-21 20:47:06 +02:00
misc.py exchange: extract ccxt init to its own function (so that we can init ccxt from the scripts) 2018-04-22 10:57:48 +03:00
persistence.py Convert exchange-name to new format 2018-05-12 13:39:16 +02:00
state.py Add a Enum class State that contains Bot running states 2018-03-03 09:33:54 +08:00