def test_multiple_multi_symbol_backtestings(): symbols = ["BTC/USDT", "NEO/BTC", "ICX/BTC", "VEN/BTC", "XRB/BTC"] config = create_backtesting_config(load_test_config(), symbols) bot = create_backtesting_bot(config) start_backtesting_bot(bot) for _ in range(MULTIPLE_BACKTESTINGS_ITERATIONS): config = create_backtesting_config(load_test_config(), symbols) bot = create_backtesting_bot(config) start_backtesting_bot(bot)
async def test_multiple_backtestings(): config = create_backtesting_config(load_test_config(), ["ICX/BTC"]) bot = create_backtesting_bot(config) previous_profitability, previous_market_profitability = await start_backtesting_bot(bot) for _ in range(MULTIPLE_BACKTESTINGS_ITERATIONS): config = create_backtesting_config(load_test_config(), ["ICX/BTC"]) bot = create_backtesting_bot(config) current_profitability, current_market_profitability = await start_backtesting_bot(bot) assert previous_profitability == current_profitability assert previous_market_profitability == current_market_profitability
async def test_multiple_multi_symbol_backtestings(): symbols = ["BTC/USDT", "NEO/BTC", "ICX/BTC", "VEN/BTC", "XRB/BTC"] config = create_backtesting_config(load_test_config(), symbols) bot = create_backtesting_bot(config) previous_profitability, previous_market_profitability = await start_backtesting_bot(bot) for _ in range(MULTIPLE_BACKTESTINGS_ITERATIONS): config = create_backtesting_config(load_test_config(), symbols) bot = create_backtesting_bot(config) current_profitability, current_market_profitability = await start_backtesting_bot(bot) assert previous_profitability == current_profitability assert previous_market_profitability == current_market_profitability
async def test_multi_symbol_backtesting(): config = create_backtesting_config(load_test_config(), ["ICX/BTC", "VEN/BTC", "XRB/BTC"]) bot = create_backtesting_bot(config) previous_profitability, previous_market_profitability = await start_backtesting_bot( bot) bot = create_backtesting_bot(config) current_profitability, current_market_profitability = await start_backtesting_bot( bot) # ensure no randomness in backtesting assert previous_profitability == current_profitability assert previous_market_profitability == current_market_profitability
def test_backtesting(): config = create_backtesting_config(["ICX/BTC"]) bot = create_backtesting_bot(config) previous_profitability, previous_market_profitability = start_backtesting_bot( bot) config = create_backtesting_config(["ICX/BTC"]) bot = create_backtesting_bot(config) current_profitability, current_market_profitability = start_backtesting_bot( bot) # ensure no randomness in backtesting assert previous_profitability == current_profitability assert previous_market_profitability == current_market_profitability
async def _run_backtesting_with_current_config(self, symbol, data_file_to_use=None): config_to_use = copy.deepcopy(self.config) config_to_use[CONFIG_BACKTESTING][ CONFIG_BACKTESTING_DATA_FILES] = copy.copy(DATA_FILES) # remove unused symbols symbols = {} for currency, details in copy.deepcopy(SYMBOLS).items(): if symbol in details[CONFIG_CRYPTO_PAIRS]: symbols[currency] = details config_to_use[CONFIG_CRYPTO_CURRENCIES] = symbols if data_file_to_use is not None: for index, datafile in enumerate(DATA_FILES): _, file_symbol, _, _ = interpret_file_name(datafile) if symbol == file_symbol: config_to_use[CONFIG_BACKTESTING][CONFIG_BACKTESTING_DATA_FILES][index] = \ DATA_FILE_PATH + data_file_to_use + DATA_FILE_EXT # do not activate web interface on standalone backtesting bot WebService.enable(config_to_use, False) filter_wanted_symbols(config_to_use, [symbol]) bot = create_backtesting_bot(config_to_use) # debug set to False to improve performances return await start_backtesting_bot(bot), bot
def _run_backtesting_with_current_config(self, symbol, data_file_to_use=None): config_to_use = copy.deepcopy(self.config) if data_file_to_use is not None: for index, datafile in enumerate(config_to_use[CONFIG_BACKTESTING][CONFIG_BACKTESTING_DATA_FILES]): _, file_symbol, _ = interpret_file_name(datafile) if symbol == file_symbol: config_to_use[CONFIG_BACKTESTING][CONFIG_BACKTESTING_DATA_FILES][index] = \ DATA_FILE_PATH + data_file_to_use + DATA_FILE_EXT # do not activate web interface on standalone backtesting bot WebService.enable(config_to_use, False) filter_wanted_symbols(config_to_use, [symbol]) bot = create_backtesting_bot(config_to_use) return start_backtesting_bot(bot), bot
def test_simple_backtesting(): config = create_backtesting_config(load_test_config(), ["ICX/BTC"]) bot = create_backtesting_bot(config) start_backtesting_bot(bot)
def test_multi_symbol_backtesting(): config = create_backtesting_config(["ICX/BTC", "VEN/BTC", "XRB/BTC"]) bot = create_backtesting_bot(config) start_backtesting_bot(bot)