def test_download_pairs_exception(ticker_history, mocker, caplog) -> None: mocker.patch('freqtrade.optimize.__init__.get_ticker_history', return_value=ticker_history) mocker.patch('freqtrade.optimize.__init__.download_backtesting_testdata', side_effect=BaseException('File Error')) file1_1 = 'freqtrade/tests/testdata/BTC_MEME-1.json' file1_5 = 'freqtrade/tests/testdata/BTC_MEME-5.json' _backup_file(file1_1) _backup_file(file1_5) download_pairs(None, pairs=['BTC-MEME'], ticker_interval=1) # clean files freshly downloaded _clean_test_file(file1_1) _clean_test_file(file1_5) assert log_has('Failed to download the pair: "BTC-MEME", Interval: 1 min', caplog.record_tuples)
def test_download_pairs(default_conf, ticker_history, mocker): mocker.patch('freqtrade.optimize.__init__.get_ticker_history', return_value=ticker_history) mocker.patch.dict('freqtrade.main._CONF', default_conf) exchange._API = Bittrex({'key': '', 'secret': ''}) file1_1 = 'freqtrade/tests/testdata/BTC_MEME-1.json' file1_5 = 'freqtrade/tests/testdata/BTC_MEME-5.json' file2_1 = 'freqtrade/tests/testdata/BTC_CFI-1.json' file2_5 = 'freqtrade/tests/testdata/BTC_CFI-5.json' _backup_file(file1_1) _backup_file(file1_5) _backup_file(file2_1) _backup_file(file2_5) assert download_pairs(None, pairs=['BTC-MEME', 'BTC-CFI']) is True assert os.path.isfile(file1_1) is True assert os.path.isfile(file1_5) is True assert os.path.isfile(file2_1) is True assert os.path.isfile(file2_5) is True # clean files freshly downloaded _clean_test_file(file1_1) _clean_test_file(file1_5) _clean_test_file(file2_1) _clean_test_file(file2_5)
def test_download_pairs(ticker_history, mocker, default_conf) -> None: mocker.patch('freqtrade.exchange.Exchange.get_history', return_value=ticker_history) exchange = get_patched_exchange(mocker, default_conf) file1_1 = os.path.join(os.path.dirname(__file__), '..', 'testdata', 'MEME_BTC-1m.json') file1_5 = os.path.join(os.path.dirname(__file__), '..', 'testdata', 'MEME_BTC-5m.json') file2_1 = os.path.join(os.path.dirname(__file__), '..', 'testdata', 'CFI_BTC-1m.json') file2_5 = os.path.join(os.path.dirname(__file__), '..', 'testdata', 'CFI_BTC-5m.json') _backup_file(file1_1) _backup_file(file1_5) _backup_file(file2_1) _backup_file(file2_5) assert os.path.isfile(file1_1) is False assert os.path.isfile(file2_1) is False assert download_pairs( None, exchange, pairs=['MEME/BTC', 'CFI/BTC' ], ticker_interval='1m') is True assert os.path.isfile(file1_1) is True assert os.path.isfile(file2_1) is True # clean files freshly downloaded _clean_test_file(file1_1) _clean_test_file(file2_1) assert os.path.isfile(file1_5) is False assert os.path.isfile(file2_5) is False assert download_pairs( None, exchange, pairs=['MEME/BTC', 'CFI/BTC' ], ticker_interval='5m') is True assert os.path.isfile(file1_5) is True assert os.path.isfile(file2_5) is True # clean files freshly downloaded _clean_test_file(file1_5) _clean_test_file(file2_5)
def test_download_pairs_exception(default_conf, ticker_history, mocker, caplog): mocker.patch('freqtrade.optimize.__init__.get_ticker_history', return_value=ticker_history) mocker.patch('freqtrade.optimize.__init__.download_backtesting_testdata', side_effect=BaseException('File Error')) mocker.patch.dict('freqtrade.main._CONF', default_conf) exchange._API = Bittrex({'key': '', 'secret': ''}) file1_1 = 'freqtrade/tests/testdata/BTC_MEME-1.json' file1_5 = 'freqtrade/tests/testdata/BTC_MEME-5.json' _backup_file(file1_1) _backup_file(file1_5) download_pairs(None, pairs=['BTC-MEME']) # clean files freshly downloaded _clean_test_file(file1_1) _clean_test_file(file1_5) assert ('freqtrade.optimize.__init__', logging.INFO, 'Failed to download the pair: "BTC-MEME", Interval: 1 min' ) in caplog.record_tuples
def test_download_pairs_exception(ticker_history, mocker, caplog, default_conf) -> None: mocker.patch('freqtrade.exchange.Exchange.get_history', return_value=ticker_history) mocker.patch('freqtrade.optimize.__init__.download_backtesting_testdata', side_effect=BaseException('File Error')) exchange = get_patched_exchange(mocker, default_conf) file1_1 = os.path.join(os.path.dirname(__file__), '..', 'testdata', 'MEME_BTC-1m.json') file1_5 = os.path.join(os.path.dirname(__file__), '..', 'testdata', 'MEME_BTC-5m.json') _backup_file(file1_1) _backup_file(file1_5) download_pairs(None, exchange, pairs=['MEME/BTC'], ticker_interval='1m') # clean files freshly downloaded _clean_test_file(file1_1) _clean_test_file(file1_5) assert log_has('Failed to download the pair: "MEME/BTC", Interval: 1m', caplog.record_tuples)
def test_download_pairs(ticker_history, mocker) -> None: mocker.patch('freqtrade.optimize.__init__.get_ticker_history', return_value=ticker_history) file1_1 = 'freqtrade/tests/testdata/BTC_MEME-1.json' file1_5 = 'freqtrade/tests/testdata/BTC_MEME-5.json' file2_1 = 'freqtrade/tests/testdata/BTC_CFI-1.json' file2_5 = 'freqtrade/tests/testdata/BTC_CFI-5.json' _backup_file(file1_1) _backup_file(file1_5) _backup_file(file2_1) _backup_file(file2_5) assert os.path.isfile(file1_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 os.path.isfile(file1_1) is True assert os.path.isfile(file2_1) is True # clean files freshly downloaded _clean_test_file(file1_1) _clean_test_file(file2_1) assert os.path.isfile(file1_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 os.path.isfile(file1_5) is True assert os.path.isfile(file2_5) is True # clean files freshly downloaded _clean_test_file(file1_5) _clean_test_file(file2_5)