Quantitative Trading as a Mathematical Science

© All Rights Reserved

0 views

1quantitativetradingasamathematicalsciencebydr-161112031504

Quantitative Trading as a Mathematical Science

© All Rights Reserved

- Collaborative Optimization
- Clonal Selection Algorithms
- Neural networks
- JLPE08
- Global Optimization Using Genetic Algorithm for Portal Steel Frame with Tapered I-Section
- Continuous Time Mean Variance Asset Allocation: A Time-consistent Strategy
- Avijit_Upadhyay_Resumé_2011_IR_0
- Introduction
- 2or
- 2011-34
- Multiuser OFDMA Resource Allocation Algorithms for in-Home Power-Line Communications,
- Junior_talk.pptx
- Reprint Qua Pulse
- 035
- Hirerachical Decision Making Under Uncertainty in Relation to Telecommunication Industries
- 1147743173
- Chap5
- Jenks_Algoritimos Geneticos.pdf
- Long Term Production Scheduling
- A REVIEW OF OPTIMIZATION TECHNIQUES IN ARTIFICIAL NETWORKS.

You are on page 1of 54

Haksun Li

haksun.li@numericalmethod.com

www.numericalmethod.com

Abstract

Quantitative trading is distinguishable from other trading methodologies like

technical analysis and analysts opinions because it uniquely provides justifications

to trading strategies using mathematical reasoning. Put differently, quantitative

trading is a science that trading strategies are proven statistically profitable or even

optimal under certain assumptions. There are properties about strategies that we

can deduce before betting the first $1, such as P&L distribution and risks. There are

exact explanations to the success and failure of strategies, such as choice of

parameters. There are ways to iteratively improve strategies based on experiences of

live trading, such as making more realistic assumptions. These are all made possible

only in quantitative trading because we have assumptions, models and rigorous

mathematical analysis.

Quantitative trading has proved itself to be a significant driver of mathematical

innovations, especially in the areas of stochastic analysis and PDE-theory. For

instances, we can compute the optimal timings to follow the market by solving a

pair of coupled HamiltonJacobiBellman equations; we can construct sparse mean

reverting baskets by solving semi-definite optimization problems with cardinality

constraints and can optimally trade these baskets by solving stochastic control

problems; we can identify statistical arbitrage opportunities by analyzing the

volatility process of a stochastic asset at different frequencies; we can compute the

optimal placements of market and limit orders by solving combined singular and

impulse control problems which leads to novel and difficult to solve quasi-

variational inequalities.

2

Speaker Profile

Dr. Haksun Li

CEO, NM LTD.

