Algorithmic Trading, COMP0051, 2023/24
Coursework 2. Cohort 2023/24. This assignment is worth 60% of the overall mark.
All reports will be checked for plagiarism and plagiarism cases will be thoroughly investigated, do not include non-original material (text, images, tables) without clearly stating the source.
Standard and non-standard calculators are permitted
1. Time Series Prep [30 Points]
(a) Download SPTL ETF (1 ) at end-of-day prices for the period of time between 1 Jan 2014 to 31 December 2019. Download the Effective Fed Funds Rate (EFFR Index)2 as the risk-free rate. Adjust annual risk-free rate to make it a daily rate, i.e., rt(f) = EFF R(t) · dc, where dc is a day-count. You can use dc (1/252).
A unit of SPTL will cost pt at time t, which we have to finance at the risk-free rate.
The daily excess return per unit of SPTL reads,
(b) Plot the SPTL return time series, the EFFR, and the excess return per unit of SPTL, starting from t = 0 corresponding to 1 Jan 2014.
2. Trading Strategies [45 Points]
Definition. In a leveraged strategy, the (leveraged) book size is the available capital times the leverage amount. By a leveraged strategy we mean a sequence of SPTL which can belong or short such that
where V0 is the initial capital, and L isthe leverage.
(a) Define three leveraged trading strategies for the SPTL with initial capital V0 = $200, 000. For all strategies, set the leverage L = 10. Use the first 70% of days as training set and the remaining 30% as test set. The daily trading PnL, which we define as the excess return of each strategy , is given by the equation:
where θt is the dollar value of SPTL held at time t (i.e., θt = units(t) × pt ).
(b) Plot the position of the strategies θt together with the upper and lower bounds [ — Vt · L, Vt · L]. Calculate the turnover in dollar value traded over time
Additionally calculate the turnover in number of units traded over time
. Plot a moving average of the turnover. Is it higher during certain periods than in other periods? How is it related to the volatility of SPTL?
(c) Create a total PnL series for the strategies, where we assume that unused capital will be put in a money-market and grow at the same risk-free rate, i.e., the value of your account changes by the trading PnL (ΔV) and the change in the growth of the money-market capital account (ΔVcap ).
where is the total margin used and V0 was as above. Plot ∆Vt,∆Vt cap, and ΔVttotal and plot their accumulated values (i.e., cumsum() of each). The return of your strategy may be leveraged several times, and so is dependent on funding costs. Can you describe what would happen if the funding costs rt(f) increased? What if they went up by 150% (i.e., using 150% X rt(f))?
3. Performance Indicators [25 Points]
(a) Define the excess return of a trading strategy as the daily trading PnL, PnLt = ΔVt. Use this quantity to compute the Sharpe Ratio (SR), Sortino Ratio, Maximum Drawdown and the Calmar ratio of your strategies. For each of them provide two independent measurements: one within the training set and one within the test set.
(b) Plot the rolling Sharpe ratio for your strategy both in the train-set and in the test-set. How does the SR behave when you move from train-set to test-set? Why do you think it has changed? Can you describe a method or methods which can be used to prevent such a change?
(c) Plot the Drawdown chart over time for all of the strategies separately
and plot the historic rolling 90-day volatility of the underlying asset (pt ) on each chart.
(d) Discuss the Drawdown chart. When are the biggest drawdowns? Are they related to the historic volatility? Could you see safer strategies involving using more or less margin based on the underlying market volatility?
Written report A single written report in pdf (12 pages maximum) structured into:
• Introduction
• Methodology
• Results
• Discussion
• Bibliography
will need to be submitted to Moodle before the deadline of 19/03/2024.
Coding and Editing Students are allowed to use any programming language and any editing software for the report. For transparency, the code will need to be uploaded as well (preferably as one zip file).
Marking The marking will be based on the following criteria:
• Clarity of presentation and explanations;
• Justification of the methodology, i.e. the trading strategies;
• Validity of results;
• Consistency of language and mathematical notation;
• Critical interpretation of results.