Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Math 5440: Week 5 Assignment

Due Date: February 24, 2023 at 10am

Exercise          Computing Impact States for a Given Date

Load the binned stock data using

\ l   pa th To Hdb Fo ld er \ columbiaHdb

Load in memory the table for the date 2019.01.03.

1.  For a given halflife h, trade vector, adv and vol, implement a function that returns the impact state vector.

One refers to the input and output types of a function as its signature. The signature of your impact function should be

computeImpact :   {[ trade ;   adv ;   vol ;   h ]    . . . }

where the function accepts both numeric atoms and vectors for trade, vol,  and adv.   It should only take numeric atoms for  h.   We say that the function is vectorized over trade, adv, and vol but not h. Vectorization circumvents the need for looping over values, speeding up computations and improving code readability.

2.  Let h = 1, 5, 30, 60 min be halflifes. Using the cross operator, create a table that duplicates each row for each halflife  h.   Therefore,  h becomes a column of your table, and your table should have four times as many rows as previously.

3.  For each halflife h and stock, compute the impact state vector across time. Be sure to scale the model using adv and vol.

4.  Let t = 1, 15, 60 min be prediction horizons. Using the cross opera- tor, create a table that duplicates each row for each prediction hori- zon. For each prediction horizon, compute the corresponding returns r = Pt+∆t/Pt − 1 and differences in impact states I = It+∆t − It . Alternatively, execute questions 4.  and 5.  for a given t and loop over ∆t if the cross table is too large to t in memory.

5.  For each stock, halflife, and prediction horizon, compute the covari- ance E[r∆I] and the variance E [(∆I)2].