19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary...

43
23 June 2022 All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez Jaramillo Edward Tsang CCFEA , Essex

Transcript of 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary...

Page 1: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

CHASMCo-evolutionary Heterogeneous

Artificial Stock Markets

Serafín Martínez Jaramillo

Edward Tsang

CCFEA, Essex

Page 2: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

CHASM Research Summary

Ref: AI-ECON, Giardina et al 2003, other markets

Questions: How does the

price change?What is the

effect of learning by traders?

Artificial Marketendogenous

EDDIEEDDIEEDDIE

EDDIEEDDIEFundamental

EDDIEEDDIENoise

Poly

mor

phic

CHASM Platform

0

1000

2000

3000

4000

5000

6000

7000

8000

Page 3: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

CHASM Overview

EDDIE AgentsAgents evolveHeterogeneous beliefsExample agent

Agents: technical, fundamental, noise or hybrid (mode switching)Experimenter controls the number of agents in each group

Page 4: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Experimenter’s controls

Users have control over:• Market Mechanisms• Number of traders• Etc.

Page 5: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Heterogeneity

LIMIT ORDERS

FUNDAMENTALIST

% TO TRADE

INDICATORS

COMPUTING POWER TIME & RETURN

LEARNING

No

Agents learn:Periodic ¦ Red Queen

Homogeneity

HeterogeneityHomogeneity

Heterogeneity

Homogeneity

50%

100%

Partial ¦ CompleteNo

Buy ¦ Sell

No

Base Case for Stylized Facts

Seven dimensions explored

Page 6: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Summary of Base Case

• Agents must be competent and use balanced training data (realistic expectation)

• Presence of fundamental traders needed

• Limit orders (trading strategies) essential

• % traded and time & return matter

• Heterogeneous computing power and beliefs not essential

Page 7: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

A condition for stylized facts

Limit Order Yes No

Fundamental Traders

Partial / Complete

No

Computing Power

Homogeneous Heterogeneous

% to Trade 50% 100%

Indicators Heterogeneous Homogeneous

Time & Return Homogeneous Heterogeneous

Evolving agents No Yes

Page 8: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Learning Improves Performance

Page 9: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Learning under Red Queen

Page 10: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Prices and ReturnsStock price under Red Queen constraint

245

250

255

260

265

270

275

1 78 155 232 309 386 463 540 617 694 771 848 925

Period

Pri

ce

Return under the Red Queen constraint

-0.01

-0.008

-0.006

-0.004

-0.002

0

0.002

0.004

0.006

0.008

0.01

Period

Ret

urn

Stock price under Ad Hoc retraining

252254256258260262264266268270272274

1 77 153 229 305 381 457 533 609 685 761 837 913 989

Period

Pri

ce

Return under Ad Hoc retraining

-0.01

-0.008

-0.006

-0.004

-0.002

0

0.002

0.004

0.006

0.008

0.01

Period

Ret

urn

Page 11: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Artificial Finance Market Conclusions

• Platform developed– It supports a wide range of experiments

• Conditions for stylized facts identified in endogenous, realistic market

• Agents must be competent and realistic– Some must observe fundamental values

• Learning agents (EDDIE-based):– Statistical properties of returns and wealth distribution

changed– No need for fundamental trader!

Page 12: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

CHASMCo-evolutionary Heterogeneous

Artificial Stock Market

Details and Explanations

Page 13: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

CHASM Market Details

Assets

Market Mechanism

Excess Demand

Rationing

Wealth Dynamics

GIARDINA, I.A. and J.P.A. BOUCHAUD, 2003. Bubbles, crashes and intermittency in agent based market models. The European Physical Journal B-Condensed Matter , Vol.31, 421-437

Page 14: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Assets

The market participant i will be able to hold at time t, two different types of assets:

– a risky asset, denoted by hi(t) or

– cash, denoted by ci(t)

