56
1 SAMPLE PATH BASED OPTIMAL POSITION LIQUIDATION WITH CVAR RISK By SUIYI SU A THESIS PRESENTED TO THE GRADUATE SCHOOL OF THE UNIVERSITY OF FLORIDA IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF MASTER OF SCIENCE UNIVERSITY OF FLORIDA 2012

By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

1

SAMPLE PATH BASED OPTIMAL POSITION LIQUIDATION WITH CVAR RISK

By

SUIYI SU

A THESIS PRESENTED TO THE GRADUATE SCHOOL OF THE UNIVERSITY OF FLORIDA IN PARTIAL FULFILLMENT

OF THE REQUIREMENTS FOR THE DEGREE OF MASTER OF SCIENCE

UNIVERSITY OF FLORIDA

2012

Page 2: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

2

© 2012 Suiyi Su

Page 3: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

3

This thesis is dedicated to my parents who support me all the way from the beginning of

this study It is also dedicated to my lovely girlfriend for her understanding during my research

Page 4: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

4

ACKNOWLEDGMENTS

I would like to express my sincere gratitude to my advisor, Professor Stan

Uryasev, Director of Risk Management and Financial Engineering Lab, University of

Florida, for his continuous support to my master’s study and research. Without his

patience, encouragement and guidance, I would not have finished the present thesis.

I am also grateful to my co-advisor, Professor Guanghui Lan, for his suggestions

and understanding during the writing of this thesis.

My warm thanks also goes to Dr. Pavlo Krokhmal, Blunt Cynthia, Peter

Tsyurmasto and my friends who have provided their assistance during my study.

I owe my loving thanks to my mother Huixian Qu, my father Sha Su and my

girlfriend Kun Zhao. Their support and encouragement always helped me in the hardest

time in my life and study.

Page 5: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

5

TABLE OF CONTENTS

page

ACKNOWLEDGMENTS .................................................................................................. 4

LIST OF TABLES ............................................................................................................ 7

LIST OF FIGURES .......................................................................................................... 8

LIST OF ABBREVIATIONS ............................................................................................. 9

ABSTRACT ................................................................................................................... 10

CHAPTER

1 INTRODUCTION .................................................................................................... 11

1.1 Motivation ...................................................................................................... 11

1.2 Related Work ................................................................................................ 12 1.3 Overview of Thesis ........................................................................................ 13

2 BACKGROUND ...................................................................................................... 15

3 SAMPLE-PATH MODEL ......................................................................................... 17

3.1 Objective Function ............................................................................................ 17

3.2 Price Impact Function ....................................................................................... 20 3.2.1 Perfect Frictionless Market ...................................................................... 21

3.2.2 Temporary Market Impact ....................................................................... 21 3.2.3 Permanent Market Impact ....................................................................... 22

3.3 Constraints ........................................................................................................ 22

3.3.1 Nonanticipativity Constraints ................................................................... 23 3.3.2 Monotonicity Constraints ......................................................................... 25

3.3.3 Risk Constraints ...................................................................................... 25 3.4 Lower-Bound Problem ...................................................................................... 26

4 CASE STUDY ......................................................................................................... 30

4.1 Data .................................................................................................................. 30 4.2 Optimization Problems ...................................................................................... 30

4.2.1 Problem 1 ................................................................................................ 31 4.2.1.1 Mathematical format....................................................................... 31

4.2.1.2 Portfolio safeguard format .............................................................. 32 4.2.2 Problem 2 ................................................................................................ 32

4.2.2.1 Mathematical format....................................................................... 32 4.2.2.2 Portfolio safeguard format .............................................................. 33

Page 6: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

6

4.2.3 Problem 3 ................................................................................................ 33

4.2.3.1 Mathematical format....................................................................... 33 4.2.3.2 Portfolio safeguard format .............................................................. 34

4.3 Results .............................................................................................................. 34 4.3.1 Lower-bound Optimal Trading Strategy ................................................... 34 4.3.2 Computational Performance .................................................................... 37

5 CONCLUSION ........................................................................................................ 39

5.1 Computational Efficiency .................................................................................. 39

5.2 Future Work ...................................................................................................... 41

APPENDIX

A PROBLEM STATEMENT FOR PSG RUN-FILE ..................................................... 43

Problem 1 ............................................................................................................... 43 Problem 2 ............................................................................................................... 43 Problem 3 ............................................................................................................... 43

B MATLAB SCRIPT TO GENERATE INPUT MATRICES .......................................... 45

Matrices Generating Script for problem 1 and 3 ..................................................... 45

Matrices Generating Script for Problem 2 ............................................................... 49 Function to Print Data into Packed Matrices ........................................................... 52 Function to Print Data into Full Matrices ................................................................. 53

LIST OF REFERENCES ............................................................................................... 55

BIOGRAPHICAL SKETCH ............................................................................................ 56

Page 7: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

7

LIST OF TABLES

Table page 4-1 Optimal Solution to Problem 1 with K=2000 ....................................................... 35

4-2 Optimal Solution to Problem 3 with K=2000 ....................................................... 35

4-3 Solving Time for Problem 1, 2 and 3 .................................................................. 37

5-1 Sizes of Problem 1 and Problem 2 ..................................................................... 40

Page 8: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

8

LIST OF FIGURES

Figure page 2-1 Run-File Environment in Portfolio Safeguard ..................................................... 15

3-1 Grouping Method and Decision Variables .......................................................... 23

3-2 “Lawn-Mower” Decision Rule (Courtesy of Krokhmal and Uryasev) ................... 24

4-1 Lower-Bound Optimal Values with Different Group Numbers and Fixed Sample Size J = 2000......................................................................................... 36

4-2 Solving Time of Optimization Problem 2 with Variable Numbers of Group and Sample Paths ..................................................................................................... 38

5-1 Solving Time for Problem 1 and 2 ...................................................................... 40

Page 9: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

9

LIST OF ABBREVIATIONS

PSG Portfolio Safeguard, the software package that is used in implementing the case study

CVaR Conditional Value-at-Risk, a downside percentile type measure of the loss function

Page 10: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

10

Abstract of Thesis Presented to the Graduate School of the University of Florida in Partial Fulfillment of the Requirements for the Degree of Master of Science

SAMPLE PATH BASED OPTIMAL POSITION LIQUIDATION WITH CVAR RISK

By

Suiyi Su

August 2012

Chair: Stan Uryasev Major: Industrial and Systems Engineering

The purpose of this research is to investigate devising the optimal position

liquidation strategies in financial markets. During the transaction of large block orders,

investors need to maximize their profits against the losses caused by price slippage. We

employed a sample-path based stochastic programming approach to obtain a dynamic

lower-bound optimal trading strategy with Conditional Value-at-Risk constraint.

We analyzed the optimization problems with different types of objective functions

determined by distinct market impact functions. Nonanticipativity and risk constraints

are discussed and properly imposed to avoid anticipating solutions and to control risk. A

new formulation is proposed to obtain a lower-bound of the optimal position liquidation

problem.

A case study is implemented in the run-file environment of Portfolio Safeguard.

Lower-bound optimal strategies are obtained from problems with and without risk

constraints. The result also verifies the supposed improvement of computational

efficiency in the new formulation.

Page 11: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

11

CHAPTER 1 INTRODUCTION

In the realm of quantitative finance, portfolio choice and asset allocation is the

strategic level decisions. With the rise of computerized trading and the increasing speed

