2020 IEEE Symposium Series on Computational Intelligence (SSCI)
on Computational Intelligence for Financial Engineeringand Economics (CIFEr) http://www.ieeessci2020.org/Paper ID: #31

Can an AI perform market manipulation at its own discretion?
- A genetic algorithm learns in an artificial market simulation Takanobu Mizuta

SPARX Asset Management Co., Ltd.
Mail: mizutata[at]gmail.com
HP: https://mizutatakanobu.com

Note that the opinions contained herein are solely those of the authors and do notnecessarily reflect those of SPARX Asset Management Co., Ltd.

You can download this presentation material fromhttps://mizutatakanobu.com/2020CIFEra.pdf

1(1) Introduction(2) Model(3) Simulation Result(4) Summary2(1) Introduction(2) Model(3) Simulation Result(4) Summary3Market manipulation is prohibited
Traders artificially increasing or decreasing market prices to profit

Stock Market
Responsible
manipulation

Artificially increased
Intentionally large impact
Spoofing, Rumors

Market manipulation is prohibited in many countries
as it leads to unfair trades.

4Who should be held responsible when AI trader performs market manipulation?

Developer builds
an AI trader

AI trader

Stock MarketResponsible
Intention
to Manipulation

Manipulation

No Responsible
present regulationsof the United States

NO intention
to Manipulation

Manipulation

Scopino(2016) indicated that when a developer builds an AI trader with no intention toperform market manipulation and the AI trader actually performs market manipulation atits own discretion, the developer should not held responsible

Even though market prices are manipulated, no one is held responsible,
which presents difficulties in maintaining the integrity of the market.

5Can AI trader discover market manipulation?
An AI trader must automatically learn the impacts of its trades on market
prices in order to discover that market manipulation earns profit.

However, AI traders are usually evaluated by backtesting
Backtesting

The profit is estimated if the AI traders were trading at a certain
point in time using historical real data on past market prices.
AI judged Buy
If AI bought, how much earns?

AI judged Sell
If AI sold, how much earns?

past market prices<- Prices are Fixed

An AI trader cannot learn the impacts of its trades to market prices

An AI trader cannot discover market manipulation by backtesting6However, an artificial market simulation enables an AI
trader to automatically learn the impacts of its trades onmarket prices because the trades alter the market prices
in the simulation.
In this study,

I constructed an AI trader using a genetic algorithm thatlearns in an artificial market simulation.
I investigated whether the AI trader discovers market
manipulation through learning even when the developerof the trader has no intention of market manipulation.
7

An artificial market model = an agent-based model for a financial market

Virtual and Artificial financial Market built on Computers
ModelsIncludeAgents (Artificial Investors)＋
Price Mechanism (Artificial Exchange)
Order

Price
Mechanism(Exchange)

Agent(Investor)

Each Agent determines anorder by some rules,
Price Mechanism gather
agents orders anddetermines Market Price

Determination market priceComplete Computer Simulation needing NO Empirical Data
✓ can discuss on the mechanism between the micro-macro feedback✓ can be conducted to investigate situations that have neveroccurred in actual financial markets✓ Of course, in the simulation the trades alter the market prices.
8(1) Introduction(2) Model(3) Simulation Result(4) Summary

9ModelGenetic
Algorithm
800 Actions (Buy(B), Sell(S), No action(null))
Gene

B

Gene
10000
GenesGeneS

B
S

S

S

S

S
S

・・・・・

B

・・・・・

B

B

Profit=Evaluation

AI agent(AIA)B

All Actions

・・・・・

Exchange

Order

Artificial Market

S

Artificial Market

Evaluation

・・・
B

Actions Indicated
By GeneNormalAgent (NA)

Evaluation

・・・GeneAll Actions

All Actions

・・・・・
S

Artificial MarketSimulation

All Actions
Evaluation

・・・
Artificial Market

Inherit to new generation after
Crossover and Mutation
Repeat 1500 generations

