Пример #1
0
    def create_exchange_data_collectors(self):
        available_exchanges = ccxt.exchanges
        for exchange_class_string in self.config[CONFIG_EXCHANGES]:
            if exchange_class_string in available_exchanges:
                exchange_type = getattr(ccxt, exchange_class_string)

                exchange_manager = ExchangeManager(self.config,
                                                   exchange_type,
                                                   is_simulated=False,
                                                   rest_only=True)
                exchange_inst = exchange_manager.get_exchange()

                exchange_data_collector = ExchangeDataCollector(
                    self.config, exchange_inst)

                if not exchange_data_collector.get_symbols(
                ) or not exchange_data_collector.time_frames:
                    self.logger.warning(
                        "{0} exchange not started (not enough symbols or timeframes)"
                        .format(exchange_class_string))
                else:
                    exchange_data_collector.start()
                    self.exchange_data_collectors_threads.append(
                        exchange_data_collector)
            else:
                self.logger.error(
                    "{0} exchange not found".format(exchange_class_string))
Пример #2
0
 def execute_with_specific_target(self, exchange, symbol):
     try:
         exchange_type = getattr(ccxt, exchange)
         exchange_manager = ExchangeManager(self.config, exchange_type, is_simulated=False, rest_only=True,
                                            ignore_config=True)
         exchange_inst = exchange_manager.get_exchange()
         exchange_data_collector = ExchangeDataCollector(self.config, exchange_inst, symbol)
         files = exchange_data_collector.load_available_data()
         return files[0]
     except Exception as e:
         self.logger.exception(e)
         raise e
Пример #3
0
    def _get_symbol_list(self):
        self.symbols = []
        self.data = {}
        symbols_appended = {}

        # parse files
        for file in self.config[CONFIG_BACKTESTING][
                CONFIG_BACKTESTING_DATA_FILES]:
            exchange_name, symbol, timestamp = ExchangeDataCollector.get_file_name(
                file)
            if exchange_name is not None and symbol is not None and timestamp is not None:

                # check if symbol data already in symbols
                # TODO check exchanges ?
                if symbol not in symbols_appended:
                    symbols_appended[symbol] = 0
                    if symbols_appended[symbol] < int(timestamp):
                        symbols_appended[symbol] = int(timestamp)
                        self.symbols.append(symbol)
                        data = DataCollectorParser.parse(file)
                        self.data[symbol] = self.fix_timestamps(data)