of execution, the operational level decision making plays a more important role in

achieving the thinner profit margin than ever. Precisely speaking, trading execution

optimization is to seek an optimal trading sequence in maximizing payoff while

controling risk with predefined financial decisions.

1.1 Motivation

During the transaction of large block orders, there is always a potential loss

caused by price slippage, or market impact that reduces the expected return of the

trade. This price slippage originates from the so-called supply demand imbalance

discussed in Perold (1988) and information leakage investigated by Kissell and Glantz

(2003). The market equilibrium tends to move the price adversely to strike a balance

between buying and selling power. This price shift soon disappears as the adverse price

movement attracts more orders come to provide liquidity and thus this effect is

temporary market impact. Whenever an order is placed to the market, it is always

considered conveying certain information with regard to the asset. This information

affects the other market participants and forces the supply demand equilibrium to

balance at a different price. In other words, the information leakage incurs permanent

market impact that will exist during our trade.

An empirical evidence of this potential loss provided by Perold (1988) is a

statistical comparison between a hypothetical portfolio and a real portfolio constructed

according to same criteria. He showed that the hypothetical portfolio consistently

Page 12: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

12

outperformed the real portfolio for 20 years. A fair explanation is the market impact

caused by the traders own executions.

In order to estimate the effect of this phenomenon and to devise an optimal trading

execution, researchers suggest a variety of models and techniques to get a solution.

Most of their research assumes to trade a block of S shares of a financial instrument

within a fixed time period [0,T] . By slicing the block order into small pieces, the strategy

aims to maximize expected profit or minimize expected cost while employing certain

measures to control risk.

1.2 Related Work

The first quantitative approach to optimize trading execution was described by

Bertsimas and Lo (1998). They derived a mathematical formulation to minimize the

expected cost of trading in a discrete time random walk model. By assuming the law of

motion being a linear function of trading size and being either temporary or permanent,

they used stochastic dynamic programming and got a close-form expressions for the

optimal execution strategies. They also employed an approximate dynamic

programming to solve the problem incorporating a serially correlated information factor

in the market impact function. Bersimas, Lo and Hummel (1999) and AitSahlia, Sheu

and Pardalos (2008) extended this approach to consider the optimal execution for

portfolio with multiple assets. Khemchandani and et al. (2012) derived an analytical

expression with the market impact being a linear combination of temporary and

permanent functions. Without risk constraints in their models, the optimal trading

strategies given by these models are only acceptable by risk-neutral investors.

Page 13: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

13

Almgren (2001) considered the problem in the classical mean-variance

perspective. By constructing an expected utility in the objective function, he formulated

the problem in a continuous time model where market impact is linear to the shares

traded in both temporary and permanent situations. One of his contributions is to

incorporate risk in the problem and get a solution in efficient frontier form. Another

discovery made by Almgren (2001) is that under the assumption of independent random

walk without information, the static strategy is the same as the dynamic strategy that is

optimal to the problem. The nonlinear extensions of the model are discussed in Almgren

and Robert (2003) where they obtained an explicit expression of the optimal execution

strategy with market impact function being a simple power law. Almgren (2007) and

Lorenz (2011) further considered an adaptive trading strategy that is continuously

modified by market information, their optimal adaptive policies turned out to be

“aggressive in the money”.

Krokhmal and Uryasev (2007) proposed a sample-path based approach to optimal

position liquidation. They utilized historical price data to generate a discrete time

sample-path graph based on which they discussed the optimal position liquidation

strategies with market impact function being a general form. In order to circumvent the

anticipating ability of the model, the authors introduced a grouping method and a “lawn-

mower” decision rule by adding nonanticipativity constraints. After analyzing the

feasibility and optimality of the problem, the author proposes a DC programming

approach to estimate the lower bound of the original problem.

1.3 Overview of Thesis

The weakness of the model formulated by Krokhmal and Uryasev (2007) is that

the non-convexity brought in by nonanticipativity constraint makes the problem

Page 14: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

14

extremely difficult to solve. It is still computationally inefficient to obtain an optimal

solution for the lower-bound problem.

In this thesis, we reformulated the lower-bound optimal execution problem and

take advantage of the convex programming solvers in Portfolio Safeguard to improve

the computational efficiency.

In Chapter 2, we briefly introduce the run-file environment of the Portfolio

Safeguard software package and the functions we will use in the case study. In Chapter

3, we discuss details in the sample-path based model such as the form of objective

functions, nonanticipativity constraints and risk constraints. A new formulation with

reduced size is proposed by the end of Chapter 3.

In Chapter 4, we consider three specific optimization problems and use PSG to

implement a case study. Both mathematical format and PSG format formulations are

presented in Chapter 4. The PSG format is easily translated into problem statement that

is readily to be processed by solvers in PSG.

Conclusions and future work are presented in Chapter 5. A remarkable

improvement in the computational efficiency is shown by the comparing the outputs

from the three problems. We further discuss some possible future work and the ultimate

goal of the research in this thesis.

Page 15: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

15

CHAPTER 2 BACKGROUND

Portfolio Safeguard (PSG) is a Windows based decision-support tool for solving a

wide range of optimization, statistics, and risk management problems. Focus

applications areas are risk management, financial engineering, military, and medical

applications. PSG includes various case studies mostly concentrated on financial

applications such as portfolio optimization, asset allocation, selection of insurance,

hedging with derivative contracts, bond matching, and structuring of Collateralized Debt

Obligation (CDO).

The run-file environment of PSG provides an efficient way to solve an optimization

problem. By writing a short problem statement and preparing the input data following

the paradigm requested by PSG, we can obtain a solution that is stored in some text

files. The following figure shows an example of the run-file environment:

Figure 2-1. Run-File Environment in Portfolio Safeguard

Page 16: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

16

The functions and their mathematical definitions used in the case study are

presented as follows:

avg_g : Average gain function

1

_ , , ,J

j

j

avg g L p L

jx θ x

max_risk: Maximum risk for loss

1 j J

max _ , max , ,j

risk L L

x θ x θ

cvar_risk: CVaR risk for loss

1

, ,

cvar _ , 1 , ,

L VaR L

risk L L p d

x θ x θ

x θ x θ θ θ

avg_max_risk_g: Average max risk for Gain

1

1_ _ _ , , , , , ,M

Mavg max risk g L L avg RG x θ x θ x θ

Where

0

1

,I

i i

i

L x x

,

0 I( , ,θ ), θ ,

 i

has J discrete scenarios

, ?             , ? VaR L x istheupper percentileof distributionL x θ

M = number of random Loss Functions I

m m m

m 0 i i

i 1

L x,θ θ θ x

,

 m 1, ,M,

m m m

0 Iθ θ , ,θ vector of random coefficients for thm Loss Function

m ?m m

j j0 jIθ   θ , ,θ thj scenario of the random vector

mθ , j 1, ,J ,

RG x,θ is a random function with scenarios m

j m jm 1, ,M

RG x,θ max L x,θ ,

j 1, ,J .

Page 17: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

17

CHAPTER 3 SAMPLE-PATH MODEL

In this chapter, we describe the problem in formal mathematical notations and

propose the reduced size reformulation to calculate the lower-bound of the problem.

Different from assuming a random walk in traditional models, the sample-path

model is driven by data in simulating the natural price movement. A sample-path graph

with finite time periods should be generated from the historical data with normalized

