How to use the backtesting.abstract_backtesting_test.DATA_FILES function in Backtesting

To help you get started, we’ve selected a few Backtesting examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Drakkar-Software / OctoBot / backtesting / strategy_optimizer / strategy_test_suite.py View on Github external
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])
github Drakkar-Software / OctoBot / backtesting / strategy_optimizer / strategy_test_suite.py View on Github external
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