Informqtion ;r$=&mg Information
Processing
Letters
hh (199X) 27-33
An improvement on El-Yaniv-Fiat-Karp-Turpin’s money-making bi-directional trading strategy Eisuke Dannoura Rcccivcd
7 May
*, Kouichi
1997; rcviscd
Communicated
Kewwnf.s:
Algorithms;
On-line
algorithms;
Competitive
analysis;
If we are forced to choose from several alternatives in the areas of finance. economics, and operations research, with no secure knowledge of future events, then the use of an on-line system can aid our decision. Thus, on-line algorithms are required, which receive a sequence of requests and perform an immediate action in response to each request. A measure of the efficiency of an on-line algorithm is its competitive ratio: a comparison of the performance of the on-line algorithm to the performance of an optimal off-line algorithm for each sequence of requests. The off-line algorithm has full knowledge of future requests. The competitive analysis of on-line financial decision making has been studied. Cover [l] studied the problem of portfolio selection for investment, considering a simple on-line strategy that dramatically altered the distribution of assets among stocks. He compared this on-line strategy with a static, off-line portfolio selection strategy. Raghavan [4] analyzed the performance of an on-line investment algorithm under a statistical restriction on request sequences. I_Corresponding author. Email: sakurai(~csce.kyushu-u.ac.jp. ’ Email:
[email protected]. 0020.0190/98/$19.00 0 1998 Published PII soo20-0 190(98)00032~5
by Elsevier
Science
24 December
I997
by D. Griex
Financial
1. Introduction
Sakurai *
games:
Two-way
currency
trading
El-Yaniv, Fiat, Karp, and Turpin [2] applied on-line algorithms to currency conversion, using competitive analysis as a measure of performance. El-Yaniv et al.‘s focus was one-way currency conversion, converting assets from dollars to yen. They showed that a very small competitive ratio can be achieved. Their result was obtained under the assumption that the on-line player knows both the upper and lower bounds on possible exchange rates. El-Yaniv et al. [2] design an on-line algorithm that gains the optimal (minimum) competitive ratio in a unidirectional conversion problem by the restriction of fluctuations in exchange rates. In a unidirectional conversion problem, an on-line player is given the task of converting dollars to yen over a given period in order to achieve financial gain, whereas in a bi-directional conversion problem, the player may trade dollars for yen or yen for dollars. Their bi-directional algorithm divides exchange rate (yen/dollar) cycles into upward runs and downward runs, and then repeats the unidirectional algorithms. Players exchange dollars to yen if the exchange rate is moving up and yen to dollars if the rate is moving down. What is more, they design a unidirectional algorithm that achieves the optimal (minimum) competitive ratio.
B.V. All rights reserved
28
E. Dannoura. K. Sakurai /hformaiion Processing Letters 66 (1998) 27-33
Though the unidirectional algorithm proposed in [2] is shown to be optimal, the bi-directional algorithm, which repeats the unidirectional algorithm, is not. Therefore, the problem of designing the optimal algorithm for bi-directional conversion remains unanswered. Our main results are as follows: (1) We improve on the lower bound given in [2]. Our argument uses the fact that El-Yaniv et al.‘s unidirectional algorithm [2] induces an optimal algorithm for a bi-directional conversion problem under certain restrictions on the request sequences of exchange rates. (2) We design a new unidirectional algorithm, in which the player makes considerable gains on certain runs despite sometimes losing money on a run. As in the method of El-Yaniv et al. this new unidirectional algorithm is repeated for our proposed bi-directional algorithm, and we prove that our proposed bi-directional algorithm achieves better competitive performance than the algorithm of El-Yaniv et al.
2. The model, algorithms, and results in [2]
2.1. The conversion problem An on-line player converts dollars to yen over a given period. In unidirectional conversion, the online player cannot convert purchased yen back into dollars, while in bi-directional conversion the on-line player converts back and forth between dollars and yen according to the exchange rate (the amount of yen that can be purchased for one dollar). The final rule of the game is that at the end of the trading period the trader must convert any remaining dollars at the rate then current. The problem is divided into two versions: one is the continuous version; and the other, the discrete version. In the continuous version, the exchange rate fluctuates during the given period and the on-line player may trade continuously, whereas in the discrete version a new exchange rate is announced on the morning of each trading day and remains fixed throughout the day. This paper addresses mainly the continuous version of the problem, since our proposed algorithm can easily be applied to the discrete version.
maximum ---_--___-
____ -
t
dtscontinuous point
\
Fig.
/
I. A discontinuous point in the continuous model.
Remark 1. At any time t E [0, T], the player can trade dollars for yen or yen for dollars at the exchange rate x(t). However, x(t) may not be continuous even in the continuous model (see Fig. 1). The point corresponding to a sudden fluctuation in the exchange rate is not continuous in Fig. 1. 2.2. The assumption of an on-line player’s
knowledge
El-Yaniv et al. [2] considered the conversion problem under the assumption that the on-line player knows the upper and lower bounds on possible exchange rates, and we make the same assumption. El-Yaniv et al. also discussed the unidirectional conversion problem under the weaker assumption that the on-line player knows only the ratio between the upper and lower bounds on possible exchange rates. However, in the case of bi-directional conversion, there is no essential difference between the former assumption and the latter, weaker one. Therefore, we do not concern ourself with the weaker assumption. We consider bi-directional conversion under the assumption that the on-line player knows the upper and lower bounds on possible exchange rates. 2.3. The competitive
ratio
Suppose that trading can take place continuously over a given time interval [0, T], and let E(t) be an exchange rate function defined over this interval
E. Dunnouru.
K. Sukurai / lnformatiorr
[0, T]. Let P,Y.(E) denote the number of yen obtained by an on-line conversion strategy X that starts with Do dollars and then converts the dollars to yen in accordance with E. Let OPT denote the optimal offline strategy (i.e., the amount that the off-line player can achieve when the highest exchange rate is reached and all dollars are converted to yen at this time). For any on-line algorithm X. the competitive ratio is definedas s~p~;(Pom(E)/Px(E)).
29
Procrs.sin,q Letters 66 (1998) 27-33
new maximum, and we can also assume continuous function, since discontinuous merely enable the threat-based algorithm its dollars at more favorable rates. We then define the number of dollars exchange rate .r as follows: u E [m, rm]: [ x E [tr. rm ] xE[rm,M]
a E
Rule 1. At the end of the game, all remaining are exchanged.
dollars
Rule 2. Except at the end of the game, a purchase may be made only when the current rate is the highest yet seen. Rule 3. Whenever the exchange rate reaches a new maximum, just enough may be converted as to ensure that a competitive ratio of r would be obtained if an adversary were to drop the exchange rate to m and keep it there for the rest of the game. Let x. D(l), and Y(x) be the rate of exchange, the number of dollars, and the number of yen, respectively. They initially satisfy x = a, D = 1, Y = 0. The three rules above completely determine the on-line algorithm. Note that we can assume that the exchange rate is monotone increasing, since both the optimal offline algorithm and the threat-based algorithm conduct transactions only when the exchange rate reaches a
D(x) at the
D(x) = 1, D(x)=l-llnE.
2.4. The original algorithms by El-Yaniv et ~1. 2.4. I. The threat-based strutegy Let M be the upper bound and m be the lower bound on possible exchange rates, and let u be the initial exchange rate, all of which the on-line player knows in advance. El-Yaniv, Fiat, Karp and Turpin proposed a strategy called the threat-based strategy: to attain a given competitive ratio r, the on-line player simply defends himself against the threat of the exchange rate dropping permanently. They showed that this threat-based strategy yields the optimal algorithm. More precisely, the threat-based strategy consists of the following three rules:
that it is a fluctuations to exchange
r
rm-m
Irm. M]: x E [cr. Ml I
a(1 - l/R)
D(x) =
u-m
_ Iln*-m R a-m’
where r and R are defined in the following form: r=ln----
M/m r-l
- 1 * a E [m, rm],
Ir R =
1 I Ll - m ln M-m N N- m
(I E [rm. Ml.
Theorem 2 [2]. The competitive rithm above is r. 2.5. The hi-directional
ratio qf the algo-
algorithm in [2]
In [2], the bi-directional algorithm divides the exchange rate (yen/dollar) cycle into upward runs and downward runs and then repeats the unidirectional algorithms. Players exchange dollars for yen if the exchange rate is on an upward trend (i.e., the value of the dollar is increasing), and yen for dollars if the rate is on a downward trend (i.e.. the value of the yen is increasing). Theorem 3 121. Assume that the number of locul maximu is k/2 and the number of' local minimu is k/2 in the exchange rate,function and that E(t) remains in the intervul [m. M]. Then the hi-directional algorithm, which repeats the unidirectional algorithm. achieves the competitive ratio r’.
3. Improving
the lower bound
We have improved on the lower bound given in [2]. Our argument uses the fact that El-Yaniv et
30
E. Dannoura, K. Sakurai / Information Pmcessing Letters 66 (1998) 27-33
al.‘s unidirectional algorithm [2] induces an optimal algorithm for a bi-directional conversion problem under a certain restriction on the request sequences of exchange rates. 3.1. El-Yaniv et al’s argument on the lower bound El-Yaniv et al. [2] designed an on-line unidirectional algorithm and showed that the competitive ratio achieved by their proposed algorithm coincided with their lower bound. Thus, in the case of the unidirectional conversion problem, the competitive ratio shows their algorithm to be optimal. They also discussed the lower bound on the bidirectional conversion problem and gave a competitive ratio rk/* as the lower bound, although their proposed bi-directional algorithm was shown to have the competitive ratio rk. However, they gave no precise description of the technique used to prove the lower bound. So this is the first paper to consider how to prove the lower bound rk12. Though there are no known optimal algorithms for the general bi-directional conversion problem, we can obtain the optimal bi-directional algorithm, using the optimal unidirectional EFKT-algorithm, under a restriction on the exchange rates such that x increases from m, suddenly drops to m, and then repeats such fluctuations (see Fig. 2). The strategy of the on-line player against exchange rates such as in Fig. 2 is as follows: The player can exchange yen to dollars at the rate m (the rate at which yen is exchanged to dollars by the optimal off-line algorithm), since he knows that x will suddenly drop to m. So the bi-directional algorithm, which mutually
repeats the unidirectional algorithm from dollars to yen and the exchange of yen to dollars at the rate m, is optimal and achieves the competitive ratio rk/*. Hence, any algorithm for the bi-directional problem without the above restriction, and only under the assumption that x E [m, M], cannot achieve a better competitive ratio than rk/2. 3.2. Our improved lower bound We give a better lower bound by designing the optimal on-line algorithm (the competitive ratio of which is greater than El-Yaniv et al.‘s lower bound r’i2) under other restrictions on the request sequences of exchange rates (see Fig. 3). Consider the following exchange rate movement. Initially, the exchange rate x increases from ml, but then it drops suddenly to m2, where m 1 and m2 satisfy the following two equations: Frn2 =ml
f( 1 + (? - l)e’}2 = M/m. Next, x decreases from m:! and then rises suddenly to m 1. This pattern of increasing, dropping, decreasing, and rising is then repeated. The optimal bi-directional strategy of the on-line player against such exchange rates is shown in Fig. 3. The player exchanges dollars to yen by the unidirectional EFKT-algorithm with x E [mz, M] when x is increasing, all dollars to yen when x drops, yen to dollars by the unidirectional EFKT-algorithm with x E [m, m 11when x is decreasing, and all yen to dollars when x rises. Then the competitive ratio is rk.
M m rn,
m
Fig. 2. Exchange rates for EFKT lower bound.
= 1 + (7 - l)e’m,
._______----____.---_
_--.-_____-..-
KLLc____________~ _______L_______.~~__._.__
._______--~____ ~__._.----_____~---..._
Fig. 3. Exchange rates for our lower bound.
E. Dannoura,
K. Sakurai/lnforrnation
Since the relation 7 > r ‘/* holds, the greater lower bound is available. A comparison of our improved lower bound to the previous EFKT lower bound is shown in Fig. 5. The lower dashed line indicates r’/’ (the lower bound in [2]) and the lower solid line indicates r (the lower bound above).
4. Improving the algorithm for the hi-directional
problem
Processing
31
Letters 66 (1998) 27-33
the competitive ratio is not r2 but r, since, under the rules of the game, the player can exchange yen to dollars at the rate m (the same exchange rate as for the off-line player). Thus, for the unidirectional problem, the player has a worst case “threat” of a sudden drop. However, for the bi-directional problem, the player using the bi-directional algorithm in [2] faces too much of a “threat”. Therefore, by making the “threat” smaller, we could improve the bi-directional algorithm, and this is indeed possible, as we show next.
4.1. Basic idea of our improvement
4.2. Our modiJication of the unidirectional
The bi-directional algorithm by El-Yaniv et al. [2] achieves the competitive ratio rk (where r = (M/m l)/(r - 1)) with k/2 maxima and k/2 minima in the exchange rate function (recall Theorem 3). However, there is still a gap between the achieved competitive ratio above and the lower bound discussed in Section 3. We consider how the trading strategy could be improved, using the exchange rates described in Fig. 4. During an increasing run, the player using the bidirectional algorithm in [2] faces a “threat” that x will suddenly drop to m, and exchanges an amount of dollars such that he would gain the competitive ratio r if x were indeed to suddenly drop to m. Hence, the sudden drop leads to the competitive ratio r for the subsequent upward run (exchanging dollars to yen). However, for two cycles (upward and downward runs),
Like the threat-based strategy of the EFKT-algorithm, our new unidirectional algorithm consists of three rules:
A
~---_----_----__---___--____-
strategy
Rule 1. At the end of the game, all remaining
dollars
are spent.
Rule 2. Purchase can be made only when the current rate is the highest yet seen, except at the end of the game.
Rule 3. Whenever the exchange rate reaches a new maximum, just enough may be converted as to ensure that a competitive ratio of r would be obtained if an adversary were to drop the exchange rate to r”m and keep it there for the rest of the game. It should be noted that the third rule differs from the third rule of the threat-based strategy of the EFKTalgorithm. As in the original EFKT-strategy, we now assume that the exchange rate is monotone and continuous, and Do = 1. We then define the number of dollars D(X) at the exchange rate x as follows: a E [m, Pm]: x E [a, Pm]
D(x) = 1,
x E [F’m, M]
x-r”m D(x) = 1 - A In J f2m - Frn ’
a E [Pm. M]: x E b, Fig. 4. An example for showing our idea.
Ml
D(x) =
a(l-l/g) a-Frn
x-fin 1 - Elna,
32
E. Dannouru,
where r = ln(M/r’m
- I)/(;
M-fin In ~ a-Frn
27-33
ratio 1.31
(I E [m, r*m],
a-?m 1+---u 1
Processing Letters 66 (IYW)
competitive
- 1) and
r k=
K. Sukurui /Informrltirm
I *:.
a E [Pm, M].
:
:
r
....
.f
Theorem 4. Suppose that the exchange rate is more than ?m when the player ceases trading. Then, the unidirectional algorithm above gives u ratio less than ?. Proof. To prove the theorem, we lead the function Y(x) from D(x) with a E [m, rm]. In the case x E [u, F2m], Y(x) = 0 because D(x) = 1. In the case x E [F2m, M], we find D’(x) = -
1
D(x). Since xD’(x) = -Y’(x),
Y’(x) = _ x r(x - Fm) . So, we see
1.2
=o+
t s
F(t - fm)
?m
(
I-=ln
I
I
I
1.8
M/m 2.0
of the algorithms.
FmD(x)
1 r
AS
+ Y(x) 3 ;
holds in our unidirectional algorithm. But, in practice the remaining dollars may be exchanged to yen at the rate x = m. Then, since D(x), Y(X) 3 0, mD(x)
dt
+ Y(x) B
FmD(x)
+ Y(x) r
So, we find
Pm
X =-r
I 1.6
Fig. 5. The performances
x
Y(x)
I
1.4
algorithm. However, x really moves in [rm, M]. we showed in the proof of Theorem 4, the relation
T(x - Fm)
from the function
I 1
x-fin
MD(x) + Y(x) b
$.
0
F2m - Fm
Since FmD(x) + Y(x) 3 x /? is satisfied, the player will get at least x/T yen. In the case u E [r2nz, M], the player will get at least x/E yen, as above. Thus, the competitive ratio achieved by the proposed algorithm is r if the exchange rate is greater than Frn when the player ceases trading. 0 We provide a graph that shows the values of r and ?. See Fig. 5 in which the upper broken line indicates r and the upper solid line indicates r. Now we give the achieved competitive ratio for the general case: Theorem 5. The competitive ratio achieved proposed unidirectional algorithm is F2.
by our
Proof. Our unidirectional algorithm’s behavior is the same under x E [r”m,M] as the EFKT unidirectional
Remark 6. Our unidirectional algorithm has the competitive ratio r* (F = In{ (M/?m) - l]/(r - l}), which is greater than the competitive ratio r of the EFKTalgorithm, and a lower competitive performance than the optimal EFKT-algorithm. 4.3. Our improved bi-directional
algorithm
Our bi-directional algorithm repeats our proposed unidirectional algorithm in a similar manner to the original method of El-Yaniv et al. Although the unidirectional algorithm used is not optimal, nevertheless our bi-directional algorithm achieves better competitive performance than the original algorithm in [2], which relies on the optimal algorithm from the unidirectional conversion problem. Theorem 7. Our bi-directional algorithm achieves the competitive ratio fk, where the number of local
33
exchange rate muxima is k/2 and the rzutnher ofloud minima is k/2. Proof. Assume that a player uses this algorithm during the interval [0, T] with k/2 maxima and k/2 minima. Further. suppose that the times when the exchange rate is at a maximum are Tt , Tj, . , TL_ I and the times when the exchange rate is at a minimum are T2. T4.. , TX (= T). Let t; + F denote the time when the on-line player realizes that the exchange rate is maximum or minimum at r, , and let x; = _u(t;+ E), where c: << 0. That is, exchange at the end of the ith run (which is the same time as the beginning of the (i + l)th run), is regarded as being made not at the rate x (fi) but at the rate .Y, . Define
i?(x)=
r M -
1+---,’ - rm In ~ X I-rm i
rtn
x
E
[tn.Y2tnI.
x E [r&z. M].
and if n is even integer, if n is odd integer. Also define R,T as the ratio of the money made by the optimal off-line algorithm to the money made by this algorithm at the nth run. Further, define that q1 (.x) denotes the disadvantage at the nth run, which finishes with X, and that #I,,(X) denotes the advantage at the nth run, which starts with .r as follows.
R,T < iG,,(.x-,,)fi,,-, (.Y,,-~)
(n = 1. 2..
., k).
We note that the following
relationship
holds among
a,, (.r 1, B,,(x 1: a,,(x)/3,,(.x_) 6 1
Tz= 2,4, . . . . k - 2, (Y,,(s) =
(n = 1.2. . . . . k - 1).
Hence we obtain
,,=I
II=
I
so the on-line player achieves the competitive sup nk=, Rz = V” at the k runs. q
ratio
5. Conclusion This paper improved both the upper and lower bound for the bi-directional conversion problem shown in the previous work [2]. However, there still exists a discrepancy between the competitive ratio achieved by our proposed algorithm and our improved lower bound. We are inclined to believe that our improved algorithm for the bi-directional conversion problem is not yet optimal and that the challenge of designing an optimal algorithm remains.
References 1I] T.M. Cover. Universal portforios. J. Math. Finance
I-29. 121R. El-Yaniv.
II =k,
’ I
Then, we have the following relationship
I (I)
(1991)
A. Fiat. R. Karp, G. Turpin, Competitive analyaih
of financial games, in: Proc. 33rd Foundations oIComputer
Annual
Symposium
on
Science, 1992. pp. 327-333.
131 R. Karp, On-line algorithms versus off-line algorithms: how
I1 = 1.3 . . . ..k-
I,
much is it worth to know the future’?, IFIP Trans. A. Comput. Sci. Technol. A-12 (1992) 416429. [I) P. Raghavan, A Statistical Adversary for On-line Algorithms,
and
B,l(X) = y
DIMACS
(< I).
Ser. Discrete Math. Theoret. Comput. Sci. 7, Amel-.
Math. SW.. Providence. RI. 1991, pp. 7%X3.