initial prices. Every node in this graph represents the no-impact price, which is the price

movement independent of our trades. Then we discuss the possible impacts caused by

our trades on the current no-impact prices: we start from a perfect frictionless market

and extend it to a linear impact function to incorporate temporary and permanent

impact. During the process of problem formulating and solving, the application of

multistage stochastic programming may cause a special problem called

nonanticipativity. We need to handle this error properly to avoid the model’s ability to

take advantage of the perfect information of future prices. A path grouping (or path

bundling) method and a decision rule can be introduced to eliminate the ability of

anticipating. We discuss some heuristics in path grouping and decision rule due to

several intuitive considerations. Finally, we modify the model to add risk constraints to

satisfy investors different risk preferences.

3.1 Objective Function

In this section, we derive a general form of objective with implicit payoff function in

a discrete timeframe. In the following sections, we discuss different type of payoff

functions and the corresponding explicit expressions of objectives.

Page 18: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

18

Suppose at time 0t there is a position of X shares of an asset, which is to be

completely closed within a finite time interval 0 t T .The initial position X level can

be either positive or negative: in the former case, we need to seek a selling strategy to

liquidate a long position; while in the latter one, a buying strategy is needed to close a

short position. In this thesis, we concentrate on liquidating a long position. Another

concern about X is that it can be a vector meaning that we have a portfolio of more than

one asset to sell at initial time. We rule this situation out and assume X to be a number

which means there is only one asset in our portfolio.

In this discrete time model, trades are only allowed at predefined time points

1,2,...,t T . Though the time intervals are not necessarily to be equally divided, we

need to maintain our trades throughout all paths to coincide at 1,2,...,t T .

Let  j be the index of sample path and S be the sample-path set

0 1{( , , , )j j j

TS S S S | 1,2,..., }j J 3-1

Each element j

tS stands for the normalized no-impact price of the asset on path j

at time t . Price on every path is normalized the by dividing them by the initial price.

Thus, we can obtain:

1 2

0 0 0 01jS S S S

Similarly, we define the set of trading strategy in accordance with the sample-path

set

1, , | 1,2,...,j j

Tj J ξ 3-2

Page 19: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

19

Every element j

t in the set is the normalized value of position on path j at time t.

The normalized values are also divided by the initial position value, and

1 2

0 0 0 01J

Since we are committed to completely liquidate the position, we should close our

position out by time T :

1 2 0.J

T T T T

For convenience, we define the execution decisions as the difference of two

positions in two consecutive time points:

1, 1,2, , , 1,2, ,j j j

t t tj J t T

3-3

The positive values of j

t mean the execution to sell the asset at time t; the

negative values, on the other hand, is to buy the asset and increase the level of current

position. In the situation where initial position 0X , it is natural to assume that no buy

execution is allowed in the sell strategy.

Let the function ( )t

p be the payoff at time t . In general, ( )t

p is a function depend

on all execution decisions and prices prior to time t :

Δ Δ1 1

( ) , , , , , .j j j j

t t t tp p S S

The objective of our optimal execution problem is to maximize the sum of

expected payoffs incurred by each execution decisions on path j at time t :

Δ Δ1 1

1

max , , , ..., .,T

j j j j

s t t t

t

Z E p S S

3-4

Page 20: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

20

Considering the sample paths to be equally probable, we rewrite Eq. 3-4 as

Δ Δ1 1

1 1

1max , , ,., . , ..

J Tj j j j

t t t

j t

Z p S SJ

3-5

Eq. 3-5 is the general form of objective function that is to be optimized in our

problem. In order to obtain an explicit form of objective function, we need to discuss the

price impact function and the corresponding of the payoff function ( )t

p .

3.2 Price Impact Function

In this section, we discuss the type of the payoff function and resulting objective

function in: a) perfect frictionless market with no market impact; b) temporary market

impact; c) permanent market impact.

Imagine that market impact exists in our model, the real price we make a sell

execution will deviate from the no-impact price. Let j

tS be the real price on path j at

time t . We define ( )S as the market impact function or impact function:

Δ Δ1 1, , , , , .j j j j

t t

j

tS SS S 3-6

The payoff function and the corresponding objective function then become:

Δ Δ1 1

    , , , , ,j j j j

t t tp S S

Δ Δ Δ1 1, , , , , , 1, , , 1, , ,j j j j j

t t tS S t TS j J

3-7

Δ Δ Δ1 1

1 1

1max , , , , , .

J Tj j j j j

t t t

j t

Z S SJ

S

3-8

Page 21: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

21

3.2.1 Perfect Frictionless Market

In a perfect frictionless market, there is no market impact associated with our

trades. Though it is not a practical assumption in reality, it has experimental meanings

to test the approximation methods and algorithms proposed in the thesis.

In a perfect frictionless market, the real price equals to the no-impact price and

payoff function at time t is equal to the current no-impact price multiply by the current

execution decision:

Δ Δ1 1, , , , , , 1, , ,j j j j j

t t tS S S tS

Δ Δ Δ1 1, , , , , , 1, , , 1, , .j j j j j j

t t t t tp S S S t T j J

The objective function in this situation is:

Δ1 1

1max .

J Tj j

t t

j t

Z SJ

3-9

Since 1

j j j

t t t

is a linear function of decision variables, the objective function

is also a linear function of variables j

t .

1

1 1

1max ( ) .

J Tj j j

t t t

j t

Z SJ

3-10

3.2.2 Temporary Market Impact

Market impact is called temporary when the real price is only influenced by current

execution decision and independent of the previous execution decisions. If we further

assume the impact function is linear to the current execution decisions, we can express

the impact function and the payoff as:

Δ Δ Δ1 1, , , , , , 1, , , 1, , , 1, , ,j j j j j j j

t t t t tS S c S t t T JS j

Page 22: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

22

Δ Δ Δ2

1 1, , , , , , 1, , , 1, , ,j j j j j j j

t t t t t tp S S c S t T j J

where j

tc is a constant coefficient estimates the market impact.

The objective function then becomes:

Δ2

1 1

1max .

J Tj j j

t t t

j t

Z c SJ

3-11

The objective is a quadratic function of variables j

t .

3.2.3 Permanent Market Impact

Similarly, when the market impact is general permanent, current real price

depends on not only the current trade, but also all previous execution decisions. If we

continue assuming linearity of the impact function, we obtain:

Δ Δ Δ1 1 ,

1

, , , , , , 1, , , 1, , , 1, , ,t

j j j j j j j

t t tS S c S t j JS t T

Δ Δ Δ Δ1 1 ,

1

, , , , , 1, ,, , 1, , .t

j j j j j j j j

t t t t tp S S c S T j Jt

The objective function then becomes:

Δ Δ,

1 1 1

1max .

J T tj j j j

t t

j t

Z c SJ

3-12

It is also a quadratic function of variables j

t .

3.3 Constraints

In this section, three groups of constraints are introduced to circumvent

anticipating solutions, to avoid buy execution in a sell strategy and to control risk.

Page 23: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

23

3.3.1 Nonanticipativity Constraints

In section 3.2, we have established the explicit forms of objectives under different

market impact functions. In these equations, we assigned one decision variable j

t to

each time point j

tS . This formulation might result in an unwanted ability of the model

called anticipativity. Briefly speaking, the anticipativity in multi-stage stochastic

programming is the ability to take advantage of the perfect future information provided

by the structure of the formulation. However, the perfect information about future is not