One Gene: indicates all 800 trades of AI agent(AIA)
is evaluated by the AIA's profit in an artificial market simulation
One artificial market: includes one gene and 1000 normal agents.
Normal agents: have same parameters for artificial markets.
-> when AIA’ trades are same, normal agents’ trade are same

Genetic algorithm: searches for the gene that earns the most profit inheriting 1500 times
includes 10000 genes(10000 artificial markets)

10Artificial Market Simulation

Artificial MarketSimulation

Stock Exchange

Actions Indicated
By Genecontinuous double auction

Shares
Sell
1030

SharesBuyAI agent(AIA)

Exchange

NormalAgent (NA)
OrderPrice
103
102
101
50
100
When buy order come here
13099
transaction immediately occurs
98
150
When sell order come heretransaction immediately occurs
97
96
70
Multiple buyers and sellers compete to buy and sell stocks in the market, andtransactions can occur at any time whenever an offer to buy and an offer tosell match.
11AI agent(AIA)
This study focuses on whether an AI trader can discover market manipulation throughlearning even if the builder has no intention of market manipulation.
Therefore, I do not intentionally model trading strategies, and my model directly searches
for all the optimal trades in an artificial market environment.
Genetic
Algorithm

800 Actions (Buy(B), Sell(S), No action(null))
Gene

B

S

S・・・・・

B

Artificial MarketSimulation

All Actions

Profit=Evaluation

Buy, Sell or, no action（every 10 tick time, one share)

Actions Indicated
By GeneAI agent(AIA)

Exchange

NormalAgent (NA)Order

The trades of AIA impacts market prices
in artificial market simulation
AIA can automatically learn the impacts of its trades on market prices

12Normal Agents

Historical Return

j: agent number (900 agents)
ordering in number ordert: tick timet − jrht, j = log(Pt / P

Expected Return of each NA)

TechnicalPf
1 tt  w1, j log t + w2, j rh, j + w3, j j r =P
i wi, j te, jwi , j and  jPf

Fundamental Price

Random ofUniform Distribution

Pt

Market Price at twi , jji=1,3: 0～1i=2: 0～1000～1000

noise

Fundamental

Parameters for agents

10000 = constantExpected Price of each NA tj

Random ofNormal
Distribution
Average=0
σ=3%Pet, j = Pt exp(ret, j )13

Fundamental and Technical Strategies
Fundamental Strategy
Fundamental Price ＞ Market Price -> Expect + return
Fundamental Price < Market Price -> Expect - return
Technical Strategy
Historical Return ＞ 0 -> Expect + return
Historical Return < 0 -> Expect - return
TechnicalStrategy

FundamentalPriceMarketPrice

Fundamental
Strategy
14Genetic algorithm

Genes are ordered by profit
800 Actions (Buy(B), Sell(S), No action(null))

Gen

B

GenGenS
BSSSSSS・・・・S10000GenesGenBSS・・・・・・・・・

B

The top 400 genes

Not changed・・・・・
S・・・・・

B

Non-top 400 genes
・・・・・

B

are replaced with a probability of 65%
by a crossover gene containing
two genes randomly selectedfrom the top 400 genes.
After crossovers, the actions are
mutated with a probability of 20%

Genetic algorithm searches for the gene that earns the most profit
inheriting 1500 times includes 10000 genes
Genetic algorithm is very popular way generally used by many many studies [Goldberg 1989]15

(1) Introduction(2) Model(3) Simulation Result(4) Summary

16

Time evolution of market prices with the AIA and without(In the following result, I used the AIA of the optimal gene in the final generation.)
10600

Price

10400

10200

10000

7000

6000

5000

4000

3000

2000

1000

09800

Tick Timewith AIA

without AIA

The AIA amplified the variation in the market prices.

17

Time evolution of market prices with the AIA and trading volume

9800

(20)

Trading Volume

07000

10000

6000

20

5000

10200

4000

40

3000

10400

2000

60

1000

106000Pricetrading volume (positive and negative numbers indicate buying and selling, respectively)
aggregated within every 200 tick times.)

