Math 5440: Week 10 Assignment
Due Date: April 7, 2023 at 10am
Exercise 1 Simulating an AB-Test
Consider three alpha signals with correlations ¦Ñ0 = 0, ¦Ñ1 = 0.05, and ¦Ñ2 = 0.3.
1. For each correlation, create a synthetic alpha. The result should be in long format (duplicate each table row for each alpha).
2. For each synthetic alpha, backtest the optimal trading strategy. The result should be in long format (duplicate each table row for each strategy).
The next step is to simulate an A-B testing engine. The engine is a function with signature
abTest:{[tbl; strat1; strat2; prob1]}
where tbl is a table with separate rows for each strategy. Strat1 and strat2 are the strategy names and prob1 is the probability assigned to strat1 (the rest being assigned to strat2). The function returns a table randomly selecting a strategy.
3. ImplementanabTestthatrandomlyassignseach(stock,day)pairto one of two strategies.
4. For each day, bucket all stocks into three equal-size groups: low, medium, and high volatility. Implement an abTest that randomizes within each volatility bucket.
Exercise 2 Analyzing an AB-Test
The baseline scenario is strat1 follows the ¦Ñ1 alpha signal and strat2 does not trade.
1. Simulate an AB-test with prob1 at 80%. What is the average daily P&L of this randomized strategy? What is the average daily P&L for each strategy?
Programming Help, Add QQ: 749389476
2. Foreveryday,computethedailyt-stat(mean/sdev)ofeachstrategy¡¯s P&L across all stocks. Use suitably normalized units.
3. For every month, compute the t-stat (mean/sdev) of each strategy¡¯s P&L across all (stock,days). Use suitably normalized units.
4. Repeat Questions 1-3 for prob1 = 0.1,0.2,…,0.9. Comment on the P&L and uncertainty trade-off across A-B allocations.
5. RepeatQuestions1-4foreverystrategypair.Commentontheamount of A-B testing needed based on an alpha¡¯s strength and the trader¡¯s waiting time.
Code Help, Add WeChat: cstutorcs