forked from danielktaylor/PyLimitBook
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathparse.py
More file actions
executable file
·31 lines (26 loc) · 791 Bytes
/
Copy pathparse.py
File metadata and controls
executable file
·31 lines (26 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/python
import sys
from book import Book
if __name__ == '__main__':
if len(sys.argv) != 2:
print "usage: %s input.csv" % sys.argv[0]
sys.exit(0)
try:
reader = open(sys.argv[1], 'r')
quotebook = Book()
for line in reader:
if line[0] == 'B':
quotebook.bid(line.rstrip())
elif line[0] == 'A':
quotebook.ask(line.rstrip())
else:
quotebook.trade(line.rstrip())
# Manual Debugging
print "\n"
print "Input: " + line
print quotebook
raw_input("Press enter to continue.")
reader.close()
except IOError:
print 'Cannot open input file "%s"' % sys.argv[1]
sys.exit(1)