Tick Time
Trading Volume of AIA (right)

Market Price (left)

Fundamental Price (left)

The AIA’s trades are evidently market manipulation.

18

market prices continued to increase even though the AIA did not buy many stocks,
because technical strategy of NA, a larger positive return was expected due to theprevious positive return
10600

60

40

10000

09800

(20)

7000

6000

5000

4000

3000

20

2000

1000

0Price10400 stocks,
bought manycausing the market
prices to10200
increase

Trading Volume

AIA was able to sell at higher prices
than when they were bought

Tick Time
Trading Volume of AIA (right)

Market Price (left)

Fundamental Price (left)

The AIA’s trades are evidently market manipulation.

19

Backtesting (without the impacts on market prices)time evolution of market prices is the same as that without the AIA
because the AIA’s trades never impact market prices

40

7000

6000

(20)
5000

9980
4000

0

3000

10000

2000

20

1000

10020

0Price10040

Trading Volume

fundamental strategy;
60
AIA had a tendency to buy stocks because the market
prices were lower than the fundamental price

10060

Tick Time
Trading Volume of AIA (right)
Market Price (left)
Fundamental Price (left)

AIA could not discover market manipulation as trading strategy

20

(1) Introduction(2) Model(3) Simulation Result(4) Summary21

Suggestion the need for regulation✓ In this study, I constructed an AI trader using a genetic algorithm thatlearns in an artificial market simulation. Then I investigated whether
the AI trader discovers market manipulation through learning evenwhen the person who built the AI trader has no intention of marketmanipulation.

✓ The results showed that the AI trader discovered market manipulation
as an optimal investment strategy. This indicates that even though
the developer has no intention of market manipulation, the AI trader
can discover market manipulation as an optimal investment strategy
through learning with an artificial market simulation in which the AI
trader automatically learns the impacts of its trades on market prices.
✓ This also indicates the possibility that an AI trader cannot discovermarket manipulation through learning with backtesting in which there
are no impacts on market prices.

22

Suggestion the need for regulation✓ The results suggest the need for regulation, such as obligating AIdevelopers to prevent AIs from performing market manipulation.

✓ Another suggestion is that developers should limit trades
performed by AI to avoid impacting market prices.

23

Can an AI perform market manipulation at its own discretion?
- A genetic algorithm learns in an artificial market simulation Takanobu Mizuta
Paper ID: #31✓ In this study, I constructed an AI trader using a genetic algorithm that learns in an artificial marketsimulation. Then I investigated whether the AI trader discovers market manipulation throughlearning even when the person who built the AI trader has no intention of market manipulation.
✓ The results showed that the AI trader discovered market manipulation as an optimal investment
strategy.
✓ This indicates that even though the developer has no intention of market manipulation, the AI
trader can discover market manipulation as an optimal investment strategy through learning withan artificial market simulation in which the AI trader automatically learns the impacts of its tradeson market prices.
✓ This also indicates the possibility that an AI trader cannot discover market manipulation throughlearning with backtesting in which there are no impacts on market prices.
✓ The results suggest the need for regulation, such as obligating AI developers to prevent AIs fromperforming market manipulation.
✓ Another suggestion is that developers should limit trades performed by AI to avoid impacting
market prices.

Appendix25

Verification: Stylized Facts
The purpose of simulation is understanding the reasons and mechanism,
not repricating ALL Stylized Facts
The simplicity of the model is very important because unnecessary replication of macro phenomena
leads to models that are overfitted and too complex. Such models prevent understanding anddiscovery of mechanisms affecting price formation because of the increase in related factors.
Many empirical studies, e.g., Sewell 2006 have shown that both stylized facts (fat-tail and volatilityclustering) exist statistically in almost all financial markets.
Conversely, they also have shown that only the fat-tail and volatility-clustering are stable for any assetand in any period because financial markets are generally unstable.

Fat-tail

1 to 100

kurtosis of price returns is positive

Volatility-clustering

0 to 0.2

square returns have a positive auto-correlation