predictable when making current execution decisions. In order to eliminate the

anticipativity, we need to impose a set of nonanticipativity constraints. In our study,

these constraints forces the execution decisions which share the similar current prices

must also be similar to each other.

To impose nonanticipativity constraints, we need to employ a grouping method

and a decision rule to define the “similarity” of the prices and the “similarity” of the

execution decisions in a mathematical way.

Figure 3-1. Grouping Method and Decision Variables

Page 24: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

24

The grouping method used in this thesis requires that the price are equally divided

to groups such that every group has equal number of nodes and the node with higher

price must have higher index.

For instance, in Figure 3-1 at time 3t , the three nodes on the bottom belong to

group 1, the middle three nodes belong to group 2 and the three nodes on the top

belong to group 3. Let K be the total number of groups we have on every time point

and , 1, , , 1, ,k

tx k K t T be the decision variables associated with each group.

A decision rule can be introduced based on these group decision variables. We

follow the idea that no buy execution is allowed and use the “lawn-mower” rule

proposed by Krokhmal and Uryasev (2007). The “lawn-mower” decision rule reads:

( , )

1min{ , }, 1, , 1, , ,j j k j t

t t tx j J t T

3-13

where ( , )k j t is a function that returns the value of group index k that corresponds to

the price j

tS .

Figure 3-2. “Lawn-Mower” Decision Rule (Courtesy of Krokhmal and Uryasev)

The intuition behind the “lawn-mower” rule is that when we make execution

decisions, we first compare the current position and the optimal position indicated by

Page 25: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

25

group decision variables: if the current position is lower than group decision variable,

keep it; otherwise, reduce it to the position required by the group decision variables.

We can see from Figure 3-2, at time t on path j variables j

t coincide with group

decision variables ( , )k j t

tx as the group variables cut the current position to a lower level

while at time 1t we keep the position to be the same since the group decision variable

is higher than previous sample-path variable.

3.3.2 Monotonicity Constraints

The idea that no buy execution is allowed in the sell strategy leads to a set of

monotonicity constraints:

1, 1, , , 1, , .j j

t tj J t T

3-14

Recall the definition of Eq. 3-3, we equivalently write the constraint as:

Δ 0, 1, , , 1, , .j

tj J t T 3-15

3.3.3 Risk Constraints

In this thesis, we measure the risk in terms of Conditional Value-at-Risk (CVaR)

invented by Rockafellar and Uryasev (2000, 2002). CVaR is a quantile risk measure of

the distribution of a loss function. The favorable part of taking Conditional Value-at-Risk

is that it ensures the convexity of the risk constraints which greatly simplify in solving the

problem using stochastic programming techniques. We follow the paradigm of

Rockafellar and Uryasev (2000, 2002) and multiply the gain function in objective by -1

and transfer it into a loss function.

Page 26: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

26

When solving the problem in Portfolio Safeguard, we simply call the function

cvar_risk to calculate the CVaR risk of a loss function. Thus, we will not elaborate on

the theoretical part of the risk constraints and write

1( , , ) ,j j

TCVaR Loss 3-16

as a general expression of the risk constraints. The on the right hand side of the

inequality is a constant representing the threshold of the risk.

3.4 Lower-Bound Problem

Combining the results from previous sections, an optimal execution problem with

general objective is presented. Then we take the objective in frictionless market as an

example to derive an equivalent convex problem and discuss the approximation

methods to calculate the lower bound of the optimization problem.

By using the objective in the form of Eq. 3-5, and constraints from section 3.3, we

write a general formulation of the optimal execution problem:

max Δ Δ1 1

1 1

1, , , , ,

J Tj j j j

t t t

j t

Z p S SJ

3-17

. .s t ( , )

1min{ , }, 1, , 1, , ,j j k j t

t t tx j J t T

1, 1, , , 1, , ,j j

t tj J t T

1( , , ) ,j j

TCVaR Loss

,0 1, 1, , , 1, , .

k j t

tx j J t T

Page 27: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

27

Consider the situation where the market is perfect frictionless, the objective take

the form in Eq. 3-10 and the optimization problem reads:

max 1

1 1

1( )

J Tj j j

t t t

j t

Z SJ

3-18

. .s t ( , )

1min{ , }, 1, , 1, , ,j j k j t

t t tx j J t T

1, 1, , , 1, , ,j j

t tj J t T

1( , , ) ,j j

TCVaR Loss

,0 1, 1, , , 1, , .

k j t

tx j J t T

Notice that when adding the nonanticipativity constraints, the feasible region

becomes a non-convex set. In order to solve the problem efficiently, we transform the

problem into an equivalent convex problem:

max ,

1

1 1

1max 0,

J Tk j tj j

t t t

j t

Z S xJ

3-19

. .s t 1, 1, , , 1, , ,j j

t tj J t T

,0 1, 1, , , 1, , .

k j t

tx j J t T

It is proved by Krokhmal and Uryasev (2007) that this formulation is equivalent to

Eq.3-18 in the sense that optimal values of their objectives are equal, and the sets of

their optimal solutions in variables coincide.

Page 28: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

28

Ignoring the max operator in objective, we actually obtain an optimization problem

with the solution of a lower bound of the original problem:

max ( , )

1

1 1

1( )

J Tj k j t j

t t t

j t

Z x SJ

3-20

. .s t 1, 1, , , 1, , ,j j

t tj J t T

,0 1, 1, , , 1, , .

k j t

tx j J t T

In this formulation, the number of decision variables equals to  * *J T K T . This

means the size of the problem increases linearly to the size of sample paths. In order to

reduce the problem size, we introduce a nonlinear formulation equivalent to Eq. 3-20

that can be incorporated by functions in Portfolio Safeguard.

Recall the “lawn-mower” rule in Eq. 3-13:

( , )

1min{ , }, 1, , , 1, , ,j j k j t

t t tx j J t T

substitute 1

j

t

by ( , 1)

2 1min{ , }j k j t

t tx

, we obtain:

, 1 ,

2 1min min , ,k j t k j tj j

t t t tx x

, 1 ,

2 1min , , .

k j t k j tj

t t tx x

Repeat this replacing process, we get:

,1 ,

0 1min , , , , 1, , , 1, , ,

k j k j tj j

t tx x j J t T

furthermore, since 01j , we obtain:

,1 ,

11, , , , 1, , , 1, , .min

k j k j tj

t tx x j J t T 3-21

Page 29: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

29

Substitute Eq. 3-21 into the objective of Eq. 3-20 and notice the first constraint of

Eq. 3-20 is naturally contained in Eq. 3-21, we write an equivalent optimization problem

to Eq. 3-20 as follows:

max , ,1 , , 1 ,

1 1

1 1

11- , , ,min

J Tk j t k j k j t k j t k j tj

t t t t t

j t

Z S x x x x xJ

3-22

s.t. ,0 1, 1, , , 1, , .

k j t

tx j J t T

The advantage of this formulation is that it eliminates the redundant decision

variables j

t and contains the nonanticipativity constraints implicitly in the objective.

With only group decision variables ,k j t

tx , the size of the problem is linear to the number

of groups that is determined by the grouping method.

On the other hand, the transformation makes this problem a non-linear

programming. In Chapter 4, we will see that by utilizing the convex programming solvers

and proper functions in Portfolio Safeguard, this optimization problem can be solved

much more efficiently than Eq. 3-20.

Page 30: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