(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

Ph.D., Computer Science, University of Michigan Ann

Arbor

M.S., Financial Mathematics, University of Chicago

B.S., Mathematics, University of Chicago

3

What is Quantitative Trading?

4

Quantitative Trading?

Quantitative trading is the buying and selling of assets

following the instructions computed from a set of

proven mathematical models.

The differentiation from other trading methodologies

or the emphasis is on how a strategy is proven and

not on what strategy is created.

It applies (rigorous) mathematical reasoning in all

steps during trading strategy construction from the

start to the end.

5

Moving Average Crossover as a TA

A popular TA signal: Moving Average Crossover.

A crossover occurs when a faster moving average (i.e. a

shorter period moving average) crosses above/below a

slower moving average (i.e. a longer period moving

average); then you buy/sell.

In most TA book, it is never proven only illustrated

with an example of applying the strategy to a stock for

a period of time to show profits.

6

Technical Analysis is Not Quantitative Trading

TA books merely describes the mechanics of strategies

but never prove them.

Appealing to common sense is not a mathematical

proof.

Conditional probabilities of outcomes are seldom

computed. (Lo, Mamaysky, & Wang, 2000)

Application of TA is more of an art (is it?) than a

science.

How do you choose the parameters?

For any TA rule, you almost surely can find an asset

and a period that the rule works, given the large

number of assets and many periods to choose from.

7

Fake Quantitative Models

Data snooping

Misuse of mathematics

Assumptions cannot be quantified

No model validation against the current regime

Ad-hoc take profit and stop-loss

why 2?

How do you know when a model is invalidated?

Cannot explain winning and losing trades

Cannot be analyzed (systematically)

8

The Quantitative Trading Research

Process

9

NM Quantitative Trading Research Process

1. Translate a vague trading intuition (hypothesis) into

a concrete mathematical model.

2. Translate the mathematical symbols and equations

into a computer program.

3. Strategy evaluation.

4. Live execution for making money.

10

Step 1 - Modeling

Where does a trading idea come from?

Ex-colleagues

Hearsays

Newspapers, books

TV, e.g., Moving Average Crossover (MA)

A quantitative trading strategy is a math function, f,

that at any given time, t, takes as inputs any

information that the strategy cares and that is

available, Ft, and gives as output the position to take,

f(t,Ft).

11

Step 2 - Coding

The computer code enables analysis of the strategy.

Most study of a strategy cannot be done analytically.

We must resort to simulation.

The same piece of code used for research and

investigation should go straight into the production

for live trading.

Eliminate the possibility of research-to-IT translation

errors.

12

Step 3 Evaluation/Justification

Compute the properties of a trading strategy.

the P&L distribution

the holding time distribution

the stop-loss

the maximal drawdown

http://redmine.numericalmethod.com/projects/publi

c/repository/svn-

algoquant/show/core/src/main/java/com/numericalm

ethod/algoquant/execution/performance

13

Step 4 - Trading

Put in capitals incrementally.

Install safety measures.

Monitor the performance.

Regime change detection.

14

Mathematical Analysis of Moving

Average Crossover

15

Moving Average Crossover as a Quantitative

Trading Strategy

There are many mathematical justifications to Moving

Average Crossover.

weighted Sum of lags of a time series

Kuo, 2002

Whether a strategy is quantitative or not depends not

on the strategy itself but

entirely on the process to construct it;

or, whether there is a scientific justification to prove it.

16

Step 1 - Modeling

Two moving averages: slower () and faster ().

Monitor the crossovers.

1 1 1 1

= ,>

=0 =0

Long when 0.

Short when < 0.

How to Choose and ?

It is an art, not a science (so far).

They should be related to the length of market cycles.

Different assets have different and .

Popular choices:

(250, 5)

(250 , 20)

(20 , 5)

(20 , 1)

(250 , 1)

Two Simplifications

Reduce the two dimensional problem to a one

dimensional problem.

Choose = 1. We know that m should be small.

Replace arithmetic averages with geometric averages.

This is so that we can work with log returns rather than

prices.

19

GMA(n , 1)

1

0 iff 1

=0

+1

2

=1 (by taking log)

1

1

=0

+1

< 2

=1 (by taking log)

1

What is ?

=2

=

Acar Framework

Acar (1993): to investigate the probability distribution

of realized returns from a trading rule, we need

the explicit specification of the trading rule

the underlying stochastic process for asset returns

the particular return concept involved

Knight-Satchell-Tran Intuition

Stock returns staying going up (down) depends on

the realizations of positive (negative) shocks

the persistence of these shocks

Shocks are modeled by gamma processes.

Asymmetry

Fat tails

Persistence is modeled by a Markov switching process.

Knight-Satchell-Tran

1-q

Zt = 0

Zt = 1

DOWN

UP TREND

q TREND p

1 1 1 1

2 2 2 1 = 1

= 2 1

2

1-p

Knight-Satchell-Tran Process

= + 1

: long term mean of returns, e.g., 0

, : positive and negative shocks, non-negative, i.i.d

1 1 1 1

= 1

1

2 2 2 1

= 2

2

Step 3 Evaluation/Justification

Assume the long term mean is 0, = 0.

When = 2,

0 0 = 1

< 0 < 0 = 0

GMA(2, 1) Nave MA Trading Rule

Buy when the asset return in the present period is

positive.

Sell when the asset return in the present period is

negative.

Nave MA Conditions

The expected value of the positive shocks to asset

return >> the expected value of negative shocks.

The positive shocks persistency >> that of negative

shocks.

Period Returns

= =1 1 0

hold

< 0

0 1

Sell at this time point

Holding Time Distribution

=

= < 0, 1 0, , 1 0, 0 0

= = 0, 1 = 1, , 1 = 1, 0 = 1

= = 0, 1 = 1, , 1 = 1|0 = 1 0 = 1

1 1 , T 1

=

1 , T=0

1

=

2

Conditional Returns Distribution (1)

=1 1 0

|= = E | =

=1 1 0

=E | < 0, 1 0, , 0 0

=1

=E | = 0, 1 = 1, , 1 = 1

1 ++1

=E

1 , T 1

=

, T =0

Unconditional Returns Distribution (2)

=

=1 1 0

=0 E | = =

=

1

=1 1

1 + 1

= 1 + 1

1

Expected Returns

E = 0

1

= 1

1

When is the expected return positive?

1

, shock impact

, shock impact

1 , if , persistence

GMA(,1) Rule

1

1

=0

1 1

ln ln

=0

ln 1

GMA(,1) Expected Returns

=

1 + +

1 1 +

E = 1 1 +

MA Using the Whole History

An investor will always expect to lose money using

GMA(,1)!

An investor loses the least amount of money when the

return process is a random walk.

Optimal MA Parameters

So, what are the optimal and ?

Step 2: AR(1)

Step 2 : ARMA(1, 1)

no systematic

winner

optimal

order

Step 2 : ARIMA(0, d, 0)

Live Results of Quantitative Trading

Strategies

41

Unique Guiding Principle

What Others Do: What We Do:

Start with a trading strategy. Start with simple assumptions

about the market.

Find the data that the Compute the optimal trading

strategy works. strategy given the

Result: assumptions.

Paper P&L looks good. Result:

Can mathematically prove

Live P&L depends on luck. that no other strategy will

Trading strategies are work better in the same

results of a non-scientific, market conditions.

a pure data snooping Trading strategies are results

of a scientific process.

process.

42

Optimal Trend Following (TREND)

We make assumptions that the market is a two (or 160.00%

three) state model. The market state is either up,

down, (or sideway). 140.00%

negative, or zero drift. 100.00%

We use math to compute what the best thing to do is 80.00%

in each of the states.

60.00%

We estimate the conditional probability, , of that the

market is going up given all the available information. 40.00%

When is big enough, i.e., most certainly that the 20.00%

market is going up, we buy.

0.00%

Result:

trading period 2015/1/2 - 2016/5/2

Hang Seng china enterprises

assets traded index futures

annualized

return 107.00%

max

drawdown 6.61%

Sharpe ratio 4.79

Optimal Trend Following (Math)

Two state Markov model for a stocks prices: BULL and Value function:

BEAR. J0 , , , 0 =

1 +

= + , < E 1

=1 log + < log 1+ + +1

The trading period is between time , .

J1 , , , 1 =

= 1,2 are the two Markov states that indicates

1

the BULL and BEAR markets. log + 2 1 + log 1 +

E 1

1 > 0

=2 log + < log 1+ + +1

the value functions are maximized.

1 1

= , the generator matrix for the Markov , = sup , , ,

2 2

1

E0, = 1 , = sup log

1

+ log 1 + 0 1 , 1

1

1 <

E 1 =1 +1

1+

Hamilton-Jacobi-Bellman Equations

We are long between and and the return is

determined by the price change discounted by the min 0 , 0 1 + log 1 + = 0

min 1 , 1 0 log 1 = 0

commissions.

0 , = 0

We are flat between and +1 and the money with terminal conditions:

1 , = log 1

grows at the risk free rate. 1 1 2 1 2

= + + 1 + 2 + 2

2

Based on: M Dai, Q Zhang, QJ Zhu, "Trend following trading under a regime switching

model," SIAM Journal on Financial Mathematics, 2010.

Optimal Mean Reversion (MR)

Basket construction problem:

Select the right financial instruments.

Obtain the optimal weights for the

selected financial instruments.

Basket trading problem:

Given the portfolio can be modelled

as a mean reverting OU process,

dynamic spread trading is a stochastic

optimal control problem.

Given a fixed amount of capital,

dynamically allocate capital over a

risky mean reverting portfolio and a

risk-free asset over a finite time

horizon to maximize a general

constant relative risk aversion (CRRA)

utility function of the terminal

wealth .

Allocate capital amongst several

mean reverting portfolios.

Based on: Mudchanatongsuk, S., Primbs, J.A., Wong, " Optimal Pairs Trading: A

Stochastic Control Approach," Dept. of Manage. Sci. & Eng., Stanford Univ., CA.

45

Optimal Mean Reversion (Math)

Assume a risk free asset , which satisfies

=

Assume two assets, and .

Assume follows a geometric Brownian

motion.

= +

is the spread between the two assets.

covariance selection = log log

= + +

1

= + 2 + + +

2

max , s.t.,

0 = 0 , x 0 = 0

= +

= = +

= + 2 +

1 2

46

Intraday Volatility Trading (VOL)

In mid or high frequency trading, or 140.00%

80.00%

20.00%

0.00%

-20.00%

loss region

Live Result:

trading period 2014/2/27 - 2015/2/27

profit region

Hang Seng china enterprises

assets traded index futures

annualized

return 122.32%

max

drawdown 10.24%

Sharpe ratio 18.45

47

Intraday Volatility Trading (Math)

For a continuous price process , we Define a trading strategy such that the

define H-variation position of X is:

, = sup =1 1 , =

,

=1 sign 1 1 1,

It can be shown that for any H, there

exists a sequence , =0,1,, such The trend following P&L is:

that =0,1,, are Markovian and

, = 0 ,

are defined by on intervals 1 , .

And they satisfy the equality: = , 2 , +

, =

=1 1 The expected income per trade is:

, is the number of KAGI-

, = 0 ,

inversion in the T-interval.

,

H-volatility: , =

,

,

, = lim E , = 2

,

For an no-arbitrage Wiener process, we

have

lim , = = 2

analysis," Theory of Probability & Its Applications, SIAM, 2005.

48

Optimal Market Making (MM)

We optimally place limit and market 40.00%

orders depending on the current 35.00%

inventory and spread. 30.00%

25.00%

20.00%

the best market making strategy:

15.00%

10.00%

5.00%

0.00%

Live Result:

trading period 2015/7/16 - 2016/3/1

rebar + iron ore commodity

assets traded futures

annualized

return 65%

max

drawdown 0.90%

Sharpe ratio 16.71

49

Optimal Market Making (Math)

State variable: Quasi-Variational Inequality

, , , min sup , + , = 0

Objective: , , , , = , , ,

max E 0

=1 , , , , , ,

= 0, e.g., dont hold position overnight sup , , , + , , , ,

min =0

: utility function

sup , + , , , , , ,

+,

: terminal wealth , , , sup , , , + ,

: penalty for holding inventory , , , = , ,

Liquidation function (how much we get by selling Assumptions:

everything): = ; we care about only how much money made.

, , , = , , = + is a martingale; we know nothing about where the market will move.

2

Solution:

Equivalent problem (get rid of = 0):

, , , = + + ,

max E , , , 0 , is the solution to the system of integro-differential equations

(IDE):

Value function:

=1 , ,

, , = sup E , sup , + , +

1 =+

,, 2

min sup , , +

1 = =0

= , , 2

+ ,

This is a mixed regular/impulse control problem in a , sup , +

regime switching jump-diffusion model. 2

, =

2

Based on: F Guilbaud, H Pham, "Optimal high-frequency trading with limit and market

orders," Quantitative Finance, 2013.

50

Conclusions

51

FinMath Infrastructure Support

All these mathematics and simulations are possible only with a

finmath technology that serves as the modeling infrastructure.

Applications

Financial

Mathematics

Advanced Cointegration Time Series Analysis

SQP, SDP, SOCP, IP,

Digital Signal Processing

GA)

