def _create_symbol_threads_managers(self, exchange, symbol_evaluator): if Backtesting.enabled(self.config): real_time_ta_eval_list = [] else: # Create real time TA evaluators real_time_ta_eval_list = EvaluatorCreator.create_real_time_ta_evals( self.config, exchange, symbol_evaluator.get_symbol(), self.relevant_evaluators) symbol_time_frame_updater_thread = SymbolTimeFramesDataUpdaterThread() for time_frame in self.time_frames: if exchange.get_exchange_manager().time_frame_exists( time_frame.value, symbol_evaluator.get_symbol()): self.symbol_threads_manager[ time_frame] = EvaluatorThreadsManager( self.config, time_frame, symbol_time_frame_updater_thread, symbol_evaluator, exchange, self.exchange_trading_modes[exchange.get_name()], real_time_ta_eval_list, self.relevant_evaluators) else: self.logger.warning( f"{exchange.get_name()} exchange is not supporting the required time frame: " f"'{time_frame.value}' for {symbol_evaluator.get_symbol()}." ) self.symbol_time_frame_updater_threads.append( symbol_time_frame_updater_thread)
def _get_tools(): symbol = "BTC/USDT" exchange_traders = {} exchange_traders2 = {} config = load_test_config() time_frame = TimeFrames.ONE_HOUR AdvancedManager.create_class_list(config) symbol_time_frame_updater_thread = SymbolTimeFramesDataUpdaterThread() exchange_manager = ExchangeManager(config, ccxt.binance, is_simulated=True) exchange_inst = exchange_manager.get_exchange() trader_inst = TraderSimulator(config, exchange_inst, 0.3) trader_inst.stop_order_manager() trader_inst2 = TraderSimulator(config, exchange_inst, 0.3) trader_inst2.stop_order_manager() crypto_currency_evaluator = CryptocurrencyEvaluator(config, "Bitcoin", []) symbol_evaluator = SymbolEvaluator(config, symbol, crypto_currency_evaluator) exchange_traders[exchange_inst.get_name()] = trader_inst exchange_traders2[exchange_inst.get_name()] = trader_inst2 symbol_evaluator.set_trader_simulators(exchange_traders) symbol_evaluator.set_traders(exchange_traders2) symbol_evaluator.strategies_eval_lists[exchange_inst.get_name( )] = EvaluatorCreator.create_strategies_eval_list(config) evaluator_thread_manager = EvaluatorThreadsManager( config, time_frame, symbol_time_frame_updater_thread, symbol_evaluator, exchange_inst, []) trader_inst.portfolio.portfolio["USDT"] = { Portfolio.TOTAL: 2000, Portfolio.AVAILABLE: 2000 } symbol_evaluator.add_evaluator_thread_manager(exchange_inst, time_frame, evaluator_thread_manager) return symbol_evaluator, exchange_inst, time_frame, evaluator_thread_manager
def create_symbol_threads_managers(self, symbol, exchange, symbol_evaluator): # Create real time TA evaluators real_time_ta_eval_list = EvaluatorCreator.create_real_time_ta_evals( self.config, exchange, symbol) for time_frame in self.time_frames: if exchange.time_frame_exists(time_frame.value): self.symbols_threads_manager.append( EvaluatorThreadsManager(self.config, symbol, time_frame, symbol_evaluator, exchange, real_time_ta_eval_list))
def _create_symbol_threads_managers(self, symbol, exchange, symbol_evaluator): # Create real time TA evaluators real_time_ta_eval_list = EvaluatorCreator.create_real_time_ta_evals( self.config, exchange, symbol) symbol_time_frame_updater_thread = SymbolTimeFramesDataUpdaterThread() for time_frame in self.time_frames: if exchange.time_frame_exists(time_frame.value): self.symbol_threads_manager[ time_frame] = EvaluatorThreadsManager( self.config, symbol, time_frame, symbol_time_frame_updater_thread, symbol_evaluator, exchange, real_time_ta_eval_list) self.symbol_time_frame_updater_threads.append( symbol_time_frame_updater_thread)
def _get_tools(): config = load_test_config() symbol = "BTC/USDT" exchange_traders = {} exchange_traders2 = {} time_frame = TimeFrames.FIVE_MINUTES AdvancedManager.create_class_list(config) symbol_time_frame_updater_thread = SymbolTimeFramesDataUpdaterThread() exchange_manager = ExchangeManager(config, ccxt.binance, is_simulated=True) exchange_inst = exchange_manager.get_exchange() trader_inst = TraderSimulator(config, exchange_inst, 0.3) trader_inst.stop_order_manager() trader_inst2 = TraderSimulator(config, exchange_inst, 0.3) trader_inst2.stop_order_manager() trader_inst2.set_enabled(False) trader_inst.portfolio.portfolio["SUB"] = { Portfolio.TOTAL: 0.000000000000000000005, Portfolio.AVAILABLE: 0.000000000000000000005 } trader_inst.portfolio.portfolio["BNB"] = { Portfolio.TOTAL: 0.000000000000000000005, Portfolio.AVAILABLE: 0.000000000000000000005 } trader_inst.portfolio.portfolio["USDT"] = { Portfolio.TOTAL: 2000, Portfolio.AVAILABLE: 2000 } crypto_currency_evaluator = CryptocurrencyEvaluator(config, "Bitcoin", []) symbol_evaluator = SymbolEvaluator(config, symbol, crypto_currency_evaluator) exchange_traders[exchange_inst.get_name()] = trader_inst exchange_traders2[exchange_inst.get_name()] = trader_inst2 symbol_evaluator.set_trader_simulators(exchange_traders) symbol_evaluator.set_traders(exchange_traders2) trading_mode_inst = OctoBot.get_trading_mode_class(config)(config, exchange_inst) _ = EvaluatorThreadsManager(config, time_frame, symbol_time_frame_updater_thread, symbol_evaluator, exchange_inst, trading_mode_inst, []) trading_mode = HighFrequencyMode(config, exchange_inst) trading_mode.add_symbol_evaluator(symbol_evaluator) return config, exchange_inst, trader_inst, symbol, trading_mode