Math 5440: Week 8 Assignment
Due Date: March 24, 2023 at 10am
Exercise 1 Creating Synthetic Trades
Load the binned stock data using
\l pathToHdbFolder\columbiaHdb
Load in memory the table for the date 2019.01.03. This exercise implements functions to simulate three common rule-based trading schedules. Each function should have the signature
simSchedule:{[trade; adv; size]}
vectorized over trade and adv, but not size. Trade are the market trades (some schedules track market trades). Size is the (signed) size of the order to be executed, expressed in the same units as trade (dollars). The three schedules to implement are:
(a) Time Weighted Average Price (TWAP) schedules trade at a constant speed per unit of time until the end of the day. Both the order’s end time and speed are fixed.
(b) Volume Weighted Average Price (VWAP) schedules trade at propor- tional speed to the market (abs(trade)) until the end of the day. The order’s end time is fixed, but the order’s speed depends on market volumes. Therefore, an inaccurate market volume prediction can lead to inaccurate VWAP speeds.
(c) Participation of Volume (PoV) algorithms do not have a fixed end time. Instead, the trader specifies a market volume to track, called the participation rate. Therefore, the end time is determined by when the market executes the required volume, and an inaccurate market volume prediction can lead to inaccurate forecasts of the PoV order’s end time. However, the speed, in terms of market volume tracked, is guaranteed.
Code Help, Add WeChat: cstutorcs
1. Implement a TWAP scheduling function.
2. Implement a VWAP scheduling function.
3. Implement a PoV scheduling function with 10% participation rate.
4. For a given stock, simulate buying $1 million using each trading schedule. Compare the three schedules.
5. Repeat Question 4 with a buy order of 10% adv for the same stock. Comment on PoV and VWAP schedules when one has a perfect vol- ume prediction.
Exercise 2 Backtesting Trading Schedules
In this Exercise, we assume that we historically submitted a 10% TWAP buy order on every stock in our universe. Furthermore, assume the price
impact model
dIt =−βItdt+0.8· σ dQt adv
with log(2)/β = 60 minutes.
1. Compute impact-adjusted prices across the stock universe.
2. Simulate new prices assuming we instead submitted TWAP buy or- ders of 20% adv.
3. Simulate new prices assuming we instead submitted VWAP buy or- ders of 10% adv.
4. Compute the historical strategy’s average impact costs. Repeat for the TWAP order from Question 2 and the VWAP order from Ques- tion 3.
5. Compute the historical strategy’s P&L. Repeat for the TWAP order from Question 2 and the VWAP order from Question 3.
Computer Science Tutoring