The magnitudes ofthese values are
unstable and vary
greatly depending on
the asset and/orperiod.

For the above reasons, an artificial market model should replicate these values as significantly positive
and within a reasonable range as I mentioned. It is not essential for the model to replicate specificvalues of stylized facts because the values of these facts are unstable in actual financial markets.
26

Stylized Facts

The model of Chiarella (2002) is very simple but replicates long-term statistical characteristics observed in actual
financial markets: a fat tail and volatility clustering.
In contrast, Mizuta (2013) replicates high-frequency micro structures, such as execution rates, cancel rates, andone-tick volatility, that cannot be replicated with the model of Chiarella (2002).
The simplicity of the model is very important for this study, because unnecessary replication of macro phenomena
leads to models that are overfitted and too complex. Such models prevent understanding and discovery ofmechanisms affecting price formation because of the increase in related factors.

27Normal Agent(NA)The model of Mizuta (2013) is based on Chiarella (2002).
The model is satisfied with stylized facts (statistical characteristics
observed in actual financial markets).

Expected Return of each NA

TechnicalPf
1 tt  w1, j log t + w2, j rh, j + w3, j j r =P
i wi, j te, jFundamentalnoiseAll NAs use this same equation to obtain an expected return,however, because w is different each agents, expected returns aredifferent each agents. This leads heterogeneous (many order prices
are diversified) although the model is simple.

The simplicity of the model is very important.
Models include too many related factors prevent
understanding and discovery of mechanisms affecting
price formation.

28

Order Price and Buy or Sell
Price

Order Price of each NAto, jPSell(one unit)
RandomExpected Price of each NA(Uniformttt
P=Pexp(re, je, j )Distribution)
Buy(one unit)

To replicate many waiting limit orders,order price is scattered around expected price
NA places one buy order when order price > expected price
NA places one sell order when order price < expected price29

Additional Ten Simulation Runs
No.
2
3
4
5
67
8
910
11Simulation
Min/Pf-1 Max/Pf-1 (Max-Min)/Pf Trading Volume of AIA
Result Type-0.59%
4.12%
4.7%
518 Manipulation(overbuying)-0.63%
4.49%
5.1%
506 Manipulation(overbuying)-0.77%
5.37%
6.1%
496 Manipulation(overbuying)-4.33%
0.00%
4.3%
414 Manipulation(underselling)-0.14%
0.00%
0.1%
0No Trades-3.67%
0.03%
3.7%
489 Manipulation(underselling)-0.77%
5.02%
5.8%
511 Manipulation(overbuying)-0.61%
4.96%
5.6%
507 Manipulation(overbuying)-3.68% -0.01%
3.7%
491 Manipulation(underselling)
0.00%
0.17%
0.2%
0No Trades✓ Eight runs resulted in manipulation including two underselling✓ Two were no trades✓ No fundamental strategy
30

No.
2
34
5678910
11

Back Testing
Min/Pf-1 Max/Pf-1 (Max-Min)/Pf Trading Volume of AIA-0.04%
0.13%
0.2%
221
-0.08%
0.21%
0.3%
230
-0.10% -0.03%
0.1%
0-0.10%0.01%
0.1%
0-0.14%
0.00%
0.1%
413
-0.05% -0.01%
0.0%
0-0.05%
0.23%
0.3%
482
-0.04%
0.11%
0.2%
529
-0.01%
0.13%
0.1%
567
0.00%
0.17%
0.2%
484

Result Type
Fundamental Strategy
Fundamental Strategy
No Trades
No Trades
Fundamental Strategy
No Trades
Fundamental Strategy
Fundamental Strategy
Fundamental Strategy
Fundamental Strategy✓ Seven fundamental strategy✓ No manipulation319400(20)Trading Volume07000

9600

6000

20

5000

9800

4000

40

3000

10000

2000

60

1000

10200

0

Price

No. 5; Manipulation(underselling)

Tick Time
Trading Volume of AIA (right)

Market Price (left)

Fundamental Price (left)

32