30

CHAPTER 4 CASE STUDY

This case study compares the trading strategies generated by Eq. 3-20 and Eq. 3-

22 as well as their computational efficiency. We add the CVaR risk constraints to Eq. 3-

20 and solves for a risk-averse trading strategy. All case studies are solved in run-file

environment of PSG. The preprocessing of the input data is implemented in MATLAB.

All programs are run on a 2.50 GHz personal computer.

4.1 Data

The dataset used in our case study has two parts, the first set contains 5000

sample paths that have been calculated from real historical data; and the second set

has 15000 sample paths that are artificially generated by taking the average of two

random sample prices from the first set.

For the first dataset, we employ an algorithm to recognize certain patterns in the

trajectory of a stock then we keep track of its closing prices for a 5-business-day cycle

and the opening prices in the first day. All sample prices are normalized to start from 1.

With little loss of generality, discounting is neglected because of the short time horizon.

The second dataset is generated to test the computational efficiency for Eq. 3-22.

Since the prices are the average of two random real prices, the trajectory might have

little practical meanings in producing a trading strategy. However, the similarity of the

data patterns makes it reasonable to be used in testing the performance of the

algorithm.

4.2 Optimization Problems

In this section, we present three optimization problems in both mathematical

format and PSG format. The PSG format uses existing functions in the software

Page 31: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

31

package and some properly defined sets of variables. It is easy to convert the PSG

format formulation into a problem statement that is ready to be read by solvers in PSG.

We define some sets and functions as follows:

J T

,j

t 1

j 1 t 1

S ( )k j tj

t tL x, x

is the loss function;

T

,

1

t 1

| 1, ,k j tj j

t t tP x, S x j J

is the set of payoff on each path;

( , ) | 1, , 1, 1, ,j k j t

t tD x, x t T j J is the set of difference function

between  j

t and ( , ) k j t

tx ;

1| 1, , 1, 1, ,j j

t tD t T j J

is the set of difference function between

1

j

t

and j

t ;

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

k j k j t

tD x x t t j Jx T

is the set of difference

function between ,k j

x

and ,k j t

tx .

4.2.1 Problem 1

Optimization problem 1 uses the formulation from Eq. 3-20 to solve the optimal

execution problem in perfect frictionless market with no risk constraint.

4.2.1.1 Mathematical format

Maximizing expected sum of payoffs:

,

1

1 1

1max ( ),

J Tk j tj j

t t t

j t

S xJ

4-1

subject to

nonanticipativity constraints:

Page 32: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

32

,, 1, , , 1, , ,

k j tj

t tx t T j J

monotonicity constraints:

1, 1, , , 1, , ,j j

t tt T j J

boundary constraints:

,0 1, 1, , , 1, , ,

k j t

tx t T j J

4.2.1.2 Portfolio safeguard format

Maximizing expected sum of payoffs:

max _ , ,avg g P x 4-2

subject to

nonanticipativity constraints:

max_ , 0,risk D x

monotonicity constraints:

max_ 0,risk D

boundary constraints:

0, 1.lowerbounds upperbounds

4.2.2 Problem 2

Optimization problem 2 uses the formulation from Eq. 3-22 to solve the optimal

execution problem in perfect frictionless market with no risk constraint.

4.2.2.1 Mathematical format

Maximizing expected sum of payoffs:

, ,1 , , 1 ,

1 1

1 1

1max 1 , , ,m n ,i

J Tk j t k j k j t k j t k j t

tt

j

j

t t t

t

S x x x x xJ

4-3

Page 33: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

33

subject to

boundary constraints:

,0 1, 1, , , 1, ,

k j t

tx t T j J .

4.2.2.2 Portfolio safeguard format

Maximizing expected sum of payoffs:

max _max_ _ ,avg risk g D x

4-4

subject to

boundary constraints:

0, 1.lowerbounds upperbounds

4.2.3 Problem 3

Optimization problem 2 uses the formulation from Eq. 3-22 to solve the optimal

execution problem in perfect frictionless market with CVaR risk constraint.

4.2.3.1 Mathematical format

Maximizing expected sum of payoffs:

,

1

1 1

1max ( ),

J Tk j tj j

t t t

j t

S xJ

4-5

Subject to

risk constraint:

, ,CVaR L x

nonanticipativity constraints:

,, 1, , , 1, , ,

k j tj

t tx t T j J

monotonicity constraints:

Page 34: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

34

1, 1, , , 1, , ,j j

t tt T j J

boundary constraints:

,0 1, 1, , , 1, , .

k j t

tx t T j J

4.2.3.2 Portfolio safeguard format

Maximizing expected sum of payoffs:

max _ , ,avg g P x 4-6

subject to

risk constraint:

, ,CVaR L x

nonanticipativity constraints:

max_ , 0,risk D x

monotonicity constraints:

max_ 0,risk D

boundary constraints:

0, 1.lowerbounds upperbounds

4.3 Results

4.3.1 Lower-bound Optimal Trading Strategy

According to the results of the numerical experiments, Problem 1 and 2 yield the

same trading strategy as expected. We present and compare the trading strategies

generated from the first two problems and from Problem 3 with 2000 sample path in the

dataset.

Page 35: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

35

There are three sets of parameters in our models: group number K , confidence

level and risk threshold . We conducted separate experiments using 2000 sample

paths and different values of K to investigate the relationship between K and the

optimal value. We set 0.9 for all problems in the case study. Noting that improper

values of might make optimization problem infeasible, we first read the risk value in a

risk unconstrained problem and then reduce this value by a reasonable portion and

check the optimality of the solution.

Table 4-1. Optimal Solution to Problem 1 with K=2000

No risk constraint Optimal Value = 1.0196

k t=1 t=2 t=3 t=4 t=5

1 1 1 1 1 0 2 1 1 1 1 0 3 1 1 1 0 0 4 1 1 1 1 0 5 1 1 1 1 0 6 1 1 1 0 0 7 1 1 1 0 0

8 1 1 1 0 0 9 1 1 1 0 0 10 1 1 1 0 0

Table 4-2. Optimal Solution to Problem 3 with K=2000

CVaR risk constraint ω( 0.93)

Optimal Value = 1.0158

k t=1 t=2 t=3 t=4 t=5

1 0.891 0.746 0.746 0.439 0.000 2 0.746 0.746 0.439 0.228 0.000 3 0.746 0.746 0.591 0.000 0.000 4 0.746 0.746 0.746 0.439 0.000 5 0.746 0.746 0.746 0.308 0.000 6 0.746 0.746 0.700 0.000 0.000 7 0.890 0.746 0.746 0.000 0.000 8 0.746 0.746 0.746 0.000 0.000 9 1.000 0.746 0.746 0.000 0.000 10 0.746 0.746 0.746 0.000 0.000

Page 36: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

36

Recall the grouping method and “lawn-mower” decision rule discussed in Chapter

3, the trading strategy is completely contained in the group decision variables, i.e. the

values of ( , )k j t

tx .

Table 4-1 shows the lower-bound optimal trading strategy with no risk constraint in

frictionless market is a 0-1 strategy. The trading strategy sells the entire asset at the

most favorable time point along the path because the optimization problem merely tries

to maximize the expected payoff by ignoring any kind of risk. In contrast, in Table 4-2,

the risk constrained problem yields a strategy makes proportional and earlier execution

than the risk unconstrained strategy. It avoids the timing risk caused by holding the