Mathematics

Unconstrained

optimization

Statistics Differential

Equations

Parallelization

Mathematics

= local minimum

global minimum

52

The Essential Skills

Financial intuitions, market understanding, creativity.

Mathematics.

Computer programming.

53

An Emerging Field

It is a financial industry where mathematics and

computer science meet.

It is an arms race to build

more reliable and faster execution platforms (computer

science);

more comprehensive and accurate prediction models

(mathematics).

54

- Collaborative OptimizationUploaded byMarce Soto
- Clonal Selection AlgorithmsUploaded byAmir_Samir_7319
- Neural networksUploaded byAdrián Villagrana Hernández
- JLPE08Uploaded byVandita Gupta
- Global Optimization Using Genetic Algorithm for Portal Steel Frame with Tapered I-SectionUploaded byIOSRjournal
- Continuous Time Mean Variance Asset Allocation: A Time-consistent StrategyUploaded bymirando93
- Avijit_Upadhyay_Resumé_2011_IR_0Uploaded byavijitupadhyay22
- IntroductionUploaded byakbisoi1
- 2orUploaded byY.f. Liang
- 2011-34Uploaded bysuchi87
- Multiuser OFDMA Resource Allocation Algorithms for in-Home Power-Line Communications,Uploaded byMuhammad Naeem
- Junior_talk.pptxUploaded byMartin Quang Nguyen
- Reprint Qua PulseUploaded bycristiionut1234
- 035Uploaded byYusuf Nasir
- Hirerachical Decision Making Under Uncertainty in Relation to Telecommunication IndustriesUploaded byIJSTR Research Publication
- 1147743173Uploaded byNikunj Jadawala
- Chap5Uploaded bytejashraj93
- Jenks_Algoritimos Geneticos.pdfUploaded bymontgomery999
- Long Term Production SchedulingUploaded byHamid Kor
- A REVIEW OF OPTIMIZATION TECHNIQUES IN ARTIFICIAL NETWORKS.Uploaded byIJAR Journal
- Namwook Kim_2011.pdfUploaded byAbderrezak Badji
- INTECH-Genetic Algorithm and Simulated AnnealingApplication to Subsynchronous Damping Control in Electrical Power Transmission SystemsUploaded byJuancho Mesa
- General Pattern Search Applied to the Optimization of the Shell and Tube Heat ExchangerUploaded byIJAERS JOURNAL
- Optimal Management of Land and WaterUploaded byNanditha Mandava Chowdary
- iQclampcontrol_info_EN.pdfUploaded byMarius Vaida
- 126084433-Ansys-Advanced-Analysis-Techniques-Guide.pdfUploaded byAndy
- 1-s2.0-S1474667017534916-main.pdfUploaded bysymon
- Transportation ProblemUploaded bypuneeth h
- Markove Chain and Application in Forecasting (1)Uploaded byMazen Alsakran
- commercialUploaded byAnonymous HGEL832

