32
Detecting State Transitions in a Stock Market with Many Agents Eric Van Horenbeeck PhD CNTS, University of Antwerp

State Transitions

Embed Size (px)

DESCRIPTION

Detecting buy and sell signals for assets in a stock market. Calculates the transition from schooling to swarming with asset prices. It is NOT a technical analysis method.

Citation preview

Page 1: State Transitions

Detecting State Transitions in a Stock Market with Many Agents

Eric Van Horenbeeck PhDCNTS, University of Antwerp

Page 2: State Transitions

Detecting State Transitions in a Stock Market with Many Agents

Main thesis: Decisions based on state transitions perform better than

decisions based on models of complex behavior

A transition occurs when an interactive system is triggered into an alternate state of organization

Page 3: State Transitions

Detecting State Transitions in a Stock Market with Many Agents

Outline1. Example

2. A Stock Market is a Complex Environment

3. Self-organization

4. Swarming and Schooling

5. Detecting State Transitions

6. Results

7. Summary

8. Future Work

Page 4: State Transitions

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

Page 5: State Transitions

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

• Red line: US funds with a range of annual return for ten years ending December 2000. Blue line: returns from random chance

• The red and blue lines are on top of each other indicating that the number of above average funds is no different than if fund returns were based entirely on luck.

• The number of fund managers with above-average returns over the last ten years is no different than would be by chance

Page 6: State Transitions

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

Page 7: State Transitions

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

• Technical traders assume that prices follow a pattern

• Fundamental analysts assume prices respond to underlying economic realities

• Random Walk Theory and Efficient Market Hypothesis hold that the best bet for tomorrow’s stock price is its value today

But

Page 8: State Transitions

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

• Long term feedback effects

• Erratic behavior under certain conditions

• Fractal structure

• Sensitive on initial conditions

• Trading behavior is neither purely rational nor random

Page 9: State Transitions

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

• Distances between intraday prices are small relative to the length of the path covered, i.e. trade prices are clustered

• Stock market as a system shows regularity in spite of unpredictable interaction between its agents

• We have biological and physical models that exhibit similar behavior: ants, fish, plasma oscillations ...

Page 10: State Transitions

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

From biological models* we learn:

• Strong relation exists between the constant J, coupling individual members and the strength of noise

• In the swarming phase where J < 5 , the center of the school hardly moves, whereas if J > 5 the fish form a tighter group with a rectilinear movement

• characterizes the non-linearity of the system, -1/2 is the steady swimming speed of fish

• At J -1/2 = 5 / -1/2 the schooling structure is self-organizing

* Hiro-Sato Niwa (1994) Self-organizing Dynamic Model of Fish Schooling. In Journal of Theoretical Biology, 171, p. 23 – 136

Page 11: State Transitions

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

• / -1/2 stands for the magnitude of random movement J where -1/2 indicates the mean strength of influence on one individual by the other individuals as a group

• A transition occurs when the system is no longer driven by the average behavior of individuals. At the sudden transition between incoherent and coherent interaction, the school takes over and the individual becomes a follower.

Page 12: State Transitions

Always clustering (no ego trips)

Always self-organizing (no leaders)Sometimes polarized behavior (schooling)

Sometimes random (swarming)

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

Page 13: State Transitions

Monday Tuesday Wednesday Thursday Friday

5 days of swarming and schooling by Philips (Nov. 29 - Dec. 3 ‘99)

118,4

119,4

120,4

121,4

122,4

123,4

124,4

125,4

0 1000 2000 3000 4000 5000 6000

Page 14: State Transitions

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

• Even without formal communication, traders cluster • These clusters show self-organizing features (schooling)

• The trace of alternating swarming and schooling phases exhibits fractal characteristics

• Technical and fundamental analysts presume the existence of a limit circle attractor. It might exist but...

• The path is unstable and the time scale unknown

Page 15: State Transitions

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

• Modeling a price path is hard and unsure • Knowledge of the (long term) past is not necessary when one knows to recognize a turning point

• Perception of the current state is sufficient

Problem: how to detect a state transition?

Page 16: State Transitions

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

-2 -1 1 2

13.6%

13.6%

34.1%

34.1%

Normal distribution of the variance of the observations

(Gaussian noise)Variance outside the normal distribution

Variance outside the normal distribution

Page 17: State Transitions

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

• Gaussian noise stands for fluctuations with a probability density function of the normal distribution

• The observed values should have a variance that is Gaussian distributed

• Probability of error erf(x) gives the probability that a single sample from a random process with zero-mean and unit-variance Gaussian probability density function will be greater or equal to x

• We assume that the variables are correlated (schooling)

• However, if they behave independently & random the covariance would be zero (swarming).

Page 18: State Transitions

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

• The autocorrelation coefficient (ACF) measures the covariance of a set with size n at t with a set n+1at t+1

• The error function erf(x) indicates the probability that the ACF belongs to a normally distributed population

• ACF > erf(x) phase wave = 1 ACF < 1-erf(x) phase wave = -1

• Transition point when phase wave changes sign, indicating a loss of coherence in the current state

• Loss of coherence = loss of memory

Page 19: State Transitions

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

Simplified meta model