asset and expecting a better trading opportunity. However, the reduction of risk is at the

cost of decreasing of expected return. This conclusion matches the mean-variance

theory in optimal execution problem proposed by Almgren (2001).

Figure 4-1. Lower-Bound Optimal Values with Different Group Numbers and Fixed

Sample Size J = 2000

Figure 4-1 shows that the increase in group number results in the improvement of

optimal value. Note that the number of groups reflects the model’s ability of anticipation:

large number of K means strong ability to anticipate. Consider the case when 1K ,

1

1.005

1.01

1.015

1.02

1.025

1.03

1.035

1.04

1.045

1.05

1 10 100 500 1000 2000

Lo

we

r-b

ou

nd

op

tim

al va

lue

Group number

Page 37: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

37

the strategy is static since the execution decisions will not be modified according to the

updates of market information. On the other hand, if 2000K equals to the number of

sample paths, the strategy is completely anticipating: the stock will be sold at the

highest price along every sample paths.

It is reasonable to set 10K in our case study because the optimal value tends to

be stable when K ranges from 1 to 100 for 2000 sample paths. We say it is not

acceptable to choose large value for K for that the prices cannot clearly distinguish

current trajectory from others and the model is non-anticipating.

4.3.2 Computational Performance

With the increase of sample paths, optimization problem 2 shows its advantage

over optimization problem 1 in handling large dataset.

Table 4-3. Solving Time for Problem 1, 2 and 3

Problem Datasets Problem 1 Problem 2 Problem 3

Dataset 1 (J=10, K=5) <0.01s <0.01s <0.01s

Dataset 2 (J=100, K=10) 0.05s 0.02s 0.25s

Dataset 3 (J=1000, K=10) 3.99s 0.05s 23.94s

Dataset 4 (J=2000, K=10) 24.54s 0.12s 771.76s

The table above shows that with the increase of sample path, the solving time of

Problem 1 also increases but that of Problem 2 stays at a low level. This is because the

number decision variables used in Formulation 4-1 is proportional to the number of

sample paths (J) while the number of decision variables in Formulation 4-3 is

proportional to group number (K). Since group number is fixed to be 10 when sample

Page 38: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

38

paths ranges from 100 to 2000, the solving time of Problem 2 does not show noticeable

rise.

Since the CVaR risk measure introduce a nonlinear constraint into the problem,

optimization problem 3 tends to consume more time than Problem 1 even using the

same formulation.

In order to examine the property of Formulation 4-3, we conduct the experiment

with group number being 10, 50, 100 and sample paths being 1000, 2000, 5000, 10000,

15000 and 20000.

Figure 4-2. Solving Time of Optimization Problem 2 with Variable Numbers of Group and Sample Paths

Figure 4-2 shows that with fixed group number, for Formulation 4-3, solving time

increases slightly with the expansion of sample paths. The time complexity of

Formulation 4-3 is mainly determined by group number.

0

0.5

1

1.5

2

2.5

3

3.5

4

1000 2000 5000 10000 15000 20000

So

ling tim

e (

s)

Number of sample paths

K = 100

K = 50

K = 10

Page 39: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

39

CHAPTER 5 CONCLUSION

In this thesis, we proposed a new formulation to the lower-bound optimal

execution problem based on the sample-path model. Through this reformulation, we

successfully eliminate the redundant variables and effectively reduce the problem size.

Though introducing a nonlinear factor in the objective function, this nonlinearity is

properly handled by the functions and convex programming solvers in Portfolio

Safeguard. A numerical experiment is conducted in MATLAB and PSG environment and

the result proves the correctness of our work as well as the improvement of the

computational efficiency.

Start by introducing the optimal execution problem, we compared the traditional

models and the sample-path based stochastic model invented by Krokhmal and

Uryasev (2007). Two important features of the sample-path model are to incorporate

historical data for specific financial instrument and the convenience to impose risk

constraints. These two features make the sample-path model flexible to be customized

by investors with different utilities and, more importantly, to be more trustworthy to solve

problems in real world.

Finally, we discuss the possible extensions to apply our model in more complex

situations in the future.

5.1 Computational Efficiency

We compare the two formulations in terms of their problem size and numerical

results in the frictionless market with no risk constraints.

Page 40: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

40

Figure 5-1. Solving Time for Problem 1 and 2

From Figure 5-1, it is clear that the solving time increase linearly to the number of

sample paths for Problem 1. With the same group number, the solving time for Problem

2 stay in a low level for increasing sample size. To better understand the difference in

the structure of two formulations, we prepare the table as follows:

Table 5-1. Sizes of Problem 1 and Problem 2

Problem Datasets

Number of Scenarios Number of Variables Solving Time (s)

Problem 1 Problem 2 Problem 1 Problem 2 Problem 1 Problem 2

Dataset 1 (J=10, K=5) 10 10 75 25 <0.01 <0.01

Dataset 2 (J=100, K=10) 100 100 550 50 0.05 0.02

Dataset 3 (J=1000, K=10) 1000 1000 5050 50 3.99 0.05

Dataset 4 (J=2000, K=10) 2000 2000 10050 50 24.54 0.12

For both problems the number of scenarios is the same and equals to the number

of sample paths. The difference comes from the number of decision variables, which

equals to * ( )T K J for problem 1 and *T K for Problem 2. The difference is huge

0

5

10

15

20

25

30

Dataset 1 (J=10, K=5)

Dataset 2 (J=100, K=10)

Dataset 3 (J=1000, K=10)

Dataset 4 (J=2000, K=10)

So

lvin

g t

ime

(s)

Problem 1

Problem 2

Page 41: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

41

when the number of scenarios is much greater than the number of groups. For example,

in Dataset 4 where J=2000 and K=10, the number of decision variables in Problem 1 is

2000 times more than that in Problem 2.

As we have discussed in Chapter 3 and Chapter 4, for the optimal execution

problem, it is always reasonable to keep K small (less than 50) to circumvent

anticipativity. The selection of the sample size has no such limitations. To some extent,

people may feel more reliable of the model with larger size of sample paths.

5.2 Future Work

In Chapter 3, we have proposed two general formulations for optimal execution

with any form of price impact function and risk constraints. Because of the limitation of

time and the appropriate functions in PSG, we only solve the most simplified problem in

frictionless market in Chapter 4.

For short term, we plan to design several functions in PSG for solving optimal

execution problem under linear temporary and permanent market impact. Since the

objective is quadratic, those functions need to take the maximum and to build a

quadratic function from the input matrix.

Credit risk has been intensively investigated by researchers since the occurrence

of financial crisis in 2008. The impact of credit risk can be incorporated in our model by

changing of the shape of the market impact function. In practice, a financial instrument

is evaluated by big three credit-rating companies and be classified into different grades.

Influenced by credit risk, some instruments may be smootsh to trade for normal sizes,

but it will become very difficult or simply impossible to trade when the trading size is

larger than a threshold, i.e. the liquidity disappears for some extreme cases. We can

Page 42: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

42

simulate the dynamics by utilizing a piecewise function to simulate the discrete feature

of the market impact.

Another modification for the market impact function is to use specific nonlinear

functions to describe the price slippage. The function should be built on the analysis on

the background and historical performance of certain financial instrument. On the other

hand, the function should be built such that the objective function is a concave shape

that can be maximized efficiently by convex programming solvers.

The ultimate goal of this problem is to design a computerized algorithmic trading

