Replace more old format 'BTC_XXX'
This commit is contained in:
parent
7be34310f5
commit
2582e85e6f
@ -33,6 +33,7 @@ def load_tickerdata_file(datadir, pair, ticker_interval, timerange=None):
|
|||||||
:return dict OR empty if unsuccesful
|
:return dict OR empty if unsuccesful
|
||||||
"""
|
"""
|
||||||
path = make_testdata_path(datadir)
|
path = make_testdata_path(datadir)
|
||||||
|
pair = pair.replace('/', '_')
|
||||||
file = '{abspath}/{pair}-{ticker_interval}.json'.format(
|
file = '{abspath}/{pair}-{ticker_interval}.json'.format(
|
||||||
abspath=path,
|
abspath=path,
|
||||||
pair=pair,
|
pair=pair,
|
||||||
@ -135,7 +136,7 @@ def download_backtesting_testdata(datadir: str, pair: str, interval: int = 5) ->
|
|||||||
interval=interval,
|
interval=interval,
|
||||||
))
|
))
|
||||||
|
|
||||||
filepair = pair.replace("-", "_")
|
filepair = pair.replace("/", "_")
|
||||||
filename = os.path.join(path, '{pair}-{interval}.json'.format(
|
filename = os.path.join(path, '{pair}-{interval}.json'.format(
|
||||||
pair=filepair,
|
pair=filepair,
|
||||||
interval=interval,
|
interval=interval,
|
||||||
|
@ -99,7 +99,7 @@ def test_load_data_with_new_pair_1min(default_conf, ticker_history, mocker, capl
|
|||||||
|
|
||||||
exchange._API = ccxt.binance({'key': '', 'secret': ''})
|
exchange._API = ccxt.binance({'key': '', 'secret': ''})
|
||||||
|
|
||||||
file = 'freqtrade/tests/testdata/MEME/BTC-1.json'
|
file = 'freqtrade/tests/testdata/MEME_BTC-1.json'
|
||||||
_backup_file(file)
|
_backup_file(file)
|
||||||
optimize.load_data(None, ticker_interval=1, pairs=['MEME/BTC'])
|
optimize.load_data(None, ticker_interval=1, pairs=['MEME/BTC'])
|
||||||
assert os.path.isfile(file) is True
|
assert os.path.isfile(file) is True
|
||||||
@ -131,7 +131,7 @@ def test_download_pairs(default_conf, ticker_history, mocker):
|
|||||||
assert os.path.isfile(file1_1) is False
|
assert os.path.isfile(file1_1) is False
|
||||||
assert os.path.isfile(file2_1) is False
|
assert os.path.isfile(file2_1) is False
|
||||||
|
|
||||||
assert download_pairs(None, pairs=['BTC-MEME', 'BTC-CFI'], ticker_interval=1) is True
|
assert download_pairs(None, pairs=['MEME/BTC', 'CFI/BTC'], ticker_interval=1) is True
|
||||||
|
|
||||||
assert os.path.isfile(file1_1) is True
|
assert os.path.isfile(file1_1) is True
|
||||||
assert os.path.isfile(file2_1) is True
|
assert os.path.isfile(file2_1) is True
|
||||||
@ -143,7 +143,7 @@ def test_download_pairs(default_conf, ticker_history, mocker):
|
|||||||
assert os.path.isfile(file1_5) is False
|
assert os.path.isfile(file1_5) is False
|
||||||
assert os.path.isfile(file2_5) is False
|
assert os.path.isfile(file2_5) is False
|
||||||
|
|
||||||
assert download_pairs(None, pairs=['BTC-MEME', 'BTC-CFI'], ticker_interval=5) is True
|
assert download_pairs(None, pairs=['MEME/BTC', 'CFI/BTC'], ticker_interval=5) is True
|
||||||
|
|
||||||
assert os.path.isfile(file1_5) is True
|
assert os.path.isfile(file1_5) is True
|
||||||
assert os.path.isfile(file2_5) is True
|
assert os.path.isfile(file2_5) is True
|
||||||
@ -165,13 +165,13 @@ def test_download_pairs_exception(default_conf, ticker_history, mocker, caplog):
|
|||||||
_backup_file(file1_1)
|
_backup_file(file1_1)
|
||||||
_backup_file(file1_5)
|
_backup_file(file1_5)
|
||||||
|
|
||||||
download_pairs(None, pairs=['BTC-MEME'], ticker_interval=1)
|
download_pairs(None, pairs=['MEME/BTC'], ticker_interval=1)
|
||||||
# clean files freshly downloaded
|
# clean files freshly downloaded
|
||||||
_clean_test_file(file1_1)
|
_clean_test_file(file1_1)
|
||||||
_clean_test_file(file1_5)
|
_clean_test_file(file1_5)
|
||||||
assert ('freqtrade.optimize.__init__',
|
assert ('freqtrade.optimize.__init__',
|
||||||
logging.INFO,
|
logging.INFO,
|
||||||
'Failed to download the pair: "BTC-MEME", Interval: 1 min') in caplog.record_tuples
|
'Failed to download the pair: "MEME/BTC", Interval: 1 min') in caplog.record_tuples
|
||||||
|
|
||||||
|
|
||||||
def test_download_backtesting_testdata(default_conf, ticker_history, mocker):
|
def test_download_backtesting_testdata(default_conf, ticker_history, mocker):
|
||||||
@ -182,15 +182,15 @@ def test_download_backtesting_testdata(default_conf, ticker_history, mocker):
|
|||||||
# Download a 1 min ticker file
|
# Download a 1 min ticker file
|
||||||
file1 = 'freqtrade/tests/testdata/XEL_BTC-1.json'
|
file1 = 'freqtrade/tests/testdata/XEL_BTC-1.json'
|
||||||
_backup_file(file1)
|
_backup_file(file1)
|
||||||
download_backtesting_testdata(None, pair="BTC-XEL", interval=1)
|
download_backtesting_testdata(None, pair="XEL/BTC", interval=1)
|
||||||
assert os.path.isfile(file1) is True
|
assert os.path.isfile(file1) is True
|
||||||
_clean_test_file(file1)
|
_clean_test_file(file1)
|
||||||
|
|
||||||
# Download a 5 min ticker file
|
# Download a 5 min ticker file
|
||||||
file2 = 'freqtrade/tests/testdata/BTC_STORJ-5.json'
|
file2 = 'freqtrade/tests/testdata/STORJ_BTC-5.json'
|
||||||
_backup_file(file2)
|
_backup_file(file2)
|
||||||
|
|
||||||
download_backtesting_testdata(None, pair="BTC-STORJ", interval=5)
|
download_backtesting_testdata(None, pair="STORJ/BTC", interval=5)
|
||||||
assert os.path.isfile(file2) is True
|
assert os.path.isfile(file2) is True
|
||||||
_clean_test_file(file2)
|
_clean_test_file(file2)
|
||||||
|
|
||||||
@ -199,8 +199,8 @@ def test_download_backtesting_testdata2(mocker):
|
|||||||
tick = [{'T': 'bar'}, {'T': 'foo'}]
|
tick = [{'T': 'bar'}, {'T': 'foo'}]
|
||||||
mocker.patch('freqtrade.misc.file_dump_json', return_value=None)
|
mocker.patch('freqtrade.misc.file_dump_json', return_value=None)
|
||||||
mocker.patch('freqtrade.optimize.__init__.get_ticker_history', return_value=tick)
|
mocker.patch('freqtrade.optimize.__init__.get_ticker_history', return_value=tick)
|
||||||
assert download_backtesting_testdata(None, pair="BTC-UNITEST", interval=1)
|
assert download_backtesting_testdata(None, pair="UNITEST/BTC", interval=1)
|
||||||
assert download_backtesting_testdata(None, pair="BTC-UNITEST", interval=3)
|
assert download_backtesting_testdata(None, pair="UNITEST/BTC", interval=3)
|
||||||
|
|
||||||
|
|
||||||
def test_load_tickerdata_file():
|
def test_load_tickerdata_file():
|
||||||
|
@ -44,13 +44,13 @@ def test_returns_latest_buy_signal(mocker):
|
|||||||
'freqtrade.analyze.analyze_ticker',
|
'freqtrade.analyze.analyze_ticker',
|
||||||
return_value=DataFrame([{'buy': 1, 'sell': 0, 'date': arrow.utcnow()}])
|
return_value=DataFrame([{'buy': 1, 'sell': 0, 'date': arrow.utcnow()}])
|
||||||
)
|
)
|
||||||
assert get_signal('BTC-ETH', 5) == (True, False)
|
assert get_signal('ETH/BTC', 5) == (True, False)
|
||||||
|
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
'freqtrade.analyze.analyze_ticker',
|
'freqtrade.analyze.analyze_ticker',
|
||||||
return_value=DataFrame([{'buy': 0, 'sell': 1, 'date': arrow.utcnow()}])
|
return_value=DataFrame([{'buy': 0, 'sell': 1, 'date': arrow.utcnow()}])
|
||||||
)
|
)
|
||||||
assert get_signal('BTC-ETH', 5) == (False, True)
|
assert get_signal('ETH/BTC', 5) == (False, True)
|
||||||
|
|
||||||
|
|
||||||
def test_returns_latest_sell_signal(mocker):
|
def test_returns_latest_sell_signal(mocker):
|
||||||
@ -59,13 +59,13 @@ def test_returns_latest_sell_signal(mocker):
|
|||||||
'freqtrade.analyze.analyze_ticker',
|
'freqtrade.analyze.analyze_ticker',
|
||||||
return_value=DataFrame([{'sell': 1, 'buy': 0, 'date': arrow.utcnow()}])
|
return_value=DataFrame([{'sell': 1, 'buy': 0, 'date': arrow.utcnow()}])
|
||||||
)
|
)
|
||||||
assert get_signal('BTC-ETH', 5) == (False, True)
|
assert get_signal('ETH/BTC', 5) == (False, True)
|
||||||
|
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
'freqtrade.analyze.analyze_ticker',
|
'freqtrade.analyze.analyze_ticker',
|
||||||
return_value=DataFrame([{'sell': 0, 'buy': 1, 'date': arrow.utcnow()}])
|
return_value=DataFrame([{'sell': 0, 'buy': 1, 'date': arrow.utcnow()}])
|
||||||
)
|
)
|
||||||
assert get_signal('BTC-ETH', 5) == (True, False)
|
assert get_signal('ETH/BTC', 5) == (True, False)
|
||||||
|
|
||||||
|
|
||||||
def test_get_signal_empty(default_conf, mocker, caplog):
|
def test_get_signal_empty(default_conf, mocker, caplog):
|
||||||
@ -108,7 +108,7 @@ def test_get_signal_handles_exceptions(mocker):
|
|||||||
mocker.patch('freqtrade.analyze.analyze_ticker',
|
mocker.patch('freqtrade.analyze.analyze_ticker',
|
||||||
side_effect=Exception('invalid ticker history '))
|
side_effect=Exception('invalid ticker history '))
|
||||||
|
|
||||||
assert get_signal('BTC-ETH', 5) == (False, False)
|
assert get_signal('ETH/BTC', 5) == (False, False)
|
||||||
|
|
||||||
|
|
||||||
def test_parse_ticker_dataframe(ticker_history, ticker_history_without_bv):
|
def test_parse_ticker_dataframe(ticker_history, ticker_history_without_bv):
|
||||||
|
@ -161,7 +161,7 @@ def test_load_config(default_conf, mocker):
|
|||||||
|
|
||||||
def test_load_config_invalid_pair(default_conf, mocker):
|
def test_load_config_invalid_pair(default_conf, mocker):
|
||||||
conf = deepcopy(default_conf)
|
conf = deepcopy(default_conf)
|
||||||
conf['exchange']['pair_whitelist'].append('BTC-ETH')
|
conf['exchange']['pair_whitelist'].append('ETH/BTC')
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
'freqtrade.misc.open',
|
'freqtrade.misc.open',
|
||||||
mocker.mock_open(
|
mocker.mock_open(
|
||||||
|
Loading…
Reference in New Issue
Block a user