How to use the backtesting.backtesting.Backtesting 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 / backtesting_util.py View on Github external
get_logger(f"fail to stop force exit for exchange {exchange_inst.get_name()}")

    if not bot.get_symbols_tasks_manager():
        raise RuntimeError(f"No candles data for the current configuration. Please ensure the required data files for "
                           f"the activated symbol(s) are available. Symbol(s): {list(bot.get_symbols_list())}")

    if watcher is not None:
        bot.set_watcher(watcher)

    if in_thread:
        await start_bot(bot, True)
        return True
    else:
        await start_bot(bot)
        trader = next(iter(bot.get_exchange_trader_simulators().values()))
        return await Backtesting.get_profitability(trader)
github Drakkar-Software / OctoBot / trading / exchanges / exchange_simulator / exchange_simulator.py View on Github external
self.time_frames_offset = {}
        self.min_time_frame_to_consider = {}
        self.min_time_frames_offset = None

        self.DEFAULT_LIMIT = 100
        self.MIN_LIMIT = 30

        # used to force price movement
        self.recent_trades_multiplier_factor = 1

        self.MIN_ENABLED_TIME_FRAME = TimeFrameManager.find_min_time_frame(self.config_time_frames)
        self.DEFAULT_TIME_FRAME_RECENT_TRADE_CREATOR = self.MIN_ENABLED_TIME_FRAME
        self.DEFAULT_TIME_FRAME_TICKERS_CREATOR = self.MIN_ENABLED_TIME_FRAME
        self.RECENT_TRADES_TO_CREATE = max(SIMULATOR_LAST_PRICES_TO_CHECK, ORDER_CREATION_LAST_TRADES_TO_USE)

        self.backtesting = Backtesting(self.config, self)
        self._prepare()
        self.initializing = False