system to enable automatic trade executions. To achieve this goal, we should also

solve the problem for portfolios with multiple assets. Some interactions must be

formulated in forms of interacting market impact in the objective and covariance

matrices in risk constraints. More importantly, the system still needs to be tested by

large number of historical data to validate the stability and reliability before putting into

practice. The models and algorithms we present in this thesis can serve as a starting

point in the field of sample-path based optimal execution problem.

Page 43: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

43

APPENDIX A PROBLEM STATEMENT FOR PSG RUN-FILE

Problem 1

problem: problem_optimal_execution_ave, type = maximize

objective: objective_ave

avg_g_obj_ave(pmatrix_obj)

constraint: constraint_nonadditive,linearize=1, upper_bound = 0

max_risk_constraint1(pmatrix_constraint1)

constraint: constraint_monotonic,linearize=1, upper_bound = 0

max_risk_constraint2(pmatrix_constraint2)

box_of_variables: lowerbounds = 0, upperbounds = 1

Solver: CAR, precision = 6, stages = 6

Problem 2

problem: problem_optimal_execution, type = maximize

objective: objective_avg_risk

-avg_max_risk_g_obj(pmatrix_obj_1,pmatrix_obj_2,

pmatrix_obj_3,pmatrix_obj_4,pmatrix_obj_5)

box_of_variables: lowerbounds = 0, upperbounds = 1

Solver: VAN, precision = 9, stages = 6

Problem 3

problem: problem_optimal_execution_cvar_risk, type = maximize

objective: objective_ave

-avg_matrix_obj_avg(pmatrix_obj)

constraint: constraint_risk, linearize = 1, upper_bound = -0.93

Page 44: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

44

cvar_risk_obj_ave(0.9,pmatrix_obj)

constraint: constraint_nonadditive,linearize = 1, upper_bound = 0

max_risk_constraint1(pmatrix_constraint1)

constraint: constraint_monotonic,Linearize = 1, upper_bound = 0

max_risk_constraint2(pmatrix_constraint2)

box_of_variables: lowerbounds = 0, upperbounds = 1

Solver: CAR, precision = 4, stages = 6

Problem

Page 45: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

45

APPENDIX B MATLAB SCRIPT TO GENERATE INPUT MATRICES

Matrices Generating Script for problem 1 and 3

clear;

clc;

%Assign the number of groups K:

K = 10;

J = 2000;

path = importdata('sample_paths.txt');

matrix_path = path.data(1:1:J,:);

header = path.textdata;

%get the values of number of paths and the number of time periods.

[JJ,T] = size(matrix_path);

%Get the grouping matrix of every prices on path j

[matrix_path_sorted,IX] = sort(matrix_path);

for tt = 1:1:T

for jj = 1:1:J

IXX(IX(jj,tt),tt) = jj;

end

end

matrix_k = ceil(IXX./(J/K));

%Print the matrix in the file and save it in vector_obj

%Generate the matrix in objective

clear j;

Page 46: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

46

clear t;

fid = fopen('pmatrix_obj.txt','w');

%Print the header of the file

matrix_obj = zeros(J,J*T+K*T+2);

for j = 1:1:J

k = matrix_k(j,1);

matrix_obj(j,T*J+K*T+1) = 1/J;

matrix_obj(j,T*J+K*T+2) = -matrix_path(j,1);

matrix_obj(j,T*J+T*(k-1)+1) = -matrix_path(j,1);

for t = 2:1:T

k = matrix_k(j,t);

matrix_obj(j,T*(j-1)+t-1) = matrix_path(j,t);

matrix_obj(j,T*J+T*(k-1)+t) = -matrix_path(j,t);

end

end

print_pmatrix(fid,matrix_obj,J,T,K);

fclose('all');

clear j;

clear t;

clear pmatrix_constraint1;

%Prepare the matrix used in the nonanticipativity constraint, here

%called consraint1.

pmatrix_constraint1 = zeros(J*T*2,3);

Page 47: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

47

fid = fopen('pmatrix_constraint1.txt','w');

%Print the header of the pmatrix file

for j = 1:1:J

for t = 1:1:T

fprintf(fid,'xi%d_%d\t',j,t);

end

end

for k = 1:1:K

for t = 1:1:T

fprintf(fid,'x%d_%d\t', k,t);

end

end

fprintf(fid,'\r\n');

%Print the values of matrix and store the data in pmatrix_constraint1

for j = 1:1:J

for t = 1:1:T

pmatrix_constraint1(2*T*(j-1)+2*(t-1)+1,1) = T*(j-1)+t;

pmatrix_constraint1(2*T*(j-1)+2*(t-1)+1,2) = T*(j-1)+t;

pmatrix_constraint1(2*T*(j-1)+2*(t-1)+1,3) = 1;

fprintf(fid,'%d\t%d\t%d\r\n',T*(j-1)+t,T*(j-1)+t,-1);

pmatrix_constraint1(2*T*(j-1)+2*(t-1)+2,1) = T*(j-1)+t;

pmatrix_constraint1(2*T*(j-1)+2*(t-1)+2,2) = T*J+T*(matrix_k(j,t)-1)+t;

pmatrix_constraint1(2*T*(j-1)+2*(t-1)+2,3) = -1;

Page 48: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

48

fprintf(fid,'%d\t%d\t%d\r\n',T*(j-1)+t,T*J+T*(matrix_k(j,t)-1)+t,1);

end

end

fclose('all');

%Prepare the matrix used in the monotonicity constraint, here called

%constraint2

fid2 = fopen('pmatrix_constraint2.txt','w');

for j = 1:1:J

for t = 1:1:T

fprintf(fid2,'xi%d_%d\t',j,t);

end

end

for k = 1:1:K

for t = 1:1:T

fprintf(fid2,'x%d_%d\t', k,t);

end

end

fprintf(fid2,'\r\n');

%Calculate the values in the matrix.

clear i;

clear ii;

i = 1;

ii = 1;

Page 49: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

49

for j = 1:1:J

for t = 1:1:T

if (t == T)

i=i+2;

else

pmatrix_constraint3(2*T*(j-1)+2*(t-1)+1,1) = T*(j-1)+t;

pmatrix_constraint3(2*T*(j-1)+2*(t-1)+1,2) = T*(j-1)+t;

pmatrix_constraint3(2*T*(j-1)+2*(t-1)+1,3) = 1;

fprintf(fid2,'%d\t%d\t%d\r\n',ii,T*(j-1)+t,1);

pmatrix_constraint3(2*T*(j-1)+2*(t-1)+2,1) = T*(j-1)+t;

pmatrix_constraint3(2*T*(j-1)+2*(t-1)+2,2) = T*(j-1)+t+1;

pmatrix_constraint3(2*T*(j-1)+2*(t-1)+2,3) = -1;

fprintf(fid2,'%d\t%d\t%d\r\n',ii,T*(j-1)+t+1,-1);

ii = ii+1;

end

end

end

fclose('all');

Matrices Generating Script for Problem 2

clear;

clc;

%Assign the number of groups K:

K = 10;

JJ = 4000;

Page 50: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

50

path = importdata('sample_paths.txt');

matrix_path = path.data(1:1:JJ,:);

header = path.textdata;

%get the values of number of paths and the number of time periods.

[J,T] = size(matrix_path);

%Get the grouping matrix of every prices on path j

[matrix_path_sorted,IX] = sort(matrix_path);

