Sample Question #245 (programming – general)
Imagine you have a text (ASCII) data file that contains one stock-date per line. Each line has the following information: stock ticker, trading date, close price, day’s volume, closing call price, and closing put price. (Assume that each stock in our universe can have at most one call and one put.) Note that the closing call price and put price can be both missing (i.e., a stock can never have only a call or only a put), in which case the last two fields are left blank.
In your favorite programming language, read this input file and create an output file that contains one stock per line with the following information per line:
stock ticker, average close price over all days, total volume for all days, average call price, average put price
Don’t worry about little details like how to read the file or which delimiter to use. I want to know how you process the information and create the output lines as requested.