Title: Folie 1
1Empirical Analysis of an Online Trading Algorithm
- Günter Schmidt12) and Esther Mohr1)
- Saarland University, Saarbrücken, Germany
- University of Liechtenstein, Vaduz, Liechtenstein
- gs,em_at_itm.uni-sb.de
18th Annual Conference, South African Finance
Association, January 14-16, 2009
2Agenda
- Motivation
- Problem Formulation
- Simulation Design
- Experimental and Worst Case Results
- Conclusions
3Motivation
- We focus electronic markets where trading is
carried out automatically (online) - Trading policies which have the potential to
operate without human interaction - are often based on technical analysis She02,
RL99, RS03 - are implemented from the perspective of
artificial intelligence, software agents or
neural networks CE08, FRY04, SR05 - We are interested in the analysis of policies
based on online algorithms from a worst case and
an average case point of view
4Trading Algorithms
- Three approaches for performance analysis of
trading algorithms in the literature - Stochastic Analysis a given probability
distribution for asset prices is a basic
assumption - Competitive Analysis assuming uncertainty about
asset prices and analyzing worst case outcomes - Heuristic Approach algorithms are implemented
and the analysis is done on historic data by
simulation runs - For our performance analysis we combine
approaches (2) and (3) when solving a multiple
trade problem
5Agenda
- Motivation
- Problem Formulation
- Simulation Design
- Experimental and Worst Case Results
- Conclusions
6Problem Formulation
- Search Problem
- Buy or sell a single asset at minimum or maximum
price - (1) a trader obtains price quotations p(t), m lt
p(t) lt M at points of time t1,2,,T - (2) every time t, the trader must decide whether
or not to accept p(t) - (2.1) p(t) is accepted trading is closed
- (2.2) p(t) is not accepted the trader obtains
the next price quotation if no price is accepted
until T-1 then p(T) has to be accepted which
might be m or M. -
- Single Trade Problem (k1)
- Buy and sell a single asset Search for its
minimum price m and its maximum price M in a time
series of T prices p(t) - -gt try to buy the asset at m and sell it at M
- Multiple Trade Problem (kgt1)
- Trade k assets sequentially Try to buy asset u
at m(u), sell u at M(u) buy asset v at m(v),
sell v at M(v), etc
7Competitive Analysis of Online Algorithms
- Algorithm ON computes online if for each
j1,,n-1, it computes an output for j before the
input for j1 is given - Algorithm OPT computes offline if it computes a
feasible output given the entire input sequence
j1,,n-1 - ON is c-competitive for a MAX problem if for any
input I -
- ON(I) gt 1/c OPT(I)
- -gt any c-competitive Algorithm ON is guaranteed
a return of at least a fraction 1/c of the
optimal offline return OPT - -gt c is a worst-case performance ratio OPT(I) /
ON(I) lt c - the smaller c the better is Algorithm ON
8Search Problem
- The selling rule for the MAX search problem
Yan98 - accept the first price greater or equal to
- the reservation price
- has a competitive ratio
-
- i.e. OPT / ON lt
- -gt This result is generalized for the case of
single and multiple trade problems in Sch08
9Single Trade Problem (k1)
- In the single trade problem search is carried out
twice - (1) Buying decision
- (2) Selling decision
- Policy for trading assets
- Buy the asset at the first price smaller or
equal to - reservation price p
- AND
- Sell the asset at the first price greater or
equal to - reservation price p
- In the worst case we get a competitive return
ratio of - ct M / m
10Multiple Trade Problem (kgt1)
- The ratio ct(k) can be interpreted as the rate of
return OPT achieves in comparison to ON buying
and selling assets k-times - ct(k) IIi1,, k M(i) / m(i)
- i.e. ct(k) (M / m)k
- iff m and M are constant for all trades Sch08
- Multiple Trade reservation price policy is
evaluated empirically and represented by a
Market Timing (MT) Trader
11Agenda
- Motivation
- Problem Formulation
- Simulation Design
- Experimental and Worst Case Results
- Conclusions
12Traders
- Simulation runs with three types of ON policies
- Market Timer (MT) applies reservation prices p
- Buy Holder (BH)
- Index BH holds an index
- MT BH holds the asset which MT bought
- Random (Rand) points of time for buying and
selling are chosen randomly - and with OPT as a benchmark
- Market (MA) buys at minimum possible price pmin
gt m and sells at maximum possible price pmax lt M
within each period
13Questions to be Answered
- (1) Does MT show a superior behavior to BH
policies? - (2) What is the influence of m and M on the
performance of MT? - (3) What is the average case performance of MT
- (4) and how does it compare to the worst case
competitive ratio ct(k)?
14Test Design
- Simulation based on historical data from XETRA
DAX for the interval 01.01.1998 06.30.2008
(01.01.2007 12.31.2007 ) - Time horizon is divided into trading periods of
different length each trading period consists of
a constant number of days - Six types of periods with length 1, 2 weeks and
1, 3, 6, 12 months - Two different test sets
- Historic estimates for m and M (Historic m, M)
- Precise estimates for m and M (Clairvoyant m, M)
-
- -gt 12 different simulation runs
15Assumptions for all policies
- There is the same initial portfolio value greater
than zero for all traders - In each period i at least one buying and one
selling transaction must be executed - At each point of time t there is at most one
asset in the portfolio - In period i 1 all policies buy the same asset j
on the same day t at the same price pj(t)
(calculated by MT policy) in periods i gt 1
trades are carried out according to the different
trading policies in the last period there is
only a selling transaction. - Policies are always invested cash has a return
rate of 3
16Assumptions for all policies
Policies are allowed to trade according to the
following pattern
T1
1
. . .
Buy u
Sell u
Buy w
lt
lt
lt
MT
Buy v
Sell v
Buy w
Buy u
Sell u
MA
lt
lt
lt
Buy v
Sell v
lt
lt
MT-BH
Buy u
Sell u
Buy w
17Agenda
- Motivation
- Problem Formulation
- Simulation Design
- Experimental and Worst Case Results
- Conclusions
18Experimental vs. Worst Case Results
- Performance of policies evaluated empiricaly with
annualized return rates as the performance
measure - The following results for the ten year interval
- 01.01.1998, 06.30.2008 are achieved
(transaction costs included) - (1) Annualized returns for historic estimates
of m and M including transaction costs - (2) Annualized returns for precise estimates of
m and M - (3) Comparison of worst case competitive return
rates and empirical return rates
19(1) Does MT show a superior behavior to BH
policies?
Tab. 1 Historic 1998-2008 annualized returns
MT generates the best annual return rate (4
weeks) outperforms Index BH in three of six
cases (4 weeks and lower) outperforms MT BH in
all cases MT BH generates the worst annual
return rate in five cases (except 4 weeks)
Average performance 6.53 for MT, 1.99 for
Index BH, -2.64 for MT BH -gt MT shows on
average a superior behavior to buy-and-hold
policies. For shorter periods MT shows a
superior behavior to all buy-and-hold policies.
20(2) What is the influence of m and M on the
performance of MT?
Tab. 2 Clairvoyant 1998-2008 annualized returns
- Clairvoyant precise estimates for m and M
- MT outperforms MT BH and Index BH in all cases
- -gt the better the estimates for m and M the
better the performance of MT
21(3) What is the average performance of MA and MT?
Tab 3 Example Trades in 2007
22(3) What is the average performance of MA and MT?
Tab 4 Competitive ratios for 1998-2008
-gt MT reaches at least 65.47, at most 98.73
and on average 82.02 of the return of
MA (MT/MA) -gt the shorter the periods, the more
achieves MT in comparison to MA (MT/MA) -gt the
average case bound reaches at least 13.43, at
most 42.42 and on average 22.95 of the
worst case bound
23(1) Historic Data 2007 vs. 1998 2008
Tab 5 Historic 2007 and 1998-2008 annualized
returns
-gt The shorter the periods the better is the
return for MT relative to buy-and-hold policies
24(2) Clairvoyant Data 2007 vs. 1998 2008
Tab. 6 Clairvoyant 2007 and 1998-2008 annualized
returns
-gt MT clearly outperforms all buy-and-hold
policies for all period lengths
25(2) Clairvoyant Data 2007 vs. 1998 2008
Tab. 6 Clairvoyant 2007 and 1998-2008 annualized
returns
MT/MA decrease 2007 versus (increase) 1998-2008 ?
26(3) Competitive Ratios 2007 vs. 1998 2008
Tab. 7 Competitive Ratio 2007 and 1998-2008 for
clairvoyant estimates without transaction costs
27Agenda
- Motivation
- Problem Formulation
- Simulation Design
- Experimental and Worst Case Results
- Conclusions
28Conclusions
- Clairvoyant m and M
- - MT outperforms BH in all cases (including
transaction costs) - (2) Historical estimates of m and M
- - MT outperforms BH in half of the cases and on
average - - if the period length is short MT
outperforms BH - (3) Obvious
- - the better the estimates of m and M the
better the - performance of MT
- - the longer the periods the worse the
historical estimates of m - and M
- -gt the performance of MT (and of MA) gets worse
the longer the periods because of bad estimates - (4) Fortunately It is very difficult to reach
the (analytical) worst cases under (simulated)
real-life conditions.
29Appendix
30(1) Does MT show a superior behavior to BH
policies?
Tab. 8 Annualized 2007 Returns
MT generates the best annual return rate in two
cases (1 and 4 weeks) outperforms Index BH in
four of six cases outperforms MT BH in three of
six cases (4 weeks and lower) MT BH generates
the worst annual return rate in three cases (4
weeks and lower) improves its performance
proportional to the length of the periods.
outperforms MT in cases period length 3 months
and higher Average performance 27.86 for
MT, 20.78 for Index BH, 20.63 for MT BH
-gt MT shows on average a superior behavior
to buy-and-hold policies. MT shows for
shorter periods a superior behavior to MT BH.
31(1) Historic Data 2007 vs. 1998 2008
Tab. 11 Historic 2007 and 1998-2008 Annualized
Returns
32(2) What is the influence of m and M on the
performance of MT?
Tab. 9 Clairvoyant Annualized 2007 Returns
Clairvoyant precise estimates for m and
M MT outperforms MT BH and Index BH in all
cases -gt the better the estimates for m and M
the better the performance of MT
33(2) Clairvoyant Data 2007 vs. 1998 2008
Tab. 12 Clairvoyant 2007 and 1998-2008
Annualized Returns
34(3) What is the average performance of MA and MT?
Tab.10 Competitive Ratios for 2007
-gt MT reaches at least 27.33, at most 77.22 and
on average 45.67 of the return of MA (MT /
MA) -gt the shorter the periods, the less
achieves MT in comparison to MA (MT/MA) -gt the
average case bound reaches at least 49.06, at
most 64.56 and on average 57.07 of the
worst case bound