for tt = 1:1:T

for jj = 1:1:J

IXX(IX(jj,tt),tt) = jj;

end

end

matrix_k = ceil(IXX./(J/K));

%Initialization of matrix_obj(i,:,:)

matrix_obj =zeros(T,J*T,K*T+2);

for jt = 1:1:J*T

j = ceil(jt/T);

t = jt-(j-1)*T;

k = matrix_k(j,t);

matrix_obj(1,jt,(k-1)*T+t) = T*matrix_path(j,t);

matrix_obj(1,jt,K*T+1) = 1/(J*T);

matrix_obj(1,jt,K*T+2) = T*matrix_path(j,t);

end

Page 51: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

51

for tau = 2:1:T

tau1 = tau-1;

for jt = 1:1:J*T

matrix_obj(tau,jt,K*T+1) = 1/(J*T);

j = ceil(jt/T);

t = jt-(j-1)*T;

kt = matrix_k(j,t);

ktau1 = matrix_k(j,tau1);

if (tau-1 < t)

matrix_obj(tau,jt,(kt-1)*T+t) = T*matrix_path(j,t);

matrix_obj(tau,jt,T*(ktau1-1)+tau1) = -T*matrix_path(j,t);

else

matrix_obj(tau,jt,K*T+2) = T*matrix_path(j,t);

end

end

end

fid(1) = fopen('pmatrix_obj_1.txt','w');

fid(2) = fopen('pmatrix_obj_2.txt','w');

fid(3) = fopen('pmatrix_obj_3.txt','w');

fid(4) = fopen('pmatrix_obj_4.txt','w');

fid(5) = fopen('pmatrix_obj_5.txt','w');

matrix_1(:,:) = matrix_obj(1,:,:);

matrix_2(:,:)= matrix_obj(2,:,:);

Page 52: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

52

matrix_3(:,:)= matrix_obj(3,:,:);

matrix_4(:,:)= matrix_obj(4,:,:);

matrix_5(:,:)= matrix_obj(5,:,:);

print_pmatrix(fid(1),matrix_1,J,T,K);

print_pmatrix(fid(2),matrix_2,J,T,K);

print_pmatrix(fid(3),matrix_3,J,T,K);

print_pmatrix(fid(4),matrix_4,J,T,K);

print_pmatrix(fid(5),matrix_5,J,T,K);

fclose('all');

Function to Print Data into Packed Matrices

function print_pmatrix(fid,matrix,J,T,K)

%print header of the txt file:

for k = 1:1:K

for t = 1:1:T

fprintf(fid,'x%d_%d\t', k,t);

end

end

fprintf(fid,'scenario_probability\t');

fprintf(fid,'scenario_benchmark');

fprintf(fid,'\r\n');

%Start printing the value in the matrix:

for j = 1:1:J*T

for i = 1:1:K*T+2

if matrix(j,i) == 0

Page 53: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

53

else

fprintf(fid,'%d\t%d\t%f\r\n',j,i,matrix(j,i));

end

end

end

Function to Print Data into Full Matrices

function print_pmatrix(fid,matrix,J,T,K)

%print header of the txt file:

for j = 1:1:J

for t = 1:1:T

fprintf(fid,'xi%d_%d\t', j,t);

end

end

for k = 1:1:K

for t = 1:1:T

fprintf(fid,'x%d_%d\t', k,t);

end

end

fprintf(fid,'scenario_probability\t');

fprintf(fid,'scenario_benchmark');

fprintf(fid,'\r\n');

%Start printing the value in the matrix:

for j = 1:1:J

for i = 1:1:J*T+K*T+2

Page 54: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

54

fprintf(fid,'%f\t',matrix(j,i));

end

fprintf(fid,'\r\n');

end

end

Page 55: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

55

LIST OF REFERENCES

AitSahlia, F., Sheu, Y., & Pardalos, P. M. (2008). In Kontoghiorghes E. J., Rustem B. and Winker P.(Eds.), Optimal execution of time-constrained portfolio transactions Springer Berlin Heidelberg. doi:10.1007/978-3-540-77958-2_5

Almgren, R. (2001). Optimal execution of portfolio transactions. The Journal of Risk, 3, 5.

Almgren, R. F. (2003). Optimal execution with nonlinear impact functions and trading-enhanced risk. Applied Mathematical Finance, 10(1), 1. Retrieved from https://search.ebscohost.com/login.aspx?direct=true&db=buh&AN=9756597&site=ehost-live

Almgren, R. (2007). Adaptive arrival price. Trading, 2007(1), 59.

Bertimas, D., Lo, A. W., & Hummel, P. (1999). Optimal control of execution costs for portfolios. Computing in Science & Engineering, 1(6), 40-53.

Birge, J. R., & Louveaux, F. (1997). Introduction to stochastic programming. New York: Springer.

Khemchandani, R. R. (2012). Optimal execution with weighted impact functions: A quadratic programming approach. Optimization Letters,

Kissell, R. R. (2006). Algorithmic decision-making framework. Journal of Trading, 1(1), 12-21.

Kissell, R., Glantz, M., & Malamut, R.,. (2003). Optimal trading strategies : Quantitative approaches for managing market impact and trading risk. New York: AMACOM.

Krokhmal, P., & Uryasev, S. (2007). A sample-path approach to optimal position liquidation Springer Netherlands. doi:10.1007/s10479-006-0143-3

Lorenz, J. J. (2011). Mean–Variance optimal adaptive execution. Applied Mathematical Finance., 18(5), 395-422.

Perold, A. A. F. (1988). The implementation shortfall paper versus reality. Journal of Portfolio Management, 14(3), 4-9.

Rockafellar, R. T., & Uryasev, S. (2002). Conditional value-at-risk for general loss distributions. Journal of Banking & Finance, 26(7), 1443-1471. doi:10.1016/S0378-4266(02)00271-6

Page 56: By SUIYI SUufdcimages.uflib.ufl.edu/UF/E0/04/47/08/00001/SU_S.pdf · 1 sample path based optimal position liquidation with cvar risk by suiyi su a thesis presented to the graduate

56

BIOGRAPHICAL SKETCH

Suiyi Su, born and raised in Xi’an, Shaanxi Province in China, graduated in 2006

from Xifei No.1 Senior Middle School. As a highly motivated individual, he attended

Beihang University in Beiijng, China in 2006. During his four years in Beihang

University, he has been the president of students’ union in the School of Advanced

Engineering and the monitor of Class 2006. In recognition of his hard working, he has

been awarded by several prizes for excellent academic performance and contribution to

the school as well as the Beihang University. He received his bachelor’s degree

majoring in automation engineering in July, 2010.

With the support from family and his strong determination to study abroad, he

applied to several top graduate programs in the United States of America. He decided

to join the master’s program in the Department of Industrial and Systems Engineering at

the University of Florida with the Achievement Award soon after his graduation from

undergraduate study.

During the two-year study at the University of Florida, he found himself attracted

by the theory and application of operations research and quantitative finance. After

achieving a good grade from courses, he decided to conduct a research as his master’s

thesis. With the purpose to apply the knowledge he learned from class, he focused on

the study of optimal trading execution problem under the guidance of Dr. Stan Uryasev

and Dr. Guanghui Lan. After he graduates in August 2012, he will make a decision

between to continue his PhD study at the University of Florida or join the industry and

start his life as an operation researcher in the area of energy optimization.