def test_download_backtesting_testdata2(mocker) -> None: tick = [{'T': 'bar'}, {'T': 'foo'}] json_dump_mock = mocker.patch('freqtrade.misc.file_dump_json', return_value=None) mocker.patch('freqtrade.optimize.__init__.get_ticker_history', return_value=tick) download_backtesting_testdata(None, pair="BTC-UNITEST", interval=1) download_backtesting_testdata(None, pair="BTC-UNITEST", interval=3) assert json_dump_mock.call_count == 2
def test_download_backtesting_testdata(ticker_history, mocker, default_conf) -> None: mocker.patch('freqtrade.exchange.Exchange.get_history', return_value=ticker_history) exchange = get_patched_exchange(mocker, default_conf) # Download a 1 min ticker file file1 = os.path.join(os.path.dirname(__file__), '..', 'testdata', 'XEL_BTC-1m.json') _backup_file(file1) download_backtesting_testdata(None, exchange, pair="XEL/BTC", tick_interval='1m') assert os.path.isfile(file1) is True _clean_test_file(file1) # Download a 5 min ticker file file2 = os.path.join(os.path.dirname(__file__), '..', 'testdata', 'STORJ_BTC-5m.json') _backup_file(file2) download_backtesting_testdata(None, exchange, pair="STORJ/BTC", tick_interval='5m') assert os.path.isfile(file2) is True _clean_test_file(file2)
def test_download_backtesting_testdata(ticker_history, mocker) -> None: mocker.patch('freqtrade.optimize.__init__.get_ticker_history', return_value=ticker_history) # Download a 1 min ticker file file1 = 'freqtrade/tests/testdata/BTC_XEL-1.json' _backup_file(file1) download_backtesting_testdata(None, pair="BTC-XEL", interval=1) assert os.path.isfile(file1) is True _clean_test_file(file1) # Download a 5 min ticker file file2 = 'freqtrade/tests/testdata/BTC_STORJ-5.json' _backup_file(file2) download_backtesting_testdata(None, pair="BTC-STORJ", interval=5) assert os.path.isfile(file2) is True _clean_test_file(file2)
def test_download_backtesting_testdata2(mocker, default_conf) -> None: tick = [[ 1509836520000, 0.00162008, 0.00162008, 0.00162008, 0.00162008, 108.14853839 ], [1509836580000, 0.00161, 0.00161, 0.00161, 0.00161, 82.390199]] json_dump_mock = mocker.patch('freqtrade.misc.file_dump_json', return_value=None) mocker.patch('freqtrade.exchange.Exchange.get_history', return_value=tick) exchange = get_patched_exchange(mocker, default_conf) download_backtesting_testdata(None, exchange, pair="UNITTEST/BTC", tick_interval='1m') download_backtesting_testdata(None, exchange, pair="UNITTEST/BTC", tick_interval='3m') assert json_dump_mock.call_count == 2
def test_download_backtesting_testdata(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': ''}) # Download a 1 min ticker file file1 = 'freqtrade/tests/testdata/BTC_XEL-1.json' _backup_file(file1) download_backtesting_testdata(None, pair="BTC-XEL", interval=1) assert os.path.isfile(file1) is True _clean_test_file(file1) # Download a 5 min ticker file file2 = 'freqtrade/tests/testdata/BTC_STORJ-5.json' _backup_file(file2) download_backtesting_testdata(None, pair="BTC-STORJ", interval=5) assert os.path.isfile(file2) is True _clean_test_file(file2)