text
stringlengths
0
6.44k
Evaluation
Inherit to new Generation after Crossover and Mutation
Repeat Ne generations
Fig. 1: My model
2 Model
in the artificial market simulation. The genetic algo-
rithmsearchthegenemostearnsprofit. Thissearching
A human building an AI trader (builder) gives the correspondswithwhattheAItraderlearnshowtrades
AI trader candidates of trading strategies, and makes earns profit.
theAItradertolearnwhichstrategiesandparameters Of course, trades of the AIA impact market prices
earn more. This study focuses whether an AI trader intheartificialmarket,butforthepurposeofcompar-
candiscovermarketmanipulationthroughlearningde- ison, I also investigated the case without the impacts
spitethebuilderhasnointentionofmarketmanipula- to market prices (backtesting).
tion2. In the following, at first I explain the artificial mar-
Fig. 1schematicallyshowsamodelofthisstudy. An ketsimulationevaluatingeachgeneandthen,Iexplain
AI trader that the builder intents no trading strategy the genetic algorithm searching the gene most earns
is modeled using a genetic algorithm in which a gene profit.
includesalltrades. Eachgeneisevaluatedintheartifi-
cial market simulation. The artificial market includes
2.1 Artificial Market Simulation
an AI agent (AIA) that trades exactly same as one
geneindicating. ThegeneisevaluatedbyAIA’sprofit In this study, I built an artificial market model added
an AIA to the artificial market model of Mizuta [2]
2In reality, the builder always intents some kinds of strate- In the model here, there is one stock. The stock
gies in the process of picking up and modeling candidates of exchange adopts a continuous double auction to de-
strategies. In contrast, it is very important for this study that
termine the market price. In this auction mechanism,
the builder has no intention of any strategies including market
multiple buyers and sellers compete to buy and sell
manipulation. Therefore, I do not intentionally modeled trad-
ing strategies and my model directly searches for all the best financial assets in the market, and transactions can
trades in an artificial market environment. Due to no models occur at any time whenever an offer to buy and an of-
oftradingstrategiesmymodelcannotmakeanyoutputsinan
fertosellmatch. Theminimumunitofpricechangeis
out-sample,thennoonecantestmymodelinanout-sample. I
argue,however,thatthisstudyneedsnoevaluationsinanout- δP. The buy-order price is rounded off to the nearest
samplebecausethisstudyfocuseswhetheranAItradercandis- fraction, and the sell-order price is rounded up to the
covermarketmanipulationthroughlearningdespitethebuilder nearest fraction.
has no intention of market manipulation. This study does not
The model includes n normal agents (NAs) and an
aimtousemymodelinactualfinancialmarketsthatareinan
out-sampleenvironment. AIA.Agentscanshortsellfreely. Thequantityofhold-
2
ing positions is not limited, so agents can take any whenPt >Pt ,theNAplacesanordertobuyone
e,j o,j
shares for both long and short positions to infinity. share, but
Agents always places an order for only one share. I whenPt <Pt ,theNAplacesanordertosellone
e,j o,j
employed “tick time” t that increase by one when an share4. The remaining order is canceled after t from
c
agent orders. the order time.
2.1.1 Normal Agent (NA)
2.1.2 AI Agent (AIA)
To replicate the nature of price formation in actual
Every δt tick time the AIA takes one of three actions
financialmarkets,IintroducedtheNAtomodelavery
that are buy one share (at the lowest sell order price
general investor. The number of NAs is n. First, at
on the order book), sell one share (at the highest buy
time t = 1, NA No. 1 places an order to buy or sell
order price on the order book) and no action5. The
its risk asset; then, at t = 2,3,,,n, NAs No. 2,3,,,n
AIA takes actions N = (t − t )/δt times through
respectively place buy or sell orders. At t=n+1, the t e c
the whole one artificial market simulation, where one
model returns to the first NA and repeats this cycle.
simulation runs until tick time t . The actions are
An NA determines an order price and buys or sells as e
givenbyonegeneinthegeneticalgorithmasfollowing
follows. It uses a combination of a fundamental value
I will mention.
and technical rules to form an expectation on a risk
asset’sreturn. Theexpectedreturnofagentj foreach
risk asset is 2.2 Genetic Algorithm
P Pt−1
rt =(w log f +w log +w (cid:15)t)/Σ3w 2.2.1 Genes and Artificial Market
e,j 1,j Pt−1 2,j Pt−τj−1 3,j j i i,j
(1) Fig. 1 schematically shows a model of this study. An
where w i,j is the weight of term i for agent j and is AI trader that the builder intents no trading strategy
independently determined by random variables uni- is modeled using a genetic algorithm. The number of
formly distributed on the interval (0,w i,max) at the genes is N g. One gene has information of actions and
start of the simulation for each agent. log is natural the number of actions that one gene has is N . Each
t
logarithm. P f is a fundamental value and is a con- action is one of three actions that are buy one share,
stant. Pt is a market price that is the mid price (the sell one share and no action. Each gene is evaluated
average price of the highest buy order price and the by profit of the AIA in an artificial market, in where
lowest sell order price), and (cid:15)t j is determined by ran- the AIA trades every δt tick time same as N t actions
domvariablesfromanormaldistributionwithaverage one gene indicating. When the AIA holds stocks at
0 and variance σ (cid:15). Finally, τ j is independently deter- the end of a simulation, the stocks are evaluated as
mined by random variables uniformly distributed on P . All artificial markets has exactly same NAs using
f
the interval (1,τ max) at the start of the simulation for same random numbers. Therefore, if the AIA trades
each agent3. same,theartificialmarketsoutputsamemarketprices
The first term of Eq. (1) represents a fundamental and same NAs’ trades.
strategy: the NA expects a positive return when the
market price is lower than the fundamental value, and
vice versa. The second term of Eq. (1) represents a 2.2.2 Inheritance to Next Generation
technical strategy using a historical return: the NA
The top N genes that earned most are not changed
expects a positive return when the historical market ge