def test(testfiles):
    dataset = testfiles["data10000"]
    sqlite_db = "dataset10000.db"
    h5_db = "h510000.db"

    dc = DatasetConverter(dataset, sqlite_db)
    dc.convert()

    h5conv = DatasetDB2HDF5(sqlite_db, h5_db)
    h5conv.convert()

    db = DatasetDatabase(sqlite_db)
    db.connect()

    first_datetime = dt.datetime.strptime(db.get_first_datetime(None),
                                          DATE_FORMAT)
    last_datetime = dt.datetime.strptime(db.get_last_datetime(None),
                                         DATE_FORMAT)
    delta = last_datetime - first_datetime
    pnum = delta.days * 3600 * 24 + delta.seconds + 1

    db.disconnect()

    with h5py.File(h5_db, 'r') as f:
        for name in f.keys():
            assert f[name].len() == pnum
def test_converter(testfiles):
    dc = DatasetConverter(testfiles["data100"], "./test_database.db")
    dc.convert()

    db = DatasetDatabase("./test_database.db")
    db.connect()

    ts = db.get_time_series("Forex·EURSEK·NoExpiry")

    assert ts.fetchall() == [("07/08/2015", "00:05:12", "9.37086666666667", "1.0"),
                             ("07/08/2015", "00:05:13", "9.3714", "1.0"),
                             ("07/08/2015", "00:05:14", "9.3713", "1.0")
                             ]
    db.disconnect()
    os.remove("./test_database.db")
def test_converter(testfiles):
    dc = DatasetConverter(testfiles["data100"], "./test_database.db")
    dc.convert()

    db = DatasetDatabase("./test_database.db")
    db.connect()

    ts = db.get_time_series("Forex·EURSEK·NoExpiry")

    assert ts.fetchall() == [("07/08/2015", "00:05:12", "9.37086666666667",
                              "1.0"),
                             ("07/08/2015", "00:05:13", "9.3714", "1.0"),
                             ("07/08/2015", "00:05:14", "9.3713", "1.0")]
    db.disconnect()
    os.remove("./test_database.db")
def test(testfiles):
    dataset = testfiles["data10000"]
    sqlite_db = "dataset10000.db"
    h5_db = "h510000.db"

    dc = DatasetConverter(dataset, sqlite_db)
    dc.convert()

    h5conv = DatasetDB2HDF5(sqlite_db, h5_db)
    h5conv.convert()

    db = DatasetDatabase(sqlite_db)
    db.connect()

    first_datetime = dt.datetime.strptime(db.get_first_datetime(None), DATE_FORMAT)
    last_datetime = dt.datetime.strptime(db.get_last_datetime(None), DATE_FORMAT)
    delta = last_datetime - first_datetime
    pnum = delta.days * 3600 * 24 + delta.seconds + 1

    db.disconnect()

    with h5py.File(h5_db, 'r') as f:
        for name in f.keys():
            assert f[name].len() == pnum
def dataset2db(args):
    dc = DatasetConverter(args.dataset_file, args.database_file)
    dc.convert()
def dataset2db(args):
    dc = DatasetConverter(args.dataset_file, args.database_file)
    dc.convert()