Esempio n. 1
0
def main():
    import optparse
    parser = optparse.OptionParser(__doc__.strip())

    parser.add_option('-n',
                      action='store',
                      type='int',
                      default=20000,
                      help="Nb. of messages to report progress for")

    opts, args = parser.parse_args()
    if len(args) != 1:
        parser.args("You must specify some dumpfiles.")

    n, c = opts.n, 0
    t1 = time()
    for fn in args:
        dumpf = opendump(fn)
        decode, encode = dumpf.decode, dumpf.encode
        for msg in dumpf.rawiter():
            encode(*decode(msg))
            c += 1
            if c % n == 0:
                print '%.2f messages/sec' % (c / (time() - t1))
    t2 = time()
    print '%d secs' % (t2 - t1)
Esempio n. 2
0
def main():
    import optparse
    parser = optparse.OptionParser(__doc__.strip())
    opts, args = parser.parse_args()
    if len(args) != 1:
        parser.args("You must specify a dumpfile.")
    fn = args[0]

    dumpf = opendump(fn)
    lsum, lcount = 0, 0
    for ts_actual, timestamp, venue, symbol, bid, ask in dumpf:
        lsum += timestamp - ts_actual
        lcount += 1
        if lcount % 1000 == 0:
            print lsum / float(lcount * 1000)
            lsum, lcount = 0, 0
Esempio n. 3
0
def main():
    import optparse
    parser = optparse.OptionParser(__doc__.strip())
    opts, args = parser.parse_args()
    if len(args) != 1:
        parser.args("You must specify a dumpfile.")
    fn = args[0]

    dumpf = opendump(fn)
    lsum, lcount = 0, 0
    for ts_actual, timestamp, venue, symbol, bid, ask in dumpf:
        lsum += timestamp - ts_actual
        lcount += 1
        if lcount % 1000 == 0:
            print lsum / float(lcount * 1000)
            lsum, lcount = 0, 0
Esempio n. 4
0
def main():
    import optparse
    parser = optparse.OptionParser(__doc__.strip())

    parser.add_option('-n',  action='store', type='int', default=20000,
                      help="Nb. of messages to report progress for")

    opts, args = parser.parse_args()
    if len(args) != 1:
        parser.args("You must specify some dumpfiles.")

    n, c = opts.n, 0
    t1 = time()
    for fn in args:
        dumpf = opendump(fn)
        decode, encode = dumpf.decode, dumpf.encode
        for msg in dumpf.rawiter():
            encode(*decode(msg))
            c += 1
            if c % n == 0:
                print '%.2f messages/sec' % (c/(time() - t1))
    t2 = time()
    print '%d secs' % (t2 - t1)