• 沒有找到結果。

Modeling International Short-Term Capital Flow with Genetic Programming

N/A
N/A
Protected

Academic year: 2021

Share "Modeling International Short-Term Capital Flow with Genetic Programming"

Copied!
5
0
0

加載中.... (立即查看全文)

全文

(1)

Modeling International Short-Term Capital Flow with Genetic

Programming

Shu-Heng Chen

AI-ECON Research Center Department of Economics National Chengchi University

Taipei, Taiwan, 11623 chchen@nccu.edu.tw

Tzu-Wen Kuo

AI-ECON Research Center Department of Economics National Chengchi University

Taipei, Taiwan, 11623 kuo@aiecon.org

Abstract

In this paper, a non-deterministic (portfolio-based) finite-state automaton is proposed to generalize the current financial trading applications of genetic pro-gramming from single risky asset to multi risky as-sets. The GP-evolved trading rules are tested un-der various settings with respect to search intensity, genetic portfolios, and validating parameters. The rules are compared with performance of a buy-and-hold strategy in a context of international capital flow using data from Taiwan, the U.S., Hong Kong, Japan and the U.K. The GP are evaluated by using both the mean rule and the majority rule. However, by and large, it is found that GP was outperformed by the buy-and-hold strategy in both cases.

Introduction

Based on the survey of the current financial trad-ing applications of genetic programmtrad-ing by Chen and Kuo (2003), GP has been applied to the trading of stocks (Allen and Karjalainen, 1999), foreign exchanges (Neely, Weller and Ditmar, 1997, 1999), and spots and futures (Wang, 2000). However, most trading applica-tions of GP consider only one single risky asset. Wang (2000) is the only exception that considers using GP as a speculation tool by simultaneously trading both in the spots market and the futures market of a stock index.

Similar to that idea of the two-market dimension, this paper addresses an integrated trading design by simulta-neously taking into account two stock markets with two foreign exchanges. Doing in this way, this paper can be regarded as a generalization of the early study by Allen and Karjalainen (1999) on the stock market and Neely et al. (1997) on the foreign exchange market. This gen-eralization is originally motivated by the empirical ob-servation of the international flow of hot money, which sometimes moves very quickly among international cap-ital markets. Our original curiosity lies in seeing whether the momentum of capital inflow and outflow can be sim-ulated and hence predicted by using the GP. Therefore, to achieve that goal, we need to develop trading decisions not only on a single capital market (the host capital mar-ket), but also on the foreign capital market.

