Introduction to Algorithmic Trading Strategies Lecture 10
Transcript of Introduction to Algorithmic Trading Strategies Lecture 10
![Page 1: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/1.jpg)
Introduction to Algorithmic Trading Strategies Lecture 10
Risk Management
Haksun Li [email protected]
www.numericalmethod.com
![Page 2: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/2.jpg)
Outline Value at Risk (VaR) Extreme Value Theory (EVT)
![Page 3: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/3.jpg)
References AJ McNeil. Extreme Value Theory for Risk Managers.
1999. Blake LeBaron, Ritirupa Samanta. Extreme Value
Theory and Fat Tails in Equity Markets. November 2005.
![Page 4: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/4.jpg)
Risks Financial theories say: the most important single source of profit is risk. profit β risk.
I personally do not agree.
![Page 5: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/5.jpg)
What Are Some Risks? (1) Bonds: duration (sensitivity to interest rate) convexity term structure models
Credit: rating default models
![Page 6: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/6.jpg)
What Are Some Risks? (2) Stocks volatility correlations beta
Derivatives delta gamma vega
![Page 7: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/7.jpg)
What Are Some Risks? (3) FX volatility target zones spreads term structure models of related currencies
![Page 8: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/8.jpg)
Other Risks? Too many to enumerate⦠natural disasters, e.g., earthquake war politics operational risk regulatory risk wide spread rumors alien attack!!!
Practically infinitely many of themβ¦
![Page 9: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/9.jpg)
VaR Definition Given a loss distribution, πΉ, quintile 1 > q β₯ 0.95, VaRπ = πΉβ1 π
![Page 10: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/10.jpg)
Expected Shortfall Suppose we hit a big loss, what is its expected size? ESπ = πΈ π|π > VaRπ
![Page 11: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/11.jpg)
VaR in Layman Term VaR is the maximum loss which can occur with certain
confidence over a holding period (of π days). Suppose a daily VaR is stated as $1,000,000 to a 95%
level of confidence. There is only a 5% chance that the loss the next day
will exceed $1,000,000.
![Page 12: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/12.jpg)
Why VaR? Is it a true way to measure risk? NO!
Is it a universal measure accounting for most risks? NO!
Is it a good measure? NO!
Only because the industry and regulators have adopted it. It is a widely accepted standard.
![Page 13: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/13.jpg)
VaR Computations Historical Simulation Variance-CoVariance Monte Carlo simulation
![Page 14: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/14.jpg)
Historical Simulations Take a historical returns time series as the returns
distribution. Compute the loss distribution from the historical
returns distribution.
![Page 15: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/15.jpg)
Historical Simulations Advantages Simplest Non-parametric, no assumption of distributions, no
possibility of estimation error
![Page 16: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/16.jpg)
Historical Simulations Dis-Advantages As all historical returns carry equal weights, it runs the
risk of over-/under- estimate the recent trends. Sample period may not be representative of the risks. History may not repeat itself. Cannot accommodate for new risks. Cannot incorporate subjective information.
![Page 17: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/17.jpg)
Variance-CoVariance Assume all returns distributions are Normal. Estimate asset variances and covariances from
historical data. Compute portfolio variance. ππ2 = β ππππππππππππ,π
![Page 18: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/18.jpg)
Variance-CoVariance Example 95% confidence level (1.645 stdev from mean) Nominal = $10 million Price = $100 Average return = 7.35% Standard deviation = 1.99% The VaR at 95% confidence level = 1.645 x 0.0199 =
0.032736 The VaR of the portfolio = 0.032736 x 10 million =
$327,360.
![Page 19: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/19.jpg)
Variance-CoVariance Advantages Widely accepted approach in banks and regulations. Simple to apply; straightforward to explain. Datasets immediately available very easy to estimate from historical data free data from RiskMetrics http://www.jpmorgan.com
Can do scenario tests by twisting the parameters. sensitivity analysis of parameters give more weightings to more recent data
![Page 20: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/20.jpg)
Variance-CoVariance Disadvantages Assumption of Normal distribution for returns, which
is known to be not true. Does not take into account of fat tails. Does not work with non-linear assets in portfolio, e.g.,
options.
![Page 21: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/21.jpg)
Monte Carlo Simulation You create your own returns distributions. historical data implied data economic scenarios
Simulate the joint distributions many times. Compute the empirical returns distribution of the
portfolio. Compute the (e.g., 1%, 5%) quantile.
![Page 22: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/22.jpg)
Monte Carlo Simulation Advantages Does not assume any specific models, or forms of
distributions. Can incorporate any information, even subjective
views. Can do scenario tests by twisting the parameters. sensitivity analysis of parameters give more weightings to more recent data
Can work with non-linear assets, e.g., options. Can track path-dependence.
![Page 23: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/23.jpg)
Monte Carlo Simulation Disadvantages Slow. To increase the precision by a factor of 10, we must make
100 times more simulations. Various variance reduction techniques apply.
antithetic variates control variates importance sampling stratified sampling
Difficult to build a (high) multi-dimensional joint distribution from data.
![Page 24: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/24.jpg)
100-Year Market Crash How do we incorporate rare events into our returns
distributions, hence enhanced risk management? Statistics works very well when you have a large
amount of data. How do we analyze for (very) small samples?
![Page 25: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/25.jpg)
Fat Tails
![Page 26: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/26.jpg)
QQ A QQ plots display the quintiles of the sample data
against those of a standard normal distribution. This is the first diagnostic tool in determining whether
the data have fat tails.
![Page 27: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/27.jpg)
QQ Plot
![Page 28: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/28.jpg)
Asymptotic Properties The (normalized) mean of a the sample mean of a
large population is normally distributed, regardless of the generating distribution.
What about the sample maximum?
![Page 29: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/29.jpg)
Intuition Let π1, β¦, ππ be i.i.d. with distribution πΉ π₯ . Let the sample maxima be ππ = π π = mππ₯
πππ.
π ππ β€ π₯ = π π1 β€ π₯, β¦ ,ππ β€ π₯ = β π ππ β€ π₯π
π=1 = πΉπ π₯ What is lim
πββπΉπ π₯ ?
![Page 30: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/30.jpg)
Convergence Suppose we can scale the maximums ππ and change
the locations (means) ππ . There may exist non-negative sequences of these such
that ππβ1 ππ β ππ β π, π is not a point π» π₯ = lim
πββπ ππβ1 ππ β ππ β€ π₯
= limπββ
π ππ β€ πππ₯ + ππ
= limπββ
πΉπ πππ₯ + ππ
![Page 31: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/31.jpg)
Example 1 (Gumbel) πΉ π₯ = 1 β πβππ, π₯ > 0. Let ππ = πβ1, ππ = πβ1 logπ. π π ππ β πβ1 logπ β€ π₯ = π ππ β€ πβ1 π₯ + logπ = 1 β πβ π+log π π
= 1 β πβπ₯
π
π
β πβπβπ₯ = πβπβπ₯1 π>0
![Page 32: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/32.jpg)
Example 2 (FreΒ΄chet)
πΉ π₯ = 1 β ππΌ
π+π πΌ = 1 β 1
1+π₯ππΌ, π₯ > 0.
Let ππ = ππ1πΌ, ππ = 0.
π πβ1πβ1/πΌππ β€ π₯ = π ππ β€ ππ1/πΌπ₯
= 1 β 11+π1/ππ πΌ
π
~ 1 β 1π1/ππ πΌ
π
= 1 β πβπΌ
π
π
β πβπβπΌ1 π>0
![Page 33: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/33.jpg)
Fisher-Tippett Theorem It turns out that π» can take only one of the three
possible forms. FreΒ΄chet Ξ¦πΌ π₯ = πβπβπΌ1 π>0
Gumbel Ξ π₯ = πβπβπ₯1 π>0
Weibull Ξ¨πΌ π₯ = πβ βπ πΌ1 π<0
![Page 34: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/34.jpg)
Maximum Domain of Attraction FreΒ΄chet Fat tails E.g., Pareto, Cauchy, student t,
Gumbel The tail decay exponentially with all finite moments. E.g., normal, log normal, gamma, exponential
Weibull Thin tailed distributions with finite upper endpoints, hence
bounded maximums. E.g., uniform distribution
![Page 35: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/35.jpg)
Why FreΒ΄chet? Since we care about fat tailed distributions for
financial asset returns, we rule out Gumbel. Since financial asset returns are theoretically
unbounded, we rule out Weibull. So, we are left with FreΒ΄chet, the most common MDA
used in modeling extreme risk.
![Page 36: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/36.jpg)
FreΒ΄chet Shape Parameter πΌ is the shape parameter. Moments of order π greater than πΌ are infinite. Moments of order π smaller than πΌ are finite. Student t distribution has πΌ β₯ 2. So its mean and variance
are well defined.
![Page 37: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/37.jpg)
FreΒ΄chet MDA Theorem πΉ β MDAπ», π» FreΒ΄chet if and only if the complement cdf πΉοΏ½ π₯ = π₯βπΌπΏ π₯ πΏ is slowly varying function lim
πββπΏ π‘ππΏ π
= 1, π‘ > 0
This restricts the maximum domain of attraction of the FreΒ΄chet distribution quite a lot, it consists only of what we would call heavy tailed distributions.
![Page 38: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/38.jpg)
Generalized Extreme Value Distribution (GEV)
π»π π₯ = πβ 1+ππ β1π , π β 0 π»π π₯ = πβπβπ₯, π = 0 lim
πββ1 + π
π
βπ= πβπ
tail index π = 1πΌ
FreΒ΄chet: π > 0 Gumbel:π = 0 Weibull: π < 0
![Page 39: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/39.jpg)
Generalized Pareto Distribution
πΊπ π₯ = 1 β 1 + ππ₯ β1π πΊ0 π₯ = 1 β πβπ simply an exponential distribution
Let π = π½π, π~πΊπ.
πΊπ,π½ = 1 β 1 + π π¦π½
β1π
πΊ0,π½ = 1 β πβπ¦π½
![Page 40: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/40.jpg)
The Excess Function Let π’ be a tail cutoff threshold. The excess function is defined as: πΉπ’ π₯ = 1 β πΉπ’οΏ½ π₯
πΉπ’οΏ½ π₯ = π π β π’ > π₯|π > π’ = π π>π’+ππ π>π’
= πΉοΏ½ π+π’πΉοΏ½ π’
![Page 41: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/41.jpg)
Asymptotic Property of Excess Function Let π₯πΉ = inf π₯:πΉ π₯ = 1 . For each π, πΉ β MDA π»π , if and only if lim
π’βππΉβsup
0<π<ππΉβπ’πΉπ’ π₯ β πΊπ,π½ π’ π₯ = 0
If π₯πΉ = β, we have lim
π’ββsupπ
πΉπ’ π₯ β πΊπ,π½ π’ π₯ = 0
Applications: to determine π, π’, etc.
![Page 42: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/42.jpg)
Tail Index Estimation by Quantiles Hill, 1975 Pickands, 1975 Dekkers and DeHaan, 1990
![Page 43: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/43.jpg)
Hill Estimator
ππ,ππ» = 1
πβ1β lnπβπ β lnπβπβπ,ππβ1π=1
πβ: the order statistics of observations π: the number of observations in the (left) tail Mason (1982) shows that ππ,π
π» is a consistent estimator, hence convergence to the true value.
Pictet, Dacorogna, and Muller (1996) show that in finite samples the expectation of the Hill estimator is biased.
In general, bigger (smaller) π gives more (less) biased estimator but smaller (bigger) variance.
![Page 44: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/44.jpg)
POT Plot
![Page 45: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/45.jpg)
Pickands Estimator
ππ,ππ = ln πβπβπβ2π / πβ2πβπβ4π
ln 2
![Page 46: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/46.jpg)
Dekkers and DeHaan Estimator
ππ,ππ· = ππ,π
π» + 1 β 12
1 β ππ,ππ» 2
ππ,ππ»2
β1
ππ,ππ»2 = 1
πβ1β lnπβπ β lnπβπ 2πβ1π=1
![Page 47: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/47.jpg)
VaR using EVT For a given probability π > πΉ π’ the VaR estimate is
calculated by inverting the excess function. We have:
VaRποΏ½ = π’ + π½οΏ½
ποΏ½ππ
1 β πβποΏ½β 1
Confidence interval can be computed using profile likelihood.
![Page 48: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/48.jpg)
ES using EVT
ESποΏ½ = VaRποΏ½
1βποΏ½+ π½οΏ½βποΏ½π’
1βποΏ½
![Page 49: Introduction to Algorithmic Trading Strategies Lecture 10](https://reader030.fdocuments.in/reader030/viewer/2022012615/619dcb637487795a0803de9f/html5/thumbnails/49.jpg)
VaR Comparison
http://www.fea.com/resources/pdf/a_evt_1.pdf