- stock priceUploaded bySingh Ak
- Regulatory Compliance and Banks Key Challenges and Effective SolutionsUploaded byKofi Appiah-Danquah
- Intellectual Property...a Powerful Tool for Economic GrowthUploaded byKofi Appiah-Danquah
- Classical Asset Allocation - Combining Markowitz and MomentumUploaded byKofi Appiah-Danquah
- User Manual,Virtual BoxUploaded byRafael
- L18.cumulantsUploaded byKofi Appiah-Danquah
- ConnorsRSI Pullbacks GuidebookUploaded byBill Hunter
- Career Outlook - Financial SpecialistsUploaded byKofi Appiah-Danquah
- pydata2013-131109164613-phpapp02Uploaded byKofi Appiah-Danquah
- Covariance Identities and Mixing of Random Transformation of the Wiener SpaceUploaded byKofi Appiah-Danquah
- tmp_524-btc-guide339320327Uploaded byHamid Mahmood
- a-gentle-introduction-to-blockchain-technology-web.pdfUploaded byFiroz
- Moment Identities for Poisson-Skorohod IntegralsUploaded byKofi Appiah-Danquah
- ON THE CONSTRUCTION OF ALMOST UNIFORMLY CONVERGENT RANDOM VARIABLESUploaded byKofi Appiah-Danquah
- Vector Calc NotesUploaded byKofi Appiah-Danquah
- Computational FinanceUploaded byJms008
- 1.4 Sampling and Sources of BiasUploaded byKofi Appiah-Danquah
- 1.2 Data Basics.pdfUploaded byKofi Appiah-Danquah
- rmarkdown-reference.pdfUploaded byKofi Appiah-Danquah
- High dimensional statistical inference and random matricesUploaded byKofi Appiah-Danquah
- Algorithmic and High-frequency Trading - An OverviewUploaded byKofi Appiah-Danquah
- Self EmploymentUploaded byKofi Appiah-Danquah
- Statistics Machine Learning Python DraftUploaded byKofi Appiah-Danquah
- Windows Installation Guide v 1Uploaded byKofi Appiah-Danquah
- Strategies for Effective Wall Post.pdfUploaded byKofi Appiah-Danquah
- The Complete Guide to Facebook AnalyticsUploaded byBob Hazlett
- Computational Finance on GPUUploaded byKofi Appiah-Danquah
- Quant TradingUploaded byChristopher M. Patten
- Karel the Robot Learn JavaUploaded byBank

