2. Speaker Profile
ο½ Dr. Haksun Li
ο½ CEO, Numerical Method Inc.
ο½ (Ex-)Adjunct Professors, Industry Fellow, Advisor,
Consultant with the National University of Singapore,
Nanyang Technological University, Fudan University,
the Hong Kong University of Science and Technology.
ο½ Quantitative Trader/Analyst, BNPP, UBS
ο½ PhD, Computer Sci, University of Michigan Ann Arbor
ο½ M.S., Financial Mathematics, University of Chicago
ο½ B.S., Mathematics, University of Chicago
2
3. References
ο½ Optimal Pairs Trading: A Stochastic Control
Approach. Mudchanatongsuk, S., Primbs, J.A., Wong,
W. Dept. of Manage. Sci. & Eng., Stanford Univ.,
Stanford, CA. 2008.
ο½ Optimal Trend Following Trading Rules. Dai, M.,
Zhang, Q., Zhu Q. J. 2011
3
5. Stochastic Control
ο½ We model the difference between the log-returns of
two assets as an Ornstein-Uhlenbeck process.
ο½ We compute the optimal position to take as a function
of the deviation from the equilibrium.
ο½ This is done by solving the corresponding the
Hamilton-Jacobi-Bellman equation.
5
6. Formulation
ο½ Assume a risk free asset ππ‘, which satisfies
ο½ πππ‘ = πππ‘ ππ
ο½ Assume two assets,π΄ π‘ and π΅π‘.
ο½ Assume π΅π‘follows a geometric Brownian motion.
ο½ ππ΅π‘ = ππ΅π‘ ππ + ππ΅π‘ ππ§π‘
ο½ π₯ π‘is the spread between the two assets.
ο½ π₯π‘ = log π΄ π‘ β log π΅π‘
6
7. Ornstein-Uhlenbeck Process
ο½ We assume the spread, the basket that we want to
trade, follows a mean-reverting process.
ο½ ππ₯π‘ = π π β π₯π‘ ππ + πππ π‘
ο½ π is the long term equilibrium to which the spread
reverts.
ο½ π is the rate of reversion. It must be positive to ensure
stability around the equilibrium value.
7
8. Instantaneous Correlation
ο½ Let π denote the instantaneous correlation coefficient
between π§ and π.
ο½ πΈ ππ π‘ ππ§π‘ = πππ
8
9. Univariate Itoβs Lemma
9
ο½ Assume
ο½ πππ‘ = π π‘ ππ + ππ‘ ππ΅π‘
ο½ π π‘, ππ‘ is twice differentiable of two real variables
ο½ We have
ο½ ππ π‘, ππ‘ =
ππ
ππ
+ π π‘
ππ
ππ
+
ππ‘
2
2
π2 π
ππ₯2 ππ + ππ‘
ππ
ππ
ππ΅π‘
15. Notations
ο½ ππ‘: the value of a self-financing pairs trading portfolio
ο½ β π‘:the portfolio weight for stock A
ο½ β π‘
οΏ½ = ββ π‘:the portfolio weight for stock B
15
18. Problem Formulation
ο½ max
β π‘
πΈ ππ
πΎ
, s.t.,
ο½ π 0 = π£0, x 0 = π₯0
ο§ ππ₯π‘ = π π β π₯π‘ ππ + πππ π‘
ο½ πππ‘ = β π‘ ππ₯ π‘ = β π‘ π π β π₯ π‘ ππ + β π‘ πππ π‘
ο½ Note that we simplify GBM to BM of ππ‘, and remove
some constants.
18
19. Dynamic Programming
19
ο½ Consider a stage problem to minimize (or maximize)
the accumulated costs over a system path.
s0
s11
s12
time
t = 0 t = 1
S21
S22
s23
t = 2
3
2
3
5
Cost = π3 + β ππ‘
2
π‘=0
s3
s12
5
4
3
1
5
20. Dynamic Programming Formulation
ο½ State change: π₯ π+1 = ππ π₯ π, π’ π, π π
ο½ π: time
ο½ π₯ π: state
ο½ π’ π: control decision selected at time π
ο½ π π: a random noise
ο½ Cost: π π π₯ π + β π π π₯ π, π’ π, π π
πβ1
π=0
ο½ Objective: minimize (maximize) the expected cost.
ο½ We need to take expectation to account for the noise, π π.
20
21. Principle of Optimality
ο½ Let πβ
= π0
β, π1
β, β― , π πβ1
β be an optimal policy for
the basic problem, and assume that when using πβ
, a
give state π₯π occurs at time π with positive probability.
Consider the sub-problem whereby we are at π₯π at time
π and wish to minimize the βcost-to-goβ from time π to
time π.
ο½ πΈ π π π₯ π + β π π π₯ π, π’ π, π π
πβ1
π=π
ο½ Then the truncated policy ππ
β, ππ+1
β, β― , π πβ1
β is
optimal for this sub-problem.
21
22. Dynamic Programming Algorithm
ο½ For every initial state π₯0, the optimal cost π½β
π₯ π of the
basic problem is equal to π½0 π₯0 , given by the last step
of the following algorithm, which proceeds backward
in time from period π β 1 to period 0:
ο½ π½ π π₯ π = π π π₯ π
ο½ π½ π π₯ π = min
π’ π
πΈ π π π₯ π, π’ π, π π + π½ π+1 ππ π₯ π, π’ π, π π
22
46. Riccati Equation
ο½ A Riccati equation is any ordinary differential equation
that is quadratic in the unknown function.
ο½ πΌ π‘ =
π
π2 π2
+ 2π 1 β 2π πΌ + 2π2
2π β 1 πΌ2
ο½ πΌ π‘ = π΄0 + π΄1 πΌ + π΄2 πΌ2
46
47. Solving a Riccati Equation by Integration
ο½ Suppose a particular solution, πΌ1, can be found.
ο½ πΌ = πΌ1 +
1
π§
is the general solution, subject to some
boundary condition.
47
48. Particular Solution
ο½ Either πΌ1 or πΌ2 is a particular solution to the ODE.
This can be verified by mere substitution.
ο½ πΌ1,2 =
βπ΄1Β± π΄1
2
β4π΄2 π΄0
2π΄2
48
65. P&L for Simulated Data
ο½ The portfolio increases from $1000 to $4625 in one year.
65
66. Parameter Estimation
ο½ Can be done using Maximum Likelihood.
ο½ Evaluation of parameter sensitivity can be done by
Monte Carlo simulation.
ο½ In real trading, it is better to be conservative about the
parameters.
ο½ Better underestimate the mean-reverting speed
ο½ Better overestimate the noise
ο½ To account for parameter regime changes, we can use:
ο½ a hidden Markov chain model
ο½ moving calibration window
66