# You work at a low latency trading firm and are asked to deliver the order book data provided in order_book_data.txt to a superior
# The problem is that the data isn't formatted correctly. Please complete the following steps to apropriately format the data
1. Open order_book_data.tx
3. Get rid empty lines
4. Get rid of spaces
5. Notice that there are two currencies in the order book; USD and YEN. Please convert both the Bid and Ask price to USD
6. Create a header line ['Symbol,Date,Bid,Ask']
7. Save the header line and properly formatted lines to a comma seperated value file called mktDataFormat.csv
import csv
import rhinoscriptsyntax as rs
def CSVlist():
#prompt the user for a file to import
filter = "CSV file (*.csv)|*.csv|*.txt|All Files (*.*)|*.*||"
filename = rs.OpenFileName("Open Point File", filter)
if not filename: return
with open(filename) as csvfile:
reader = csv.reader(csvfile)
for row in reader:
x = float(row[0])
y = float(row[1])
z = float(row[2])
print x, y, z
rs.AddPoint(x,y,z)
if( __name__ == "__main__" ):
CSVlist()
Comments
Leave a comment