The stock price at time t will be denoted by P(t)

)(thi

Page 15: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Market Mechanism

• Agent i will take decision di(t) at time t: di(t) = 1 to buy

di(t) = –1 to sell

di(t) = 0 to do nothing

• Agent i makes a bid or offer of a fraction qi(t) of its current holding:

0)(0

1)()(

1)()(

)(

)(

tdif

tdiftgh

tdiftp

tcg

tq

i

ii

ii

i

g is a parameterci is cashhi is stock holdingp is price of stock

Page 16: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Excess Demand• The aggregated volume of bids: B(t)

• The aggregated volume of offers: O(t)

• Excess demand: D(t)

)(tB

)()()( tOtBtD

• Price is calculated in the following way:(λ is a parameter):

/)()1()( tDtPtP

Page 17: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Rationing

The amount of shares that the agent i will actually buy or sell is:

1)()(

1)()(

)()(

tdifthg

tdiftP

tCg

t

ii

ii

i

Page 18: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Wealth dynamics

Finally we can update the traders’ holdings of cash and the risky asset:

)()1()( tthth iii

)()()1()( tPttctc iii

Page 19: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

CHASM Traders

Details and Explanations

Page 20: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Evolving Agents

• Evolution:– The wealth of an investor is the main factor to

search an improvement on his prediction rules (Red Queen dynamics)

• Benchmark and calibration:– Stylised facts

• Time:– Discrete time jumps

Page 21: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Example Agent

ITE

Buy ITEAnd

= Sell Hold= Not

<MV_12 233

TRB_5 27.3

VOL_12 -16.5

Page 22: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Traders Heterogeneity

• Noise traders– Homogeneous

• Fundamentalists– Departure from the fundamentals T– Threshold value

• Technical traders– Computational Capabilities– Indicators set– Rate of return and time horizon– Fundamental behavior– Limit orders

Page 23: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Traders

The market is composed by technical, fundamental and noise traders. We define NT as the number of technical traders, NF as the number of fundamental traders, NN as the number of noise traders and N as the total number of traders in the market.

Page 24: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Noise traders

The noise traders will take a decision to buy, sell or do nothing with different probabilities, pb, ps and pn respectively. Such probabilities are defined before the simulation and remain with the same value during the simulation.

Page 25: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Fundamentalists

• They will change their position on the risky asset if the price departs from a value that they perceive as the fundamental one. These traders will continue to adjust their positions until such difference T, is lower than a certain threshold value Farmer 1998.

• The above mentioned values will be generated for each individual trader by drawing random numbers from uniform intervals [Tmin, Tmax] for T and [min max] for . – These limits of such intervals are user specified.

Page 26: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Technical traders

Technical analysis is a key feature of the behavior of these agents. Technical analysis is an important tool for decision making in investment. Besides, there is strong evidence that technical analysis is being used extensively in financial markets.

We are not restricted to use just technical indicators. We use some momentum indicators as well.

EDDIE is the basic framework to the design of the investment strategy of our agents

Page 27: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Technical traders

The technical traders forecast if the price is going to rise by a certain r% within a certain number of days n.

They will be equipped with up to eight different technical and momentum indicators.

Under certain circumstances they will be able to behave like fundamentalists.

Page 28: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Limit orders

• A realistic investment strategy was necessary to complete the design of the agents.

• For that reason, limit orders were created as part of their exit strategy. – Orders to buy or sell at certain prices

• The technical traders can generate two types of limit orders:– Profit taking– Stop loss

Page 29: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

CHASM Results

Page 30: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Page 31: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Page 32: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Page 33: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Page 34: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Page 35: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Page 36: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Artificial Financial Markets

• Santa Fe Artificial Stock Market• Zero Intelligence Agents• Minority Game• Microscopic simulation• Econo-physics• Genetic Programming• Neural Networks• Learning Classifier Systems

Page 37: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

GP Markets comparison

• AI-ECON– Price based on excess

demand (Farmer’s work)

– Each tree is an agent– Business School:

Fixed retraining periodicity (exogenous)

– Notion of ranking

• CHASM – Price based on excess

demand– Each Trader has a

population of trees– Fixed periodicity and

“Red Queen” dynamics (endogenous)

– Relative Wealth drives the desire to improve

Page 38: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

No Limit Order

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Page 39: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

No Fundamental Trader

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Page 40: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

Heterogeneous Computing Power

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Page 41: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

Trading 100% of capital

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Page 42: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

Homogeneous Indicators

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo

Page 43: 19 October 2015All rights reserved, Edward Tsang & Serafin Martinez jaramillo CHASM Co-evolutionary Heterogeneous Artificial Stock Markets Serafín Martínez.

Heterogeneous time and return

20 April 2023 All rights reserved, Edward Tsang & Serafin Martinez jaramillo