Page 20: State Transitions

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

Real world phase transition wave

Page 21: State Transitions

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

• Random Harvester is a trading agent that uses phase transition signals to buy and sell stock

• Application of business rules: transaction costs, expiration of contracts...

• Tested on real (historical) data, fed one by one without recalculation of past positions

Page 22: State Transitions

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

Page 23: State Transitions

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

Page 24: State Transitions

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

Transaction Date Buy Sell Result 1 Apr 16 93 106.23 2 Jun18 93 104.76 3 Jun 30 93 106.77 0.54 4 Sep 27 93 112.85 8.08 5 Oct 1 93 113.04 6 Nov 3 93 114.99 1.95 7 Dec 14 93 116.11 8 Jan 21 94 117.51 1.40 9 Jan 27 94 116.84 10 Apr 15 94 103.41 11 Jul 8 94 99.11 12 Aug 4 94 101.13 2.01 13 Oct 19 94 96.99 14 Nov 18 94 94.26

Page 25: State Transitions

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

Page 26: State Transitions

5. Detecting State Transitions6. Results7. Summary8. Future Work

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

Transaction Buy Sell Result Costs 1 3.979 39,79 2 4.142 162 41,00 3 3.914 39,13 4 3.480 -434 34,45 5 1851 18,50 6 2.790 940 27,90 7 2.855 28,55 8 3.033 178 30,02 9 3.530 35,29 10 3.910 380 38,71 11 3.857 38,57 12 4.172 315 41,30 … Total 5.161 2.315 605

Page 27: State Transitions

• Random Harvester worked on Arbed for a simulated period of 3 years

• 17 transactions were executed (one at a loss)

• Accrued asset value: 5.100 - 3.979 = 1.121

• Harvested: 2.315 - 605 = 1.710

• Total return 2.831,- or 71% on the initial value

• 60% of the return is a contribution from Random Harvester

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

Page 28: State Transitions

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

• The main problem with long term memory is information loss about the current state

• Long intervals create an illusion of predictability

Page 29: State Transitions

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

• Action is induced by a phase transition (coherence breaking)

• Perceiving signals of imminent change is necessary to adapt behavior according to the appropriate business rules

• No need to model the full path

• Strong preliminary results

Page 30: State Transitions

1. Example2. A Stock Market is a Complex Environment3. Self-organization4. Swarming and Schooling

5. Detecting State Transitions6. Results7. Summary8. Future Work

• Improve direction detection after a transition with vector analysis of local clusters

• Comparing with other trading agents under similar conditions

• Generalize use to class of decision problems based on the current state in a dynamic environment

Page 31: State Transitions

... for the gods perceive future things, ordinary men things in the present, but wise men

perceive things about to happen ...

Philostratus, Life of Apollonius of Tyana, VIII, 7*

* Quoted in Taleb, Nassim N. (2001). Fooled By Randomness. The Hidden Role of Chance in the Markets and in Life. New York, NY: Texere, p. 56

Page 32: State Transitions

ReferencesW. B . Arthur, S. N. Durlauf and D . A. Lane, eds.1997. The Economy as an Evolving Complex System II. Addison-Wesley. Reading, Mass.P. Bak, M Paczuski and M. Shubik. 1996. Price Variations in a Stock Market with Many Agents. Working Paper for the Santa Fé Institute Economics Research Program, submitted to the Journal of Mathematical Economics.P. De Grauwe, H. Dewachter and M. Embrechts. 1993. Exchange Rate Theory, Blackwell, Oxford.J. L. Deneubourg, S. Goss, N. R. Franks, A.Sendova-Franks, C. Detrain and L. Chretien.1990. The Dynamics of Collective Sorting:Robot-like Ants and Ant-like Robots. In J-A Meyer and S. Wilson eds, Simulation of Adaptive Behaviour: from Animals to Animats, MIT Press, Cambridge, Mass.E.F. Fama and K.R. French. 1992. The Cross-Section of Expected Stock Returns. In the Journal of Finance, 2.K..R. French and R. Roll. 1986. Stock Return Variances, The Arrival of Information and the Reaction of Traders. In Journal of Financial Economics, 17.L. Harris. 1986. A Transaction Data Study of Weekly and Intradaily Patterns in Stock Returns. In Journal of Financial Economics, 16.A. W. Lo and A. C. MacKinlay 1999. A Non-Random Walk Down Wall Street. Princeton University Press, Princeton.B. Mandelbrot. 1966. Forecast of future prices, unbiased markets and martingale models. In The Journal of Business of the University of Chicago,39 .B. Mandelbrot. 1998. Fractals and Scaling in Finance: Discontinuity, Concentration, Risk. Springer-verlag, New York.R.N. Mantegna and H.E. Stanley. 1995. Scaling Behavior in the Dynamics of an Economic Index. In Nature, 376.Hiro-Sato Niwa. 1994. Self-organizing Dynamic Model of Fish Schooling. In Journal of Theoretical Biology, 171.E. P. Peters. 1991. Chaos and Order in Capital Markets. J. Wiley and Son, New York.R. J. Schiller. 1984. Stock Prices and Social Dynamics In The Brookings Papers on Economic Activity, 2.