Assignment title: Information
Time Series Analysis and Backtesting
Summary
The aim to this topic is an estimation and analysis of tradeable relationships between two or
more financial time series. Identifying and backtesting a robust cointegrated relationship means
exposing a factor that drives both (or many) asset prices. The factor is traded by entering the
long-short position given by cointegrating weights.
Through implementation you will have a hands-on introduction to Vector Autoregression
(for returns) and Error Correction (for prices) models, which are the main variations of the multivariate regression. Instead of econometric forecasing, a range of techniques and considerations
applied known as 'backtesting'. The techniques and quant recipes are specific to statistical arbitrage or systematic (algorithmic) strategy selected, for example, statistical arbitrage requires
evaluating mean-reversion and optimality of trading of a spread.
A project that solely runs pre-programmed statistical tests on data is a preparation work, not
the complete project. The project should have coding of necessary statistical tests from the first
principles (explicit regression equations) by yourself. The least deliverables are a. implemented
Engle-Granger procedure, b. statistical diagnosis and backtesting (split dataset in half or compute rolling estimates), and c. market factor backtesting via regressing returns from your
strategy on market index returns or another factor. These are in addition to the underlying
numerical methods on matrices and vector autoregression.5
Backtesting
The following notes o↵er choices to implement in aspects and questions of backtesting:
• All project designs (whether learning-level or in-depth) should include backtesting of a
strategy. The strategy is realised by using cointegrating coe"cients !Coint as allocations w.
That creates a long-short portfolio that generates a mean-reverting spread (cointegrated
residual).
• Does cumulative P&L behave as expected (for a cointegration trade)? Is P&L coming from
a few or lot of trades/time period? What are the SR/Maximum Drawdown? Behaviour
of risk measures (volatility/VaR)? Concentration in assets and attribution?
• Impact of transaction costs (plot an average P&L value vs. number of transactions).
• Optionally, introduce liquidity and algorithmic flow considerations (a model of order flow).
How would you be entering and accumulating the position? What impact bid-ask spread
and transaction costs will make?
5It is recommended that you use the environment with facilities for matrix and time series manipulation (R,
Matlab) or code in Python/C++ with the use of quant libraries. The use of VBA will be cumbersome.
10Step-by-Steps Designs
Design 1: 'Learning' and Cointegration in Pairs
An understanding-level design can use the ready specification tests, but matrix form regression estimation must be re-coded. The project can rely on the Engle-Granger procedure for
cointegration testing among pairs.
1. Implement concise matrix form estimation for multivariate regression and conduct model
specification tests for: (a) identifying optimal lag p and (b) stability check.
2. Optionally, test forecasting capability of regression with IRF and Granger Causality.
3. Implement Engle-Granger procedure and use it to identify a cointegrated pair. Estimate
relationships both ways to select the appropriate lead variable.
4. ADF test for unit root must be coded and used.
Design 2: 'In-depth' and Multivariate Cointegration with Trends
The advanced implementation will re-code the essential tests (selection of lag p and unit
root) and o↵er the multivariate estimation of cointegration. Analysis of relationships suitable
for trading has to extend to exploring the quality of mean-reversion in cointegrated residual.
1. Implement concise matrix form estimation for multivariate regression and conduct your
own coded tests for: (a) identifying optimal lag p and (b) stability check.
2. Apply Maximum Likelihood Estimation (Johansen Procedure) for multivariate cointegration on asset price data (in levels, not returns).
3. This is subject to (a) prior testing for unit roots by ADF test and (b) specification of
deterministic trends for cointegrating equation. Use simple trends and check for overfitting.
4. Present clear analysis of results for Maximum Eigenvalue and Trace statistical tests, both
are based on Likelihood Ratio test principle.
Before own implementation, consider R/Matlab functionality for Johansen Procedure and
especially the tests for the number of cointegrated relationship in a multivariate system.
Strategy Backtest (both designs)
5. Use cointegration analysis to identify candidates for the long-short portfolios as given by
cointegrating weights.6
6. Backtest a statistical arbitrage trade (or several) by investigating a mean-version in cointegrated residual et = !Coint 0 Yt. Use the fitting to the OU process and give the speed
of reversion, number of trades as well as other properties of P&L. Rely on backtesting
considerations given above.
6Within an asset class, a robust cointegration relationship exposes a factor.
11CVA Calculation for an Interest Rate Swap
Summary
To recognise the importance of credit and counterparty risk adjustments to the derivatives
business we introduce this mandatory component which must be implemented with each topic.
Calculate the credit valuation adjustment (taken by Counterparty A) to the price of an interest rate swap using credit spreads for Counterparty B. Plot MtM values (a good plot will
show results from many simulations) and produce (a) a smoothed Expected Exposure profile.
While EE is defined as max (MtM⌧, 0), you have to experiment with exposure distribution(s) at
each tenor.1 Produce smoothed Potential Future Exposure(s) using such indicators as (b) the
median of positive exposure and (c) 97.5th percentile.
Provide a brief discussion of your observations, e.g., exposure over time, location of maximum
exposure, impact of very small or negative rates. The advanced sensitivity analysis will illustrate
the concept of the wrong-way risk.
Step-By-Step
The inputs for IRS valuation are (Forward) LIBORs and discounting factors. You also need
default probabilities: bootstrap or make reasonable assumptions to supplement the data (e.g.,
flat credit spreads to 5Y tenor).
• Probability of default is bootstrapped from credit spreads for a reference name (any reasonable set values) in 6M increment. Linear interpolation over spreads and use of ready
PD bootstrapping spreadsheet are acceptable, RR = 40%. CVA LGD – own choice.
• Assume the swap is written on 6M LIBOR over 5Y. Notional N = 1 and payment frequency
⌧ = 0.5.
To simulate the future values of L6M at times T1, T2, T3, . . . take either (a) HJM MC
spreadsheet, (b) one-factor or full calibrated LMM – see topic below or (c) ready/own
one-factor calibrated model for r(t), such as Hull & White.
At each time Ti+1 the SDE simulation produces a distribution of Forward LIBORs.
• Define MtM position as Floating Leg ! Fixed Leg = (L6M ! K) appropriately discounted.
Depending on your inputs, choose fixed leg (rate) K to to have positive exposure.
• Discounting factors to be taken from the OIS curve, statically or with the use of LIBOROIS spread for choices (a) and (b).
1Using output of such models as HJM/LMM it is straightforward to come up with the distribution of Forward
LIBORs at each swap fixing time Ti+1 (tenor ⌧ in HJM Model calibrated 'today').
4Forward LIBOR from HJM and LMM
While based on historic volatility, the HJM o↵ers a simple SDE, Gaussian simulation of
interest rates (yield curve in continuous time) and a"ne calibration, even as the PCA factors
are non-parametric.
HJM re-calibration would be on 2-3 years of recent data of the inst. forward rates from the
BLC (LIBOR curve). Simple di↵erences among daily rates are used.
Both models, HJM and LMM have SDEs that provide simulated forward curves – output of
LMM SDE will look the same as HJM MC spreadsheet. The maths of obtaining LIBOR from
a simulated forward curve is illustrated in the Yield Curve spreadsheet.
HJM and LMM have SDEs evolve forward curve – to match the rolling-forward measure,
discounting factors must also be taken from the similarly evolved curves. However, (a) there
are no caplets on OIS traded to calibrate and implement LMM model separately for discounting
factors and (b) calibrating HJM to historical Forward OIS rates is a possibility but not market
practice. In the absence of simulated Forward OIS, one can make assumptions about LIBOROIS spread and use it to infer the discounting curve from Forward LIBOR curve.
It is market practice to assume constant LIBOR-OIS spread but, as a challenge, you are
welcome to explore the stochastic spread modelling between interest rates (funding basis spreads,
tenor basis swaps).
Forward LIBOR CIR++ (Hull and White)
Calibration of one-factor interest rate models is covered in all common textbooks. While it
is market practice to use these models, the preference for CQF project is towards full Forward
LIBOR modelling either by HJM or LMM.
If using this path, one can obtain Forward LIBORs but not the evolution of the forward
curve in continuous time.
Evolution of the spot process r(t) with one-factor models can be improved by using market
volatility and volatility fitting recipes from LMM model.
Data sources for various interest rates are also listed under LIBOR and OIS topic below.
5