https://code.kx.com/trac/wiki/QforMortals/tables
https://code.kx.com/trac/browser/kx/kdb%2B/sp.q

0. Run setup. q setup.q
1. (Easy) Import a table of stock prices in csv format (`trade.csv
as written during class)
and find the average price per stock and write that to a csv file
	q readavg.q

Volume weighted average is the average of the price times the amt of
a set of trades.

2. (Middle) Compute the volume weighted average price 
per stock
        q vwap.q


/ given a list  get the 2 way moving average
movavg2:{[x] (x[0]),raze avg each ((-1) _ x),'(1 _ x)}

3. (Hard) Compute the 2 moving average per stock. 
Hint: write your own function that takes a vector argument and produces
the 2 moving average.
Display the result and save it as a q file (it doesn't work
to save it to a csv file because it is not in first normal form).
	q readmovavg.q
4. (Middle) Generate a random table having 100,000 rows from
the stocks `ibm`hp`amaz`goog`aapl,
prices in the range 20 to 400,
and volumes in the range 100 to 100000 but multiples of 100,
times arbitrary in the range from 10 AM to 4 PM.
	q gendata.q
5. (Easy) Using the generated data from the previous
example, get the price column of the trade table.
	q gendata.q
6. (Middle) Generate a second table having the same schema as in 
the random table
and bulk insert it into the random table.
Then form columns corresponding to this schema, each of the same
length as the columns of the original random table. Bulk insert those columns.
Which is faster? Table insert or column insert? (Use \t).
	q bulkinsert.q
7. (Hard) Compute the correlation of the prices of every
pair of stocks. Each stock has the same number of values.
	q findcorr.q
8. (Middle) Add an address table that links the 
stocks `ibm`hp`amaz`goog`aapl with their addresses
and then find the address of all stocks whose average price is above 80.
Make the address table have stock as a key.
Note that the field referencing the table stock must be called stock.
 	q findgoodaddress.q
9. (Hard) Write a function that takes an arbitrary table,
an arbitrary target column expression, and an arbitrary
where clause and can apply to any table having those columns
and for which the where clause is appropriate.
Test it on trade.csv.
	q arbquery.q
10. Generate a random table as in problem 4 and then find the moving
average of price for each stock in time order.
Next, generate a timing test in which we first sort rantrade by time
10 times and then sort by time an already sorted table 10 times.
11. (Middle) Generate a random table as in problem 4 and then compute
correlations between every pair of stocks.
If they don't have the same length then truncate to the smaller size.
Try the correlation in parallel.
	q findcorrpar.q
12. (Middle) Communicate a set of read only requests to a master
asynchronously and then they are routed to slaves.
https://code.kx.com/trac/wiki/Cookbook/LoadBalancing
	q masterclient.q 
        q mserve.q -p 5001 3 slaveserver.q
13. (Middle) Web access.
Take  yahoo.q
(https://code.kx.com/svn/cookbook_code/yahoo.q)
and modify it to return only the Sym,Date,Close columns.
	q yahoomod.q

