Certificate in Quantitative Finance

103 views 8:28 am 0 Comments June 26, 2023

Certificate in Quantitative Finance
Final Project Brief
JAN 2020 COHORT
This document outlines each available topic together with submission requirements for the
project report and code. By-step instructions offer a structure not a limit to what you can
implement. Project Workshops I and II will provide focus to the implementation of each topic.
CQF Final Project is numerical techniques and backtest or sensitivity-test of model output
(prices, portfolio allocations, pairs trading) as appropriate. Some numerical techniques call for
being implemented in code from first principles. There might be numerical methods either too
involved or auxiliary which you would not need to implement if good ready functionality is
available. Re-use and adoption of code permitted. Marks earned will strongly depend on coding
of numerical techniques and presentation of how you explored and tested a quantitative model.
A capstone project require a degree of own study and ability to work with documentation on
packages that implement numerical methods in your coding environment eg, Python, R, Matlab,
C#, C++, Java, Scala, VBA+NAG libraries.
Exclusively for current CQF delegates. No distribution.

Dr Richard Diamond PC, TS, DL
Dr Riaz Ahmad CR, IR, Python/C++
Orinta Junkaite All submission questions

This brief prepared and overall final project supervision by Dr Richard Diamond
1

1 Topics
The following projects are available for January 2020 Cohort. To complete the project, you
must implement
one topic from this list. If you continue from a previous cohort, please review
topic description because tasks are regularly reviewed. It is not possible to submit past topics.
1.
Portfolio Construction with Robust Covariance (PC)
2. Deep Learning for Time Series (DL)
3. Long/Short Trading Strategy Design & Backtest (TS)
4. Pricing A Credit Spread (CR)
5. Interest Rate Modeling for Counterparty Risk (IR – LMM)
1.1 Project Report and Submission Requirements
Submit working code together with a well-written report and originality declaration.
There is no set page length. Report must have an analytical quality and discussion of
results/robustness/sensitivity/backtesting as appropriate to the topic.
Use charts, test cases and comparison to empirical research papers where available.
Report must contain sufficient mathematical model, numerical methods with attention to
their convergence/accuracy/computational properties.
Please feature the numerical techniques you coded { make a table.
Mathematical sections can be prepared using LaTeX or Equation Editor (Word). Printing
out Python notebook code and numbers on multiple pages, without your own analysis
text, explained plots, relevant maths is not an acceptable format.
Submission date is 13 July 2020, 23:59 BST
Work done must match the Brief. There is no extension to the Final Project.
Projects without declaration or working code are incomplete and will be returned.
All projects are checked for originality. We reserve an option of
a viva voce before
a qualification to be awarded.
2
1.2 CQF Electives
We ask you to choose two Electives in order to preserve focus. All electives will be available
later for your advancement. Project Workshop remain the main source, while Electives canvass
knowledge areas, and
several viable combinations for each Project topic are possible.
The effective approach is to select one ‘topical elective’ and one ‘coding elective’, the latter give
numerical techniques across models, they are are identified with
Dev label.
For portfolio construction type of topic, Risk Budgeting elective recommended as the
primary choice.
Counterparty Credit Risk elective is main choice for two topics: Credit Spread Pricing and
Interest Rates for Counterparty Risk.
Trading strategy topic utilises Cointegration for pairs/basket trading, for which there is
no direct elective (but Cointegration lecture/Project Workshop II/Webex session).
Deep learning and machine learning types of topic rely on two ML Modules of material.

Counterparty Credit
Risk
{ primary choice for
CR, IR
CDS, survival probabilities and hazard rates reviewed. Three key nu
merical methods for quant finance pricing (Monte-Carlo, Binomial Trees,
Finite Difference). Monte Carlo for simple LMM. Review of Module Five
on Credit with a touch on the copula method.
Outcome: covers CVA
Computation clearly and reviews of credit spread pricing techniques.
Risk Budgeting { pri
mary choice for PC
Reviews the nuance of Modern Portfolio Theory, ties in VaR and Risk
Decomposition with through derivations and expectation algebra. Gives
simple examples of figures you need to compute and then combine with
portfolio optimisation. Risk-budgeting portfolio from Video Part 10.
Data Analytics { Dev
(TS, PC)
Level I on Python for quant finance, data structures (Dataframe), numpy
for numerical analysis, pandas for financial time series analysis, data vi
sualization.
Outcome: a pre-requisite if you have not coded in Python.
Machine Learning with
Python
{ starting point
for ML and DL
Level II on Python for quant finance, capabilities of scikit-learn libary
(OLS, logistic),
tensorflow library example of ‘deep learning’ (classifier)
{ use the Github link below and explore.
Outcome: returns modelling
(for either prediction or backtesting), and Least Squares Monte Carlo
for pricing Bermudans in LMM framework.

Table 1: Primary Elective Choices
3

Python Applications {
Dev (CR, IR, LV)
Quant numerical techniques with Python examples and notes on com
putational efficiency: Normal from Uniform RN, linear equations and
eigenvalues, numerical integration, root finding (Bisection, Newton),
random numbers with arrays and seeding, Binomial/Poisson/LogNormal
distributions, SDE simulation (GBM, OU cases). Introduction to
Jupyter Notebook, arrays and indexes.
Outcome: relevant particularly
for Monte-Carlo in Credit Spread and Interest Rate topics.
Volatility past topic, left
as reference
Considers the main kinds of PDEs (stochastic volatility and jump diffu
sion) and their analytical solution: the main approach to solve stochastic
volatility (Heston model) is via Fourier Transform. In-depth on integra
tion
Outcome: Local Volatility topic offers a classic pricing PDE, which
can be solved by techniques from this elective.
C++ Dev Consider this a revised version of C++ Primer/ initial certificate course.
Small examples will guide you through identifiers, data types and op
erations with them. That is followed by debugging, control structures
and vignette cases on useful numerical techniques such as CDF, inte
gration and use of
cmath. The large final part is about functions and
elements of object-oriented programming.
Outcome: teaches good pro
gramming style and generic techniques you are likely to apply in other
coding languages.

Advanced Volatility Modeling { Local
Table 2: Primary Elective Choices (Cont)
Machine Learning with Python has computational material on Github
https://gist.github.com/yhilpisch/648565d3d5d70663b7dc418db1b81676
PyAlgoTrade documentation http://gbeced.github.io/pyalgotrade/docs/v0.18/html/index.html
Even more electives are available, ones that you might like to return to for professional advancement (Risk Management, Behavioural Finance, Pricing with PDEs) { they are described at the
end of this Brief.
4

1.3 Coding for Quant Finance
Choose programming environment that has appropriate strengths and facilities to implement the topic (pricing model). Common choices range from VBA to Python to C++,
please exercise judgement as quants: which language has libraries to allow you to code
faster, validate easier.
Use of R/Matlab/Mathematica is encouraged { as a main environment or an addition.
Sometimes there is a need to do time series/covariance matrix/rank correlation computation, or to present results and the formulae in coherent form.
Project Brief give links to nice demonstrations in Matlab, and Webex sessions demonstrate
Python notebooks { doesn’t mean your project to be based on that ready code.
Python with pandas, matplotlib, sklearn, and tensorflow forms a considerable challenge to
Matlab, even for visualisation. Matlab plots editor is clunky and it is not that difficult to
learn various plots in Python.
‘Scripted solution’ means the ready functionality from toolboxes and libraries is called,
but the amount of own coding of numerical methods is minimal or non-existent. This
particularly applies to Matlab/R.
Projects done using Excel spreadsheet functions only are not robust, notoriously slow,
and do not give understanding of the underlying numerical methods. CQF-supplied Excel
spreadsheets are a starting point and help to validate results but coding of numerical
techniques/use of industry code libraries is expected.
The aim of the project is to enable you to code numerical methods and develop model prototypes in a production environment. Spreadsheets-only or scripted solutions are below
the expected standard for completion of the project.
What should I code? Delegates are expected to re-code numerical methods that are
central to the model and exercise judgement in identifying them. Balanced use of libraries
is at own discretion as a quant.
Produce a small table in report that lists methods you implemented/adjusted. If using
ready functions/borrowed code for a technique, indicate this and describe the limitations
of numerical method implemented in that code/standard library.
It is up to delegates to develop their own test cases, sensibility checks and validation. It
is normal to observe irregularities when the model is implemented on real life data. If in
doubt, reflect on the issue in the project report.
The code must be thoroughly tested and well-documented: each function must be described, and comments must be used. Provide instructions on how to run the code.
5

This page intentionally left blank.
6

Portfolio Construction with Robust Covariance
Constructing a robust portfolio meets the following problem: a naive sample covariance matrix
contains estimation error that perturbs a mean-variance optimiser the most. The project will
require for you to review and apply covariance matrix shrinkage recipes: Ledoit-Wolf non-linear
shrinkage estimated directly from data and is preferrable. The second choice is ‘highly structured’ estimate or shrinkage towards the trace (sum of diagonal elements). The third choice is
‘poor man’s’ by running EGARCH on individual variances, and a rank correlation matrix to assemble covariance.
1 Compare optimal allocations computed from both, naive sample covariance
matrix vs. robust covariance.
Having dealt with the covariance matrix, we turn to Black-Litterman framework. It shifts
expected returns distribution with directional views, while not touching the variance. Therefore,
portfolio optimisation solutions will take in
µBL and robust covariance.
Kinds of optimisaiton: mean-variance, Min VaR, Tracking Error, Max Sharpe Ratio, higherorder moments (min coskewness, max cokurtosis) { implement at least two. Computation is
by a ready formula or specialised quadratic programming { you don’t need to recode ‘cone
optimisation’ but preferred choice to use specialised optimiser. Adding constraints improves
robustness: most investors have margin constraints, including limited ability to borrow. You
can compute Risk Contributions
ex ante, vs computing Equal Risk Contributions portfolio,
which involves solving a system of risk budget equations (non-linear).
2
Portfolio Choice and Data
The choice of portfolio assets must reflect optimal diversification. The optimality depends on the
criterion: maximum (or some) decorrelation among assets, maximum optimal bets, factor tilts, risk
budgeting.
A naive portfolio of S&P500 large caps is fully exposed to one factor, the market index itself, which
is not sufficient. Specialised portfolio for an industry, emerging market, credit assets should have 5+
names, and
> 3 uncorrelated assets, such as commodity, VIX, bonds, credit, real estate. See Q&A Ch 5.
Factor portfolio is more of a long/short strategy, e.g., momentum factor means going long top 5 raising
stocks and short top 5 falling. Factor portfolios imply rebalancing (time diversification) by design.
mean-variance optimisation was specified by Harry Markowitz for simple returns (not log) which are
in excess of the rf. For risk-free rate, 3M US Treasury from pandas FRED dataset/ECB website
rates for EUR/some small constant rate/zero rate { all are acceptable. Use 2-3 year sample, which
means
> 500 daily returns.
Source for prices data is Yahoo!Finance (US equities and ETFs). Use code libraries to access
that, Google Finance, Quandl, Bloomberg, Reuters and others. If benchmark index not available,
equilibrium weights computed from the market cap (dollar value).
1Backtesting likely to reveal GARCH variances as sub-optimal. Therefore, making advance into more complex
Dynamic Conditional Correlation/PCA Multivariate GARCH is not productive for portfolio construction.
2Converted by optimisation problem: solved by sequential quadratic programming (SQP).
7
Step-by-Step Instructions
Part I: Robust Covariance
1. Implement Portfolio Choice based on your approach to optimal diversification: introduce
an exogenous asset, check for the lesser correlated assets, long/short. See Q&A, Ch 5.
2. Compute both, sample covariance
and and robust estimate. You can use the ready LedoitWolf code (distributed with Project Workshop) which applies non-linear shrinkage and
computes right from data (columns of returns).
It will be informative if you explore shrinkage to trace and minimum covariance determinant (both are in sklearn package of Python), or explicit EGARCH computation.
Instead of covariance matrix trace { shrink towards towards Factor Covariance (such
as the diagonal matrix of covariance between each asset and S&P 500).
3. Produce supporting representations: heatmaps/3D of covariance matrices, plots of eigenvalues of naive vs robust covariance.
Part II: Optimisation with Views
1. Plan your Black-Litterman application. Find a ready benchmark or construct the prior:
equilibrium returns can come from a broad-enough market index. Implement computational version of BL formulae for the posterior returns.
2. Imposing too many views will make seeing impact of each individual view difficult.
3. Describe analytically and compute optimisation of
at least two kinds. Robustness improved by using sensible constraints, eg, budget constraint, ‘no short positions in bonds’
but such inequality constraints
8wi > 0 trigger numerical computation of allocations.
4. You will end up with multiple sets of optimal allocations, even for a classic mean-variance
optimisation: 1) na¨ıve covariance vs. robust, 2) robust covariance with/ without BL views
imposition, 3) three levels of risk aversion. Please make your own selection on which results
to focus your Analysis and Discussion { the most feasible and illustrative comparisons.
Part III: Backtesting OPTIONAL
1. The proof of usefulness of portfolio optimisation is in backtesting. Without special packages you can produce a running P&L (weights × prices) and point at drawdowns. Also
interesting to compare performance of your allocations versus simple 1
=N.
If you have not reserved a holdout dataset ‘in future’, then backtest against some period(s)
in the past. Backtesting packages allow historic simulation (crossvalidation over many periods or even shuffled samples) and distributional analysis.) Quantopian allows to produce
the rolling beta against the market factor & rolling Sharpe Ratio.
2. It is sufficiently easy to compare Naive Risk Parity portfolio. What phenomena have
you encountered, ee, why would investors end up allocating into riskier (high beta) assets?
Does equal risk contribution work? Would ‘the most diversified portfolio’ kind of approach
work? (Diversification Ratio, or even PCA/Torsion ‘optimal bet’ portfolios.)
8

Deep Learning for Time Series
Summary
If one believes the data carries autoregressive structure: a recurrent neural network model
can be a successful alternative to time series regression. For this topic you will run Long
short-term memory classification (up/down moves) with features more advanced than ML Assignment (Exam 3). Volatility can be a feature itself, together with an interesting addition of
drift-independent volatility. LSTM can come out as one of best-predicting models from financial ratios/adv technical indicators/volatility estimators. There are also alternative OPTIONAL
features to consider if you can link/use the data: (a) credit spreads { traded CDS or indices and
(b) news indicators { FactSet, RavenPack offer API for professional subscription or trial.
ANNs can handle longer prediction periods than 1 day. Dealing with the arbitrary length of
sequence is the major characteristic of LTSM. Certain time series, such as interest rates or
economic indicators are more characterised by long memory and stationarity, and therefore
modelled with power law autocorrection/Hurst exponent fractional/Markov processes. If you
attempt the prediction of 5D or 10D return for equity or 1W, 1M for FF factor the challenge is
twofold. First is increase data requirement, nearing 7-10 years to begin with. Second is isolation
of autocorrelation in positive 5D/10D return in equity time series.
Before using RNNs, conduct exploratory data analysis (EDA).
3 You can proceed straight to
autoencoding for NNs or utilise self-organising maps (SOM)/decision tree regressor (DTR).
Multi scatterplots presenting relationships among features is always a good idea, however if
initially you have 50-70 features (including repeated kind, different lookback) { you need to
reduce dimensionality in features. SOM analysis can be on non-lagged features, daily data and
lookback computational periods of 5D/10D/21D/50D for features as appropriate { immediately
generates 4 columns of the same feature { and dense map areas should help you to answer such
questions as to choose EMA 5D or 10D, Volatility 50D or ATR 10D. Alternatively, top-level
splits of DTR with large numbers in leaf should reveal which features to prioritise.
Part I: Engineering Data Features
Please revisit ML Lab II (ANNs) for basic discussion on feature scaling. Be careful about sklearn
feature selection by F-test.
1. Past moving averages of the price, simple or exponentially weighted (decaying in time), so SMA,
EMA. Technical indicators, such as RSI, Stochastic K, MACD, CCI, ATR, Acc/Dist). Interestingly, Bollinger Bands stand out as a good predictor. Remember to vary lookback period
5D/10D/21D/50D, even 200D for features as appropriate. Non-overlapping periods means you
need data over long periods.
3EDA helps to perform dimensionality reduction via better understanding of relationships between features,
uncovers underlying structure, and invites detection/explanation of the outliers. EDA should save you from ‘brute
force’ GridSearchCV runs calling a NN/RNN Classifier again and again.
9
Volume information and Volume Weighted Average Price appear to be immediate-term signals,
while we aim for prediction.
2. Use of features across assets are permitted but be tactical about design: eg, features from commodity price impacting an agricultural stock (but not oil futures price on an integrated oil major),
features from cointegrated equity pair. Explore Distance Metrics among features (KNN) and potential K-means clustering as yet another alternative to SOM.
3. Balance the needs of longer-term prediction vs. short-term heteroskedastic volatility. Yang &
Zhang (2000) provide an excellent indicator: drift-independent volatility which takes into account
an overnight jump { but might not be as useful for 5D/long-term prediction as can’t be re-scaled
to non-daily jumps. Smoothed volatility estimate (EWMA/EGARCH) can be scaled
pt but it’s
not intended as a medium-term prediction indicator, and at the same time risks being dominated
by the long-term average variance ¯
σ2
4. OPTIONAL Interestingly credit spreads (CDS) can be a good predictor for price direction. Think
out of the box what other securities have ‘credit spread’ affecting their price.
5. OPTIONAL Historical data for financial ratios is good if you can obtain the data via your own
professional subscription. Other than that, history of dividends, purchases/disposals by key stakeholders (director dealings) or by large funds, or Fama-French factor data is better available.
Part II: Pipeline Formation (considerations)
Your implementation is likely be folded into some kind of ML Pipeline, to allow you re-use
of code (eg, on train/test data) and aggregating the tasks. Ensemble Methods present an
example of such pipleline: Bagging Classier is an umbrella name for the process of trying
several parametrisations of the specific classifer (eg Logistic Regression). AdaBoost over
Decision Tree Classifier is another case. However, please do not use these for DL Topic.
Empirical work might find that RNNs/Reinforcement Learning might work better WITHOUT past returns! Alternatively, if you are predicting 5D/10D move there will be a
significant autocorrelation effect { your prediction will work regardless of being a good
model or not.
Please limit your exploration to 2-3 assets and focus on features, their SOM (if possible),
and LTSM Classifier to make the direction prediction. If you are interested in the approach
to choose a few from a large set of assets { can adopt a kind of diversified portfolio selection
(see Portfolio Construction topic Q&A).
You are free to make study design choices to make the task achievable. Substitutions:
{ present relationship between features with simple scatterplots (vs SOMs) or K-means
clustering;
{ use MLP classifer if recurrent neural nets or LTSM is particular challenge;
{ re-define task and predict Momentum sign (vs return sign) or direction of volatility.
Use core lectures resources { there is more inside Deep Learning lecture. Do not
re-code decision trees or optimisation to compute NNs weights and biases.
10
Pairs Trading Strategy Design & Backtest
Estimation of cointegrated relationship between prices allows to arbitrage a mean-reverting
spread. Put trade design and backtesting in the centre of the project, think about your signal
generation and backtesting of the P&L. You will have a hands-on experience with regression but
will not run the regression on returns. The numerical techniques are regression computation in
matrix form, Engle-Granger procedure, and statistical tests. You are encouraged to venture into
A) multivariate cointegration (Johansen Procedure) and B) robustness checking of cointegration
weights, ie, by adaptive estimation of your regression parameters with statistical filters.
Contegrating weights that you use to enter the position form the long/short allocation that
produces a mean-reverting spread. Signal generation and suitability of that spread for trading
depend on its fitting to OU process recipe. For optimisation, comparative backtesting, rolling
ratios and other industry-level backtesting analytics use the ready code libraries. However,
project that solely runs pre-programmed statistical tests and procedures on data is insufficient.
It is not recommended using VBA for this topic due to lack of facilities.
Signal Generation and Backtesting
Be inventive beyond equity pairs: consider commodity futures, instruments on interest rates, and
aggregated indices.
Arb is realised by using cointegrating coefficients βCoint as allocations w. That creates a long-short
portfolio that generates a mean-reverting spread. All project designs should include trading signal
generation (from OU process fitting) and backtesting (drowdown plots, rolling SR, rolling betas).
Does cumulative P&L behave as expected for a cointegration arb trade? Is P&L coming from a
few or many trades, what is half-life? Maximum Drawdown and behaviour of volatility/VaR?
Introduce liquidity and algorithmic flow considerations (a model of order flow). Any rules on
accumulating the position? What impact bid-ask spread and transaction costs will make?
Step-by-Step Instructions
Can utilise the ready multivariate cointegration (R package urca) to identify your cointegrated
cases first, especially if you operate with the system such as four commodity futures (of different
expiry but for the period when all traded. 2-3 pairs if analysing separate pairs by EG.
Part I: ‘Learning’ and Cointegration in Pairs. Trade Design
1. Even if you work with pairs, re-code regression estimation in matrix form { your own OLS
implementation which you can re-use. Regression between stationary variables (such as
DF test regression/difference equations) has OPTIONAL model specification tests for (a)
identifying optimal lag
p with AIC BIC tests and (b) stability check.
2. Implement Engle-Granger procedure for each your pair. For Step 1 use Augmented DF
test for unit root with lag 1. For Step 2, formulate both correction equations and decide
which one is more significant.
11

3. Decide signals: common approach is to enter on bounds µe ± eq and exit on et everting
to about the level
µe.
4. At first, assume
Z = 1. Then change Z slightly upwards and downwards { compute P&L
for each case of widened and tightened bounds that give you a signal. Alternatively run
an optimisation that varies
Zopt for µe ±Zoptσeq and either maximises the cumulative P&L
or another criterion.
Caution of the trade-off: wider bounds might give you the highest P&L and lowest
Ntrades
however, consider the risk of co-integration breaking apart.
Part II: Backtesting
It is your choice as a quant to decide which elements you need to argue successfully that your
trading strategy (a) will not fall apart and (b) provides ‘uncorrelated return’.
4. Industry backtesting practice includes splitting data into train/test subsets. For your
forward testing periods you can use Quantopian platform to produce drawdown plots,
rolling SR and rolling beta vs chosen factors.
5. OPTIONAL To test if there is a structural change from
µOld e to µNew e , the Likelihood Ratio
(LR) test applies to coint regressions for Period 1 and Period 2.
6. Industry backtesting relies on rolling betas, while scientific research will test for breakouts
using LR test. One hand, cointegrated relationship supposed to persist and
βCoint 0 should
stay the same. Keep delivering stationary spread over say, 3-6 months, without the need to
be updated. However, Kalman filter/particle filter adaptive estimation of coint regression
will give updated
βCoint 0 and µe. http://www.thealgoengineer.com/2014/online_linear_regression_kalman_filter/.
However, you can simply re-estimate cointegrated relationships by shifting data 1-2 weeks
(remember to reserve some future data), and report not only on rolling
βCoint 0 , but also
Engle-Granger Step 2, the history of value of test statistic for the coefficient in front of
EC term.
Part III Multivariate Cointegration OPTIONAL
Your project can take another turn from the start: look into Johansen Procedure for
multivariate cointegration and apply to futures, rates, etc. Five ‘deterministic trends’ in
coint residual are possible but, in practice only need a constant inside the residual
et1.
Interpret Maximum Eigenvalue and Trace statistical tests, both are based on Likelihood
Ratio principle, eg, how you decided the number of cointegrated relationships?
Efficient implementation outlined in Jang & Osaki (2001) but you might need Ch 12 from
Zivot (2002) book. If coded Johansen Procedure, validate using R/Matlab libraries.
If the numerical methods and terminology of this topic are novel, then Time Series
Project Workshop and Cointegration Lecture will be your key resources.
12
Empirical aspects of time series analysis and vignettes are covered on a simple,
accessible level at
https://www.quantopian.com/lectures/.
13

Pricing A Credit Spread Product
Price a fair spread for a portfolio of CDS for 5 reference names (Basket CDS), as an expectation over the joint distribution of default times. The distribution is unknown analytically and
so, co-dependent uniform variables are sampled from a copula and then converted to default
times using a marginal term structure of hazard rates (separately for each name). Copula is
calibrated by estimating the appropriate default correlation (historical data of CDS differences
is natural candidate but poses market noise issue). Initial results are histograms (uniformity
checks) and scatter plots (co-dependence checks). Substantial result is sensitivity analysis by
repricing.
A successful project will implement sampling from both, Gaussian and t copulae, and price
all k-th to default instruments (1st to 5th). Spread convergence can require the low discrepancy
sequences (e.g., Halton, Sobol) when sampling. Sensitivity analysis
wrt inputs is required.
Data Requirements
Two separate datasets required, together with matching discounting curve data for each.
1.
A snapshot of credit curves on a particular day. A debt issuer likely to have a
USD/EUR CDS curve { from which a term structure of hazard rates is bootstrapped
and utilised to obtain exact default times,
ui ! τi. In absence of data, spread values
for each tenor can be assumed or stripped visually from the plots in financial media. The
typical credit curve is concave (positive slope), monotonically increasing for 1
Y; 2Y; : : : ; 5Y
tenors.
2.
Historical credit spreads time series taken at the most liquid tenor 5Y for each reference name. Therefore, for five names, one computes 5 × 5 default correlation matrix.
Choosing corporate names, it is much easier to compute correlation matrix from equity returns.
Corporate credit spreads are unlikely to be in open access; they can be obtained from
Bloomberg or Reuters terminals (via your firm or a colleague). For sovereign credit spreads,
time series of ready bootstrapped PD
5Y were available from DB Research, however, the
open access varies. Explore data sources such as
www.datagrapple.com and www.quandl.com.
Even if CDS
5Y and PD5Y series are available with daily frequency, the co-movement of
daily changes is market noise
more than correlation of default events, which are rare to
observe. Weekly/monthly changes give more appropriate input for default correlation,
however that entails using 2-3 years of historical data given that we need at least 100 data
points to estimate correlation with the degree of significance.
If access to historical credit spreads poses a problem remember, default correlation matrix
can be estimated from historic equity returns or debt yields.
14
Step-by-Step Instructions
1. For each reference name, bootstrap implied default probabilities from quoted CDS and
convert them to a term structure of hazard rates,
τ Exp(λ^1Y ; : : : ; λ^5Y ).
2. Estimate default correlation matrices (near and rank) and d.f. parameter (ie, calibrate
copulæ). You will need to implement pricing by Gaussian and t copulæseparately.
3. Using sampling form copula algorithm, repeat the following routine (simulation):
(a) Generate a vector of correlated uniform random variable.
(b) For each reference name, use its term structure of hazard rates to calculate exact
time of default (or use semi-annual accrual).
(c) Calculate the discounted values of premium and default legs for every instrument
from
1st to 5th-to-default. Conduct MC separately or use one big simulated dataset.
4. Average premium and default legs across simulations separately. Calculate the fair spread.
Model Validation
The fair spread for kth-to-default Basket CDS should be less than k-1 to default. Why?
Project Report on this topic should have a section on Risk and Sensitivity Analysis
of the fair spread w.r.t.
1. default correlation among reference names: either stress-test by constant high/low
correlation or
± percentage change in correlation from the actual estimated levels.
2. credit quality of each individual name (change in credit spread, credit delta) as well
as recovery rate.
Make sure you discuss and compare sensitivities for all five instruments.
Ensure that you explain historical sampling of default correlation matrix and copula fit
(uniformity of pseudo-samples) { that is, Correlations Experiment and Distribution Fitting
Experiment as will be described at the Project Workshop. Use histograms.
Copula, CDF and Tails for Market Risk
The recent practical tutorial on using copula to generate correlated samples is available at:
https://www.mathworks.com/help/stats/copulas-generate-correlated-samples.html
Semi-parametric CDF fitting gives us percentile values with fitting the middle and tails. Generalised Pareto Distribution applied to model the tails, while the CDF interior is Gaussian
kernel-smoothed. The approach comes from Extreme Value Theory that suggests correction for
an Empirical CDF (kernel fitted) because of the tail exceedances.
http://uk.mathworks.com/help/econ/examples/using-extreme-value-theory-and-copulas-to-evaluate-market-risk.html
http://uk.mathworks.com/help/stats/examples/nonparametric-estimates-of-cumulative-distribution-functions-and-their-inverses.html
15
Interest Rate Modeling for Counterparty Risk
This topic recognises the importance of credit and counterparty risk adjustments (incremental risk) to the derivatives business. The task here is to compute CVA on the Interest Rate Swap.
Full exposure analytics can only be produced by a model that simulates the full curve suitably
calibrated on the recent data. Using a one-factor r(t) models was good for a demonstration but
not sufficient for a full project. We choose the LIBOR Market Model.
Calculate the credit valuation adjustment taken by Counterparty A for an interest rate swap
instrument using credit spreads for Counterparty B (the payer of floating leg). Plot MtM values
and produce full exposure distribution at each MtM valuation point: max, median, quartiles and
97
:5th percentile. Expected Exposure is defined as max (MtMτ; 0)+ which is very drastic and
overstates the CVA. Potential Future Exposure (PFE) at the 97
:5th percentile and median of
positive exposure should show less convex exposure over tenors. Having compared the exposure
at maximum vs. percentiles, consider the very small or negative rates and develop sensitivity
analysis. Illustrate the concept of the wrong-way risk.
Data Requirements The inputs for IRS valuation are Forward LIBORs and discounting
factors as simulated by the model. The calibration will require market cap data (for LMM)
which can be easily made up if you don’t have market access. Advanced LMM calibration is
implemented from market swaption volatilities (Rebonato method) { but that calibration is not
a requirement. Default probability: you only need one sample CDS curve { if market data is a
problem assume slightly convex curve, eg, 30 bps for 1Y, 35 bps for 2Y, 45 bps for 3Y and alike.
Steps-By-Step Instructions for IRS Pricing and CVA
Probability of default is bootstrapped from credit spreads for a reference name in 0:5Y
increment. Linear interpolation over spreads and ready PD bootstrapping spreadsheet are
acceptable,
RR = 40%. CVA LGD also 40%.
Assume the swap is written on 6M LIBOR over 5Y. Notional N = 1 and τ = 0:5. For the
values of Forward LIBOR
L6M at times T1; T2; T3; : : : ; TN1 use the full simulated curve.
Define MtM position as Floating Leg Fixed Leg = (L6M K) appropriately discounted.
Depending today’s curve, choose fixed leg (rate)
K to have a positive exposure.
OIS discounting commonly implemented by a simple subtraction of LOIS spread from
each simulated curve to obtain discounting curve (decide if your LOIS tenor-dependent).
Alternatively, OIS basis can be formulated as
fFwd;t fFwdOIS;t.
Libor Market Model provides iterative output { term structure (the curve) is evolved from
column to column { the last column has only one terminal rate
L(Tn1) which SDE has zero
drift, reflecting the terminal measure
Q(Tn) that applies to all LMM equations. Be prepared
if the
abcd fitted volatility gives poor re-pricing of market caps from which you calibrated, an
ad-hoc basis curve would be required. Use curve-spanning
today’s forward LIBORs fi.
16

Step-by-Step for LMM
Part I: Data
1. You will need market price data { cap price and discount factor (two columns). Caps are
quoted in terms of implied volatility
σcap(t; T) for period from t = 0 to 1Y, 2Y, 3Y,…
(a) For pre-simulated caplet data (ie, from the HJM model) the Black formula is conventional means of converting the caplet’s cashflow to the implied volatility number.
2. Alternatively but completely OPTIONAL, LMM volatilities can be calibrated from a table of co-terminal vanilla swaptions (European options on forward-starting swaps) where
Rebonato method makes the Black formula suitable.
Part II: Calibration by Caplet Volatility Stripping
3. Forward 3M caplet volatilities σcpl(Ti; Ti+3M) are stripped from market cap volatilities by
using cashflow equivalence cap
T = PT i cpli. Caplet stripping methodology requires Black
formula and root-finding for cpl(
Ti1; Ti) , σcpl(Ti1; Ti) and pre-computation of
(a) Forward Swap Rates
S(t; Ti3M; Ti) to be used as ATM strikes of forward caplets.
(b)
σ(t; 9M), σMkt(t; 1Y ), σ(t; 15M), σ(t; 18M), σ(t; 21M), σMkt(t; 2Y ), σ(t; 27M), etc.
where non-market values are interpolated.
4
cpl(6M; 9M) = cap(t; 9M) cpl(3M; 6M)
cpl(9
M; 12M) = cap(t; 12M) cpl(6M; 9M) cpl(3M; 6M)
4. Fit the
abcd instantaneous volatility function, each tenor might have a separate fitting
parameter
φi. This is done by sum of least squares argmin P [σ(i) σFitted(i)]2.
5. Decide on correlation structure, from simple parametric
ρij = exp (β(Ti Tj)) to Schoenmakers and Coffey (2003) vs. empirical correlations.
With these steps you have all inputs in order to set up LMM SDE and output the forward
curves under Monte-Carlo. Remember that LMM output is direct simulation over
dt = 0:25.
Simplifying Assumptions: 1) Gatariek example implement calendar dates and so, their year
fraction 0
:2528 or 0:2558 depends on day count caplet covers but 30/360 convention acceptable.
2) Commonly cpl(3
M; 6M), cpl(6M; 9M) are computed just using flat volatility of σMkt(t; 12M)
3) Do not perform time homogeneity check, instead use assignment described in Gatarek 7.4.2.
4) LMM is calibrated for ATM strike. Each OTM/ITM strike of the smile will need its own
calibration.
4You have MANY choices for interpolation 1) linear in variance σ2(0; T), 2) abcd function over this implied
vol. which is separate from over instant. vol., 3) cubic spline
τ; τ2; τ3, or monotone-preserving convex spline
(Hagan&West 2005). Interpolation techniques applied in other domains like forward curve, but no reason not
to make new kind applications. The underlying caplets
must be stripped, not taken from any interpolated
function.
17
Please do not take LMM topic without prior experience in interest rates. We offer
this topic as a challenge for experienced fixed income quants.
18
Resources
Reading List: LMM
CQF June 2019 run featured Multiple Curves core lecture which addressed the issues
of curve construction (interpolation), and new Risk Free Rate benchmarks that come in
response to LIBOR Transition. (Please email Dr Richard Diamond for material)
The LIBOR Market Model in Practice specialised textbook by Gatarek, et al. (2006)
gives technical detail on cailbration from caplets and swaptions (Chapters 7 and 9 respectively) that will be useful to those working with LIBOR derivatives. (Please check Project
Workshop II { Additional Files)
LIBOR vs. OIS: The Derivatives Discounting Dilemma puts forward an argument that
discounting must reflect the cost of funding, different for each market participant: LIBOR
is a better estimate of the dealer’s cost, but collateralised transactions earn OIS rate.
http://www-2.rotman.utoronto.ca/~hull/downloadablepublications/LIBORvsOIS.pdf
CQF Lecture(s) xValuation Adjustment relies on xVA exercises from the textbook by
Jon Gregory. Spreadsheet10.1 presents Expected Exposure for a swaption instrument;
Spreadsheet10.2 evolves Vasicek process for
r(t) (constant parameters case) and presents
EE/PFE for an IRS.
Reading List: Credit Portfolio
Very likely you will need to re-visit CDO & Copula Lecture material, particularly slides
48-52 that illustrate Elliptical copula densities and discuss Cholesky factorisation.
Sampling from copula algorithm is given Project Workshop and Monte Carlo Methods in
Finance
textbook by Peter Jaekel (2002) { see Chapter 5.
Rank correlation coefficients are introduced Correlation Sensitivity Lecture and Jaekel
(2002) as well. Project Q&A document gives the clarified formulae and explanations.
Reading List: Portfolio Construction
CQF Lecture on Fundamentals of Optimization and Application to Portfolio Selection
A Step-by-step Guide to The Black-Litterman Model by Thomas Idzorek, 2002 tells the
basics of what you need to implement.
The Black-Litterman Approach: Original Model and Extensions Attilio Meucci, 2010.
http://ssrn.com/abstract=1117574
Risk Budgeting and Diversification Based on Optimized Uncorrelated Factors is
an advanced piece by Meucci, et al. (2015)
symmys.com/node/599 { see Section 7.
19

Reading List: Cointegrated Pairs
CQF Lectures on Cointegration and Statistical Methods for PD.
Learning and Trusting Cointegration in Statistical Arbitrage by Richard Diamond, WILMOTT
https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2220092.
Chapter 12. Cointegration in Modeling Financial Time Series, E. Zivot & J. Wang, 2002.
User Guide for Johansen’s Method by Kyungho Jang and Masao Ogaki, 2001.
Data Sources: Interest Rates
Caplet or swaption data is usually maintained by trading desks and interdealer brokers.
Data for certain markets is available from Thomson Reuters and Bloomberg. The simple
input, a strip of market cap volatility prices (1M, 2M, 3M, 6M, 9M, 12M, 2Y, 3Y, etc.)
can be taken from a textbook/research paper.
LMM can also be calibrated to swaption volatility data (Option Maturity 1Y, 2Y, 3Y etc.
vs. Swap Length 1Y, 2Y, 3Y, etc. that begins after maturity) { all at-the-money swaption
volatilities (strike is equal to the rate on Forward Swap). Done by Rebonato Method.
For each tenor, you will need a discount factor and should make a decision on whether to
use dual-curve discounting where DF is coming from the OIS curve. You will also need
Forward LIBOR rates given deterministically by the forward curve
today.
Below are the links for Pound Sterling Bank Liability Curve (BLC) from LIBOR-linked
instruments, OIS spot rates, Euro area curve (Government Liability) and FRB H.15 release
(Treasuries and Interest Rate Swaps, each instrument gives its own spot curve):
http://www.bankofengland.co.uk/statistics/Pages/yieldcurve/archive.aspx
http://www.bankofengland.co.uk/statistics/Documents/yieldcurve/ukois09_mdaily.xls
http://www.ecb.europa.eu/stats/money/yc/html/index.en.html
http://www.federalreserve.gov/releases/h15/data.htm
Curve Construction Yield curve bootstrapping refers to setting up par equations and solving
for discount curve and index curve (eg LIBOR) { see the scan of Chapter from Dong Qu’s (2016)
Manufacturing and Managing Customer-Driven Derivatives. Bloomberg Curves Toolkit focuses
on stripping and interpolation (stripping semi-annual coupons and converting from calendar time
to tenors). A tutorial available via Bloomberg Excel Add-in
XCTK with links to White Papers.
Matlab resources and cases are at
http://www.mathworks.co.uk/discovery/yield-curve.html.
Yield Curve.xlsm gives initial examples of forward rates bootstrapping. CQF Extra on Valuation
Framework for IR Derivatives in Today’s LIBOR World
(2011) by Wojciech Slusarski provides
Excel examples of Interpolation Methods for Curve Construction by Pat Hagan and G. West.
20

FinTech { ML Where is the added value in fintech, its innovation and services? Robo
advising automation, blockchain and crypto currency tokens. FinTech
globally, payments ecosystem and globalised settlement. Implications
for financial markets, insurance and lending.
Outcome: this elective is
best taken for your own advancement, to plan for the application of ML,
blockchain and alike for your firm or own business.
Algorithmic Trading {
AB
An example of strategy fitting the reversion to the Log-Periodic Power
Law (LPPL), a kind of statistical arbitrage. Discusses optimisation in
context of trading strategies (Slide 51 onwards). Multicharts software.
Notes on trader’s psychology.
Outcome: relevant to Arbitrage Trading
and Portfolio Construction topics for recipes on backtesting.
Portfolio Management
{ PC secondary
The elective considers dynamic investment management with the use
of SDEs. Dynamic programming solves optimisation over a stochastic
variable (eg, asset price, interest rate, risk premium).
Outcome: more
advanced than Portfolio Construction topic, recipes are Merton index of
satisfaction, Kelly criterion and venturing to Risk-Sensitive Allocation.
Behavioural Finance Heuristics, Biases and Framing. Excursion to game theory and proba
bility to formalise the psychology of choice.
Outcome: the elective is
for every aspiring data scientist, and useful to investment managers so,
Portfolio Construction/Machine Learning topic.
Risk Management The base you need to be a risk manager (read Coleman guide) and tools
for Basel regulation: (a) weakness of risk-weighted assets, (b) extreme
value theory for ES and capital requirement and (c) adjoint automatic
differentiation to compute formal sensitivities (derivatives). Other nu
mericals covered the same as Counterparty Risk.
Outcome: this elec
tive is best taken for your own advancement.
R for Quant Finance {
Dev
Thorough introduction to R and RStudio which you might would like
to review even if using R already. Numerical examples are simple, from
data types (strings, lists, data frames) to essentials of matrix compu
tation for portfolio tasks and loops for Monte Carlo
Outcome: lays
groundwork for Portfolio Construction topic but lacks in backtesting.
Computational Methods
Pricing with PDEs { LV
secondary
Considers numerical techniques in great detail: derivatives approxima
tion, root finding (Bisection, Newton), polynomial interpolation, and
numerical integration (trapezium and Simpson rules), vector and ma
trix norms.
Outcome: a refresher of methods that support modelling
with SDEs and PDEs.

Table 3: Extra Electives
21

Tags: , , , , , , , , , , ,