Consequently, the decision on the currency position is not just an independent arbitrage motive, but is also CIEF 2003 (http://aiecon.org/conference/cief2003.html).

connected to the previous decision on the participation intensity of different stock markets. These two decisions originally treaded separately by Allen and Karjalainen and Neely et al. are now bound together. In the simplest model, there are a minimum of four markets involved in this general framework, and the trading strategy needs to inform the trader which market to participate at any point in time.

Representation

The design of our finite-state automaton is based on the transition graph given above. There are four states char-acterizing four assets in the automaton. From the left-most to the rightleft-most the four assets are TAIEX, NT$, US$, and S&P 500. The current state indicates the mar-ket in which the investment is put. For example, if the current state is “TAIEX”, it means that money is now flowing into the Taiwan stock market, whereas a state “US$” refers to a demand for the asset of US$.

The transition from state to state is governed by the transition table upon the received signal. The transition from one state to the other state follows a sequential or-der as arranged in the figure. For example, a direct transi-tion from the state “TAIEX” to “S&P500” is prohibited. To get there, the asset in the Taiwan stock market has to be first sold out to get cash in NT$, and then changed to US$ before one can finally invest to the US stock index. At a given state, the moving direction is determined by the received signal generated by GP. The GP considered in this paper has a tree-structure as shown in Figure 1. It is not the standard single parse-tree structure. Instead, it is composed of three subtrees, each of which works in-dependently. Call them from the left to the right Tree A, B, and C. The three trees lie between the two consecutive states (shown in Figure 2), and they instruct what to do if the current position is one of the two consecutive states. For example, if the current state is “TAIEX”, then Tree A is the one to consult with; if the current state is “NT$”, then both Trees A and B will be involved. The specific instruction is given by the output of the tree. At a point in time, each tree simultaneously outputs “+1” or “-1”, altogether as a 3-bit signal. This 3-bit signal will then decide where to move for the next. The moving direction is shown in the previous figure. Basically, “+1” means a move to the left, and “-1” means a move to the right.

(2)

     ! " #$%!&' ( ±±±±)+*±±±±,+-±±±±./ 0213456 798;: <=> ?@ABCD EFG HIJ Figure 1: Tree-Structure          ! "# $% &' (*),+.-/10 24365.7819 :4;6<.=>@? ACBEDGFIHKJMLONPRQIS4TVUW XZY\[^]`_bac dfehgIikjmlonqpsrutkv wyx{z|~}Z€q‚sƒu„k…

Figure 2: The Four-Asset Finite State Automaton

The transition rules can be described as follows: Ini-tially at any position (state), if the local signals are con-sistently positive (negative), then move the position one step to the left (right). If it already comes to the leftmost (rightmost) state, then simply stay there. If the local sig-nals are inconsistent, stay there when the moving arrows make the current state a “sink”, and split, moving both to the left and right when the moving arrows make the current state a “source”. A remark is required for the last case, because it is not the common style of the non-deterministic finite state automata. Non-non-deterministic fi-nite state automata interpret the uncertain situation as a command “or”, “move to the left or to the right”. But, here, we are using “and” rather than “or”, since we are dealing with the allocation of investment, and a way out of an equally competing situation is to diversify the in-vestment as one half for each. This not only distinguishes our finite state automaton from the conventional one, but also enables it to befit the problem of portfolio selection. Based on the transition rules described above, the tran-sition tables are displayed in the following figure by as-suming a different current state.

Data Description

The data used in this paper include the financial time se-ries on exchange rates, stock indices, and interest rates from the following four countries: the USA, Japan, Hong Kong, the UK, and Taiwan. Taiwan is taken as the host country here. The data from 1992, Jan. 1 to 2002, Dec. 31 are downloadable from Datastream. The original time

                                                                                  !    !     !     !                    "    "    "     "    #    #    #    #                        $ $ $   $ $ $   $ $ $   $ $ $   $ $    $ $    $ $    $ $    $ $     $ $     $ $     $ $    %'&()(+*&),.-/10.2),,3 %'&()(+*&))4-5/10.2)),3 %'&()(+*&),.-/10.2),,3 %'&()(+*&))4-5/10.2)),3                                                                            !     !     !    !                     "      "      "    "    #     #     #    #                           $$ $    $$ $    $$ $    $$ $    $$     $$     $$     $$     $$      $$      $$      $$     678+79):,;-/10.2)),3 678+79):);-5/10.2))3 678+79):,;-/10.2)),3 678+79):);-5/10.2))3   ) ) ) ) <, <, <, <, =+ =+ =+ =+                                                        !     !     !    !                     "      "      "    "    #     #     #    #                           $$ $    $$ $    $$ $    $$ $    $$     $$     $$     $$     $$      $$      $$      $$        1      1                                                                         !    !    !     !                      "    "     "     "    #   #    #     #                      $ $$    $$ $    $$ $    $ $$    $ $    $$     $$     $ $    $ $     $$      $$      $ $    >5?A@+B)4-5/1042))3 >5?A@)B).-/10.2,),3 >5?A@+B)4-5/1042))3 >5?A@)B).-/10.2,),3                                                                            !     !     !    !                      "     "     "     "    #     #     #    #                           $$ $    $ $ $    $ $ $    $$ $    $$     $ $     $ $     $$     $$      $ $      $ $      $$     C4DE:);-/10.2),,3 C4D:);-5/10.2)),3 C4DE:);-/10.2),,3 C4D:);-5/10.2)),3             <+ <+ <+ <+ =5 =5 =5 =5                                                   !    !    !     !                      "    "     "     "    #   #    #     #                      $ $$    $$ $    $$ $    $ $$    $ $    $$     $$     $ $    $ $     $$      $$      $ $       1      1                                                                  !    !    !    !                   "    "     "    "   #   #    #    #                      $ $$    $$ $    $$ $    $ $$    $ $    $$     $$     $ $    $ $     $$      $$      $ $    F0%4GH@+B %4G-5/10.2)),3 F0%'GI@)BJ%4G-5/1042))3 F0%4GH@+B %4G-5/10.2)),3 F0%'GI@)BJ%4G-5/1042))3                                                                                   !     !     !     !                         "     "     "      "     #     #     #     #                             $$ $    $ $ $    $ $ $    $$ $    $$     $ $     $ $     $$     $$      $ $      $ $      $$     F4K9+LDEK,9+L,:);-/M042),,3 F4K,9+L.D'K,9+L:);-/10.2)),3 F4K9+LDEK,9+L,:);-/M042),,3 F4K,9+L.D'K,9+L:);-/10.2)),3             <+ <+ <+ <+ =5 =5 =5 =5                                                               !     !     !     !                        "      "      "     "     #     #     #     #                             $$ $    $ $ $    $ $ $    $$ $    $$     $ $     $ $     $$     $$      $ $      $ $      $$     ?0ENB O-/10.2,),3 ?0'NBJO-5/10.2)),3 ?0ENB O-/10.2,),3 ?0'NBJO-5/10.2)),3 +  +  +  +        +  +                                                                !     !     !     !                        "      "      "     "     #     #     #     #                             $ $ $    $ $ $    $ $ $    $ $ $    $ $     $ $     $ $     $ $     $ $      $ $      $ $      $ $     ?J7&P'79):);-5/10.2)),3 ?A7?J7&P'7&P479):);9):);-/M042-5/10.2),,3)),3 ?A7&P479):);-/M042),,3 +  +  +  +          +  +                                                                !     !     !     !                        "      "      "     "     #     #     #     #                             $ $ $    $ $ $    $ $ $    $ $ $    $ $     $ $     $ $     $ $     $ $      $ $      $ $      $ $                 +  +  +  +          +  +                                                                !     !     !     !                        "      "      "     "     #     #     #     #                             $$ $    $ $ $    $ $ $    $$ $    $$     $ $     $ $     $$     $$      $ $      $ $      $$     @Q4R,).-/10.2),,3 @+Q.R@Q4R))4-5/10.2)),3,).-/10.2),,3 @+Q.R))4-5/10.2)),3 +  +  +  +          +  +                                                                !     !     !     !                        "      "      "     "     #     #     #     #                             $$ $    $ $ $    $ $ $    $$ $    $$     $ $     $ $     $$     $$      $ $      $ $      $$     C.@):);-5/10.2)),3 C.@+:);C.@):);-5/10.2-/10.2),,3)),3 C.@+:);-/10.2),,3                                                                                   !     !     !     !                        "      "      "     "     #     #     #     #                             $$ $    $ $ $    $ $ $    $$ $    $$     $ $     $ $     $$     $$      $ $      $ $      $$    

Figure 3: Time Series of Stock Indices, Interest Rates, and Exchange Rates

series data are generally non-stationary. All data are sta-tionarized by dividing them by the 250-day moving av-erage. The adjusted data are shown in Figure 3.

The data are divided into three parts with equal propor-tion. The first part is used for training. The GP trading rules are extracted from this part. The second part is used to validate the rules learned from the first part. The rules which perform best on this validation set will be kept un-til they are replaced by the newly found best rules. How-ever, after a number of generations, if no new best rules are found, the program will be terminated. This proce-dure of validation is proposed by Neely et al. and com-monly used in the literature. Evaluations of GP trading rules are, of course, based on the last part of the data.

Experiment Designs

The Use of GP

The primitives of GP are given in Table 1. These prim-itives are motivated by some familiar trading rules, such as the moving average rules and the range break-out rules. Using these primitives, those familiar trading rules become a member of the GP search space, and hence are potentially replicable by GP.

Search intensity is mainly controlled by the product of

two factors: population size (P OP )and number of

gen-erations to evolve (GEN ). In the examples of chaotic

time series, Chen and Kuo (2002) shows the search ef-ficiency of GP may depend upon the combination of the two factors. Motivated by that study, we conduct search intensity with six different combinations of P OP and GEN as shown in Table 1.

Genetic portfolio is defined as the proportion of each

genetic operator used in generational replacement. Also motivated by Chen and Kuo (2002), which showed the

(3)

Table 1: Tableau of Control Parameters Function Set:

+, −, ∗, /, norm, max, min, lag, avg and, or, not, >, <, if − then − else Terminal Set:

Variables

exchange rate, stock indices, interest rate

Numerical constants 100 constant numbers in [0.0, 10.0) Boolean constants True, False Population: 200, 500, 1000 Generation: 100, 200 Fitness: Gross returns Validation (ω): 1/2, 1/4 Selection: Tournament

significance of the genetic portfolio, this paper considers two different genetic portfolios, and they are shown in Figure 4. The first portfolio relies more heavily on the crossover operator, while the second portfolio puts more emphasis on the mutation operator.

The fitness function is the annual return of the invest-ment. The return is calculated in terms of the foreign currency. Consider the case of the capital flow between Taiwan and the U.S. Let us say we have US$ 1.00 invest-ment at the beginning, and after a 3-year investinvest-ment, it end up with US$ 1.12. Then the total return for the three years is 12%, and hence the annual return is 4%. No-tice that penalty for complexity is not explicitly included in our fitness function. The complexity regularization is conducted via the validation scheme as sketched in Sec-tion . The validaSec-tion scheme requires the user to input a

waiting parameter, i.e., how long to wait for the

newly-founded best-performed trading rules before we termi-nate the training stage. The number of iterations to wait is, of course, less than GEN . However, there is no gen-eral guidance for the setting of this waiting time. To test whether this parameter is significant, we consider two waiting times in this paper: namely a longer one as one half of GEN (ω=1/2), and a shorter one as one fourth (ω=1/4).

Benchmark

Following the convention, the buy-and-hold (B&H) strategy is employed as the benchmark by which GP trad-ing rules are evaluated. However, since we have four assets in our application, the B&H strategy can be con-ducted in four different ways: buy TAIEX and hold, buy NT$ and hold, ..., etc. As a result, what we do here is to assume a uniform portfolio over these four B&H strate-gies. The essence of the B&H strategy lies in its

simplic-ity, and our modification is, therefore, a natural extension

of the B&H strategy from the interest-bearing asset to the multiple interest-bearing assets.

         

Figure 4: Genetic Portfolio a and b

Experimental Results

Before giving the experimental results, notice that we have all 6 (search intensity) × 2 (genetic portfolio) × 2 (waiting time) equal to 24 designs. Other control param-eters of GP remains the same over these 24 designs. For each design, 20 independent runs are conducted. This gives us a total of 20 trading rules for each design. The evaluation of each design depends on how to use these 20 rules. Two methods exist in the literature. The first is to assume a uniform portfolio over these 20 rules, and the evaluation is simply to take the average of the gross re-turns over these 20 rules. The second one is to assume an investment committee comprising these 20 rules, and the investment decision is made by the majority of the com-mittee. The gross returns of the majority rule are then calculated accordingly for evaluation.

Based on the description above, we shall first present the performance of GP using the portfolio method (Table 2), and then the committee method (Table 3). The in-sample performance of GP in both cases will be skipped here, because they are not very interesting even though they unanimously perform quite superior to the uniform B&H strategy.

As shown in Table 2, over all the four markets, the performance of the GP trading rules is inferior to that of the B&H strategy. The worst cases are the capital flow between Taiwan and U.S. markets, and that between Taiwan and H.K. markets: GP loses to the B&H strategy under all the 24 designs. For Japan and U.K. markets, GP is able to beat the B&H under some designs. However, despite the existence of some winning designs, there is no indication of what the effective design is.

The results of the majority rule (Table 3) are slightly better. In particular, for the case of the capital flow be-tween Taiwan and Japan, there are some designs lead-ing to a gross return greater than one, which proves that GP can even make profits in a very adverse situation.1 Nevertheless, situations for other pairs of markets do not show a difference to an exciting degree.

1Notice that in this testing period, all B&H strategies suffer

(4)

Gen \ Pop 200 500 1000 USA 100 a 0.6390 0.6436 0.6814 ω=1/2 b 0.6258 0.6477 0.6532 200 a 0.6283 0.6878 0.6767 b 0.6668 0.6387 0.7160 ω=1/4 100 a 0.6792 0.6624 0.6726 b 0.6297 0.6891 0.7185 200 a 0.6309 0.6404 0.6287 [0.8033] b 0.6906 0.6590 0.6850 Japan 100 a 0.8911 0.7037 0.8112 ω=1/2 b 0.7708 0.7793 0.8419 200 a 0.7015 0.7462 0.8786 b 0.7469 0.7406 0.8312 ω=1/4 100 a 0.8514 0.8294 0.7892 b 0.8062 0.7762 0.7446 200 a 0.7939 0.7739 0.8386 [0.8051] b 0.8682 0.7658 0.8118 HK 100 a 0.6175 0.6374 0.6441 ω=1/2 b 0.6224 0.6670 0.6471 200 a 0.6192 0.6605 0.6562 b 0.5938 0.6138 0.5511 ω=1/4 100 a 0.6673 0.6823 0.6411 b 0.6719 0.7030 0.6882 200 a 0.6419 0.5943 0.6089 [0.7988] b 0.6379 0.7483 0.6445 UK 100 a 0.6791 0.7234 0.7608 ω=1/2 b 0.6846 0.8011 0.7217 200 a 0.7794 0.8491 0.6895 b 0.6906 0.8647 0.7616 ω=1/4 100 a 0.7012 0.7382 0.8397 b 0.7123 0.7909 0.7866 200 a 0.7280 0.7179 0.8194 [0.8121] b 0.7082 0.7662 0.6626 The “a” and “b” refers to two different genetic portfolios de-fined in Figure 4. The number shown in the bracket is the gross return earned by following the buy-and-hold strategy.

Table 2: Gross Returns of GP (the Portfolio Method)

Concluding Remarks

In general, GP did not outperform the simple buy-and-hold strategy. On this point, our finding is similar to Allen and Karjalainen (1999) and Wang (2000). How-ever, by conducting a more extensive test, this paper stands in even a more solid position to answer the follow-ing question: Should the relatively inferior performance

of GP be attributed to the market efficiency or the poor use of GP? In this paper, we have taken into account all

the key factors which may affect the performance of GP, such as search intensity, genetic portfolios, validation de-signs, and different combinations of GP-evolved rules. None of them, however, are significant enough to stand out. This result, therefore, is in favor of market efficiency as a cause for the poor performance of GP.

Gen \ Pop 200 500 1000 USA 100 a 0.6002 0.7636 0.6411 ω=1/2 b 0.6348 0.7009 0.6016 200 a 0.6283 0.6438 0.8697 b 0.6568 0.6348 0.7306 ω=1/4 100 a 0.6129 0.6133 0.6974 b 0.6582 0.6342 0.6735 200 a 0.6179 0.6274 0.6229 [0.8033] b 0.6353 0.8233 0.6921 Japan 100 a 0.7680 0.6855 0.8540 ω=1/2 b 1.0706 1.1617 1.1579 200 a 1.0199 0.6895 1.0456 b 1.0278 1.0171 1.0199 ω=1/4 100 a 0.7795 0.8773 0.7057 b 0.9095 0.6047 1.0333 200 a 0.8658 1.1220 0.8579 [0.8051] b 0.9415 1.0227 0.8471 HK 100 a 0.4505 0.4758 0.5849 ω=1/2 b 0.6198 0.6582 0.6692 200 a 0.4896 0.5666 0.6694 b 0.5001 0.4523 0.5160 ω=1/4 100 a 0.6034 0.4753 0.6516 b 0.7299 0.7836 0.5274 200 a 0.7685 0.6128 0.4615 [0.7988] b 0.6988 0.6561 0.4877 UK 100 a 0.6022 0.8478 0.7730 ω=1/2 b 0.8289 0.8300 0.7171 200 a 0.8646 0.7874 0.8976 b 0.8240 0.8115 0.8284 ω=1/4 100 a 0.6199 0.7193 1.0894 b 0.7971 0.7332 0.8779 200 a 0.6383 0.6670 0.8720 [0.8121] b 0.7891 0.7825 0.7868 The “a” and “b” refers to two different genetic portfolios de-fined in Figure 4. The number shown in the bracket is the gross return earned by following the buy-and-hold strategy.

Table 3: Gross Returns of GP (the Majority Rule) Of course, these are not final words on the issue. There is always room for enhancing GP performance, as what GP people have been doing over the last decade. From representations, primitives, fitness functions, to the in-clusion of domain-specific knowledge and the use of au-tomatic defined functions, it is too early to say that pos-sibilities have run out. Whether the failure of GP is tan-tamount to the unpredictability of the market remains to be studied.

References

Allen, F., and R. Karjalainen (1999), “Using Genetic Algorithms to Find Technical Trading Rules,” Journal

of Financial Economics, Vol. 51, No. 2, pp. 245–271.

Chen, S.-H., and T.-W. Kuo (2002), “Genetic Program-ming: A Tutorial with the Software Simple GP,” in

(5)

, S.-H. Chen (ed.), Genetic Algorithms and Genetic

Programming in Computational Finance, Kluwer

Aca-demic Publishers, pp. 55–77.

Chen, S.-H., and T.-W. Kuo (2003), “Discovering Hid-den Patterns with Genetic Programming,” in S.-H. Chen and P. P. Wang (eds.), Computational Intelligence in

Economics and Finance, Springer-Verlag, pp. 329–347.

Neely, C., and P. Weller (1999), “Technical Trading Rules in the European Monetary System,” Journal of

International Money and Finance, Vol. 18, pp. 429–

458.

Neely, C., P. Weller, and R. Dittmar (1997), “Is Tech-nical Analysis in the Foreign Exchange Market Prof-itable? A Genetic Programming Approach,” Journal of

Financial and Quantitative Analysis, Vol. 32, No. 4, pp.

405–426.

Wang, J. (2000), “Trading and Hedging in S&P 500 Spot and Futures Markets Using Genetic Program-ming,” Journal of Futures Markets, Vol. 20, No. 10, pp. 911–942.

數據

Figure 3: Time Series of Stock Indices, Interest Rates, and Exchange Rates
Table 1: Tableau of Control Parameters Function Set:
Table 3: Gross Returns of GP (the Majority Rule) Of course, these are not final words on the issue

參考文獻

相關文件

The short film “My Shoes” has been chosen to illustrate and highlight different areas of cinematography (e.g. the use of music, camera shots, angles and movements, editing

Wang, Solving pseudomonotone variational inequalities and pseudocon- vex optimization problems using the projection neural network, IEEE Transactions on Neural Networks 17

Define instead the imaginary.. potential, magnetic field, lattice…) Dirac-BdG Hamiltonian:. with small, and matrix

Microphone and 600 ohm line conduits shall be mechanically and electrically connected to receptacle boxes and electrically grounded to the audio system ground point.. Lines in

CAST: Using neural networks to improve trading systems based on technical analysis by means of the RSI financial indicator. Performance of technical analysis in growth and small

CAST: Using neural networks to improve trading systems based on technical analysis by means of the RSI financial indicator. Performance of technical analysis in growth and small

However, the PDE of arithmetic MAL has never been derived and the strike based on all past moving-average term is very di¢ cult to value by …nite di¤erence approach.The second, we

Kuo, R.J., Chen, C.H., Hwang, Y.C., 2001, “An intelligent stock trading decision support system through integration of genetic algorithm based fuzzy neural network and