- vol2-no5-7 dwdadwdwaUploaded byFelix Santoso
- ATR-72 AMM-33 (5)Uploaded byGino Acevedo
- Loop Mesh AnalysisUploaded byOmkar Kumar Jha
- YagnopavitaUploaded byAvinash
- Asthma Management GuideUploaded bythisar
- speech analysisUploaded byapi-309382230
- Elias on 1983Uploaded byJesusCordoba
- 27-AprvdSaw[1]Uploaded byMarleneLopes
- The Little Mermaid Script (Edit)-3Uploaded byolivia_mc
- DSCUploaded byEdwin Kamalha
- 2450APBCUploaded byperuingenieros
- Pro Tools 10-3-5 Read Me Windows 79230Uploaded byJhoncyto
- Annotated Bibliography- Gustav HolstUploaded bybaconjeans7
- ix_phy.pdfUploaded byAdt
- People vs. Feliciano Et Al May 5, 2014Uploaded byMaria O
- Video and Image ProcessingUploaded byNisal Nuwan Senarathna
- Cell and Molecular Biology _ What We Know & How We Found It (SecoUploaded byphyaravi
- 110 YogasUploaded byNeoHooda
- 0521829712Uploaded byPablo A. Bardanca
- Techno-economic Feasibility Study of a Small-scale Biogas Plant for Treating Market Waste in the City of El AltoUploaded bybambang ismail
- it-ppt-template-002.pptUploaded byMisti Miller
- Global Corporate CitizenshipUploaded byDaniel Macharia
- CPP ACP PowderUploaded bysharfina02
- For Solutions call us at +91-9911899400 (What’s App) ANNAMALAI UNIVERSITY DIRECTORATE OF DISTANCE EDUCATION M.B.A. FINANCIAL MANAGEMENT SECOND YEAR Academic Year 2018 - 2019 ASSIGNMENT TOPICSUploaded byAvinash Kaur
- 2SC5047 NPN Horisontal Deflection (1600V 25A 250W)Uploaded byclaudjiu
- IES Conventional Electronics 2017 PAPER 2Uploaded byhelloskverma8
- visual media analysis rubricUploaded byapi-292240483
- Kaplan 1980Uploaded byLuke Haoqi Wu
- Database Ppt DeadlockUploaded byWorking Person
- The Investigation of Freezing Point of Vegetable OilUploaded byAdz

## Much more than documents.

Discover everything Scribd has to offer, including books and audiobooks from major publishers.

Cancel anytime.