def __init__(self, symbol, outfile, input_files): self.pending = [] self.totalTicks = 0 self.outfile = open(outfile, 'w+') for filename in input_files: logging.info("Processing '%s'" % (filename,)) data = CSVProvider(Symbol.get(symbol), filename) data.start_publishing(self.tick_handler) self.outfile.close()
def __init__(self, symbol, user, database, host, input_files): self.pending = [] self.totalTicks = 0 self._db_connection = connector.connect(user=user, database=database, host=host) self.cursor = self._db_connection.cursor(buffered=True) self.cursor.execute("SET unique_checks=0;") self.cursor.execute("SET autocommit=0;") for filename in input_files: logging.info("Processing '%s'" % (filename,)) data = CSVProvider(Symbol.get(symbol), filename) data.start_publishing(self.tick_handler) self._db_connection.commit() self.cursor.execute("SET unique_checks=1;") self.cursor.close() self._db_connection.close()
def __init__(self, symbol, user, database, host, input_files): self.pending = [] self.totalTicks = 0 self._db_connection = connector.connect(user=user, database=database, host=host) self.cursor = self._db_connection.cursor(buffered=True) self.cursor.execute("SET unique_checks=0;") self.cursor.execute("SET autocommit=0;") for filename in input_files: logging.info("Processing '%s'" % (filename, )) data = CSVProvider(Symbol.get(symbol), filename) data.start_publishing(self.tick_handler) self._db_connection.commit() self.cursor.execute("SET unique_checks=1;") self.cursor.close() self._db_connection.close()
def __init__(self, symbol, out_file, input_files): self.pending = [] self.totalTicks = 0 self.conn = sqlite3.connect(out_file) self.cursor = self.conn.cursor() self.cursor.execute("PRAGMA synchronous = OFF") self.cursor.execute("PRAGMA journal_mode = OFF") self.cursor.execute("CREATE TABLE IF NOT EXISTS tick_data(" "symbol varchar(64) NOT NULL," "timestamp timestamp NOT NULL," "bid NUMBER NOT NULL," "offer NUMBER NOT NULL)") self.cursor.execute("CREATE INDEX tick_data_timestamp_idx ON tick_data(timestamp)") for filename in input_files: logging.info("Processing '%s'" % (filename,)) data = CSVProvider(Symbol.get(symbol), filename) data.start_publishing(self.tickHandler)