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
"""
USDT is common many exchanges and treated as a currency.
It is helpful to allow USDT to be accepted as a fiat current when testing config.json
By way of example of a usecase
A strategy or otherwise report may not query: config['stake_currency'] and currency = config['fiat_display_currency']
as the config.json with fail test, so cannot build a base/pair such as BTC/USDT that is valid will not be built cleanly.
Pulling BTC/USDT from config values can be useful to download query ticker file name and data, enumerating base/pair price to whitelist target pairs, performing correlation coefficient statistics etc.
As example: building a dataframe such as here
date BTC/USDT ETH/BTC XLM/BTC LTC/BTC
0 1517443200 10283.00 0.109475 0.000052 0.016031
The transposing to actual USDT ticker value row-wise per pair
date BTC/USDT ETH/USD XLM/USD LTC/USD
1517443200 10283.00 1125.731425 0.535950 164.846773
Correct instructions for calling a custom strategy file
To paraphrase the change:
Prior - to call a custom strategy -s the strategy file name within users_data/strategies/ directory
After - to call a custom strategy -s the class name within the strategy within users_data/strategies/ directory
Corrected instructions, to paraphrase the PR
prior - to call a custom strategy -s the custom strategy file name in user_data/strategies
after - to call a custom strategy -s the class name within the custom strategy file name in user_data/strategies
Before this commit, during setup, even a default value is displayed for some config, if user doesn't enter anything, an empty value is applied.
After this commit, if user doesn't enter anything for a config with default value, the default value will be applied.