The candidate confirms that the work submitted is their own and the appropriate credit has been given where reference has been made to the work of others.
I understand that failure to attribute material which is obtained from another source may be considered as plagiarism.
Alternative trading strategies for
software agents in an artificial
stock market
Sönke Wendt
Erasmus Computing
Session (e.g., 2005/2006)
Summary
This report shows the requirements for self-trading software agents in an artificial stock market. As an example, it was tried to implement a numerically based self-trading software agent based on the downhill simplex into an artificial stock market. Therefore the author chose the often-used Santa Fe market. The failed implementation shows the problems of this approach. In the second part of this report the behaviour of fix-strategy agents in artificial stock markets are analysed. A direct relation between the strategy of the agents and their profit is shown.
Table of Contents
1 Introduction... 1
1.1 Artificial Stock market...1
1.2 Aim of the Projects... 1
1.3 Minimum Requirements... 1
1.4 Objectives of the Project...1
1.5 Problems during the implementation phase...2
1.6 Software tools used...2
2 Project Management...2
2.1 Project procedures and management... 2
2.2 Project schedule... 4
2.3 Project intensity... 7
2.4 Which problems occurred and how they were solved... 7
2.4.1 Software technique problems...7
2.4.2 Software evaluation ...8
3 The artificial stock market model...8
3.1 Agents... 9
3.1.1 Different types of agents... 10
3.1.2 What is the best strategy?...11
3.1.3 Risk aversion...11
3.2 Assets... 12
3.3 Trading procedure...12
4 Find a market for the project... 13
4.1 The implementation of the Santa Fe market and the choice...13
5 The optimisation algorithm... 14
5.1 Requirements for the algorithm... 14
5.1.1 Analysing the genetic algorithm... 14
5.1.2 The optimisation problem and communication with the market maker... 16
5.2 Choose of a optimisation algorithm...18
5.2.1 Numerical based algorithms...19
5.3.2 Main idea of the downhill simplex and its power as a forecasting algorithm...21
5.3.3 Adapting the problem to the downhill simplex...22
5.3.3.1 Initialisation phase...22
5.3.3.2 Swing in time ...23
5.3.3.3 Step reduction...23
5.3.3.4 Step enlargement ... 25
5.3.3.5 How to define the forecasting quality of this point... 27
5.3.3.6 Adapt the shape of the triangle to the solution...27
5.3.4 Tuning ideas...31
5.3.5 Problem with the Simplex...32
5.3.5.1 The price adjustment function ...32
5.3.5.2 Prohibit the simplex to run out of range...32
5.3.5.3 What is left of the main idea of the downhill simplex?...33
5.4 General concerns of usage of numerical optimisation strategies...33
5.5 Result and resume of the implementation...34
6 Evaluation of single strategy agents... 35
6.1 Aim of the analysis... 35
6.2 Fixed strategy agents... 35
6.3 Configuration of the market...37
6.4 Evaluation Model...38
6.5 Evaluation and trials... 39
6.5.1 Behaviour of the GA-Agents... 39
6.5.2 Fixed strategy agents without variance and fixed risk aversion ... 40
6.5.3 Optimistic set of agents...42
6.5.4 Fixed strategy agents with the use of the variance...43
6.5.5 Different risk aversions...44
6.5.6 Special selection of agents... 45
6.6 Results...46
1 Introduction
1.1 Artificial Stock market
Artificial stock markets are simulation models which allow to model and analyse stock markets and the behaviour of the market participants. The market participants are designed as software agents. The price of the assets on the market is generated by the demand of its participants. One goal for the designer is to create a market behaviour which is similar to normal stock markets. Also the trading behaviour of the agents should follow any reasonable strategy.
1.2 Aim of the Projects
Self-trading non-GA-based software agents in an artificial stock market.
1.3 Minimum Requirements
• Understand the actual implementation of the stock market and the uses of the genetic
algorithm.
• Develop and implement a new algorithm
• Define test scenes and evaluation rules for comparing my algorithm with existing
ones.
• Based on the results of the test scenes, optimize and adjust my optimization algorithm.
1.4 Objectives of the Project
I will develop and implement a new trading agent into the artificial stock market beside the genetic algorithm one. The only way to test and analyse the agent is to implement this agent into the stock market. Then I am able to run trials on this market and can see how well the agent works.
1.5 Problems during the implementation phase
This project report focus on two main topics. The first topic in chapter five talks about the implementation of a numerically based optimisation strategy into an artificial stock market. The second focus of this work is on the evaluation of the trading behaviour of fixed-strategy agents.
At the end of the research work into the downhill simplex I realized that the chosen
optimisation strategy cannot be used to work for this aim in this environment. Accidentally, I ran some trials on this stock market with a fixed-forecasting strategy and stock price
expectation for each agent. In the second part I focus on the results of these fixed-forecasting strategy agents.
1.6 Software tools used
The simulation program of the artificial stock market is written in Java 1.4.2. I decided to use Eclipse 3.0.1 as the development environment. To visualise the work of the simplex GNU-Plot [GNU-Plot team] was used. The visualisation of the data was done with MS Excel 10.0.
2 Project Management
In the mid term report I decided to describe my work procedure with the expedition procedure model [see: for instance Mack,J]. This model describes a project as a expedition. During such a expedition a lot of problems can occur and setbacks need to be coped with. In this chapter I describe my expedition of a “stock market project”, show my project schedule and talk about the technical and organisational problems during the project. At the end, I will focus on my personal experience and the impact which the problem that occurred had on the project.
2.1 Project procedures and management
At the beginning of my expeditions I marked my project route with several milestones to accomplish the minimum requirements. The main milestones are:
1. Background reading about artificial stock markets. 2. Select a source code of an artificial stock market.
3. Understand the actual implementation of the stock market and the source code. 4. Understand the uses of the genetic algorithm.
5. Find an idea for a new algorithm. 6. Implement this strategy into the market.
7. Define test scenes and evaluation rules for comparing my algorithm with existing ones.
8. Based on the results of the test scenes, optimize and adjust my optimization algorithm.
These milestones should give orientation and motivation during my work. For the exact planning of reaching each milestone, I set several tasks with corresponding goals for each week. This myopic, exact planning as part of the agile methods is part of the expedition view. But the final goal of the project and the milestones should be never forgotten. Especially at the beginning of the project I wanted to make too much progress. So I thought that I had reached a milestone but later realised that I had not understood it as correctly and well as I needed to discover the next milestone correctly. So I often was at the point of stepping back and covering the milestones correctly. This fact was counter-productive for my motivation and confidence during the process.
As I reached to milestone 5, I realised that the preparation work had not been enough to ensure a smooth implementation of the downhill simplex. So I realised in the middle of the project that I had quality problems with my work. The project management for agile methods recommends, among other measures, tests, cooperative work, prototyping and documentation to ensure the quality of the work. These methods are designed to ensure the quality of
software products and especially its production process. I decided to focus more on the quality of the work and added extra times for analysis and correction of my work to my schedule. Instead of cooperative work I decided to roughly write down the results of the working sessions and start the next session with a short analysis of the documents to detect failures of previous working sessions. Writing and reading acts as a double check of the work and prevents silly mistakes.
However, for the results of the first week I realised that it is difficult to find all failures of the previous work to improve the quality without redoing everything, so that at the end of the project I had to struggle with these starting mistakes.
To reach the last milestones, I tried a lot of adjustments and tuning ideas to design good forecasting values for this trading agent. But at the end I came to the conclusion that all necessary adjustments to make this optimisation strategy stable would almost completely replace the main strategy of this forecasting algorithm.
During the project time I often evaluated the behaviour of the simplex. Accidentally, I ran plenty of trials which fixed strategy agents. I did not realise this and started to evaluate the behaviour of agents with this strategy. As I started to analyse the behaviour of the agents and noticed the statical behaviour I realised the mistake.
But the result of the market which are generated by fixed strategy agents look quite
interesting. Most ideas I developed to evaluate market effects of the downhill simplex can be used for fixed strategy agents as well, so that during my expedition I found new interesting areas in the stock market and decided to add a new topic to this project.
Due to the effects of implementing the downhill simplex I learned a lot about the optimisation problem and the general problems of implementing numerical optimisation problems on artificial stock markets. The results of the market with fixed-strategy agents compared with the GA ones are interesting as well. So I think that my expedition did not discover the planned map, but the new ways I accidentally discovered were also interesting.
2.2 Project schedule
Shows only the schedule
The project started on the 11th of October with the first meeting with my supervisors. We
decided to meet every Tuesday morning. A chronological overview of my working schedule for this project:
11 October to 18 October
• brief orientating readings • understanding the research field
• start to think about the aim of the project.
18 October to 25 October
• decided to work on an artificial stock market • find abstract ideas about the aim of the report. • present the ideas on 25 October
• start reading about artificial stock markets.
• looking for an appropriate source code • reading
• define exact project aim and present it on 1 November
1 November to 8 November
• reading about genetic algorithms • analysing the different source codes
• decide to use the source code of Norman Ehrentreich • start to understand the source code
8 November to 15 November
• continue analysing the source code
• start reading about on-line problems and optimizations • find the idea of the downhill simplex
15 November to 22 November
• implement the first version of the downhill simplex • run first trials
22 November to 29 November
• analyse the problems of the simplex • find ideas to reduce the step length • implement some new ideas
• think about next steps of the project
29 November to 6 December
• write mid term report
6 December to 14 December
• find first problems with the downhill simplex • implement export file for GNU Plot
• implement plugs for data evaluation
22 December to 3 January
• semester break
4 January to 20 January
• preparing for the exam and exam period • planing resizing of the shape
21 January to 31 January
• implement resizing of the shape
31 January to 7 February
• analyse and correct resizing of the shape
7 February to 14 February
• found further bugs and corrected them
14 February to 21 February
• focus mainly on essay and coursework
21 February to 28 February
• think about statistical evaluation and implement data • implement random number observer
28 February to 6 March
• evaluate results
6 March to 14 March
• realise the bug which creates good values
• tried to find more adjustments strategies for the downhill simplex • realised that implementation will not work
14 March to 21 March
• 16 March: Progress Meeting
21 March to End
• write project report
• evaluate work of fixed strategy agents
2.3 Project intensity
Due to the previously discussed quality problems, the project was not straight-forward like the waterfall model. The project work happened more in loops and a lot of backtracking was needed. Naturally the work intensity grew before the mid-term report, progress meeting and due date of the report. Due to working continuously nearly each week, I could avoid hard working sessions at night and only had particularly stressful times before the crucial dates. As a non-native speaker I had to plan more time for reading and report writing.
2.4 Which problems occurred and how they were solved
In this chapter I focus on the problems which occurred in this project and on how they influenced the progress and the results of the project.
2.4.1 Software technique problems
Simulation software tools are often designed to be used by experts who are familiar with programming and the area of research where the simulation model is designed for. So the model provides a high flexibility for experts but has less facilities which help less experienced users to become familiar with it. The market I chose is an extreme example of such design. It was conceived as a Java version of the common Santa Fe market and was only used to gain data for two papers [Ehrentreich, Norman(2002)and (2005)]. As a result, I spent more time than I expected on understanding the source code.
The main problems were:
• Due to the use of older methods of Java, the program only runs on Java 1.4.2.
Especially the Repast-Framework created a lot of error messages with later Java versions.
versions of Java do not have this problem. This memory problems occurs especially in long simulation runs.
• The reading and understanding of the source code was very difficult because a lot of
values of variables were constantly changed and used, but in the end they had no effect on the model.
• A lot of variables are badly named.
• Due the fact that there was no documentation from a second source,
misunderstandings often were realised very late.
2.4.2 Software evaluation
Firstly, the downhill simplex only returns the two values PdCoeff and Offset for each round. Out of this values the demand of stocks will be computed. [see: 5.1.2]But to understand the generation of these values a lot of special observation techniques are needed. I decided to use GNU Plot to visualise all important points in the coordinate system. I needed to observe a lot of iterations. Due to the adoption [5.3.3.6] of the shape of the downhill simplex a lot of different ranges and sizes of the coordinate systems are generated by the simulation model. GNU Plot is not able to scroll between different plots or manually zoom in to and out of the picture. So all diagrams that show the behaviour of the downhill simplex must be slightly adapted manually, which makes evaluation of the programming very time-consuming. Secondly, I always have to ensure that the behaviour of the downhill simplex was not accidentally good, but rather driven by the real behaviour of the optimisation algorithm. Especially when the program ran and gave proper values I had to step back and analyse the latest changes to ensure real functionality.
3 The artificial stock market model
Artificial stock markets are agent-based simulation models. The first artificial stock market was created by Cohen, Maier, Schwartz and Whitcomb in 1983 [LeBaron, Blake (2002)]. These simulation models allow a bottom-up view on trading behaviour and co-operative acting of agents. Instead of a field visit you can collect a lot more specific data from the whole market and from each market participant and the user can exactly trade on the market he needs. Hence the artificial stock markets can create a linking point between the macro level and the micro level in this field of research. There actually are plenty of different types of
stock markets available. Most of them were designed for different, often very specialised tasks and no market is a completely abstract model of a stock market. [Tesfation, Leigh (2002].
The stock markets are designed as a round- and event-based simulation model. Figure one shows the process of one round of the simulation model.
[Fig1]
In practice it is often difficult to adjust the agents and trading procedure correctly. If the set of agents is too homogeneous the market can easily settle to an equilibrium and if the set of agents is trading too aggressively the market will give very strange price curves. These price curve can have unusually high discrepancies and prices can be very high or near zero. It is also difficult to distinguish between real market effects and market effects that are only effect of these kind of implementation [Tesfation, Leigh (2002].
3.1 Agents
The software agents are the market participants. It is their aim to trade with assets and generate their demand of assets. To compute their demand of stocks for the next round the agents need models which allow them to predict future asset prices. Generally fixed models are used to generate the demand of stocks for the next round based on the forecast asset price. One example is given in 5.1.2. This use of software agents is a classical examples for the use of software agent. General definition of software agents is given in Ciancaring, P Wooldridge, MJ Ch. 1.1. The designer can choose between a lot of different trading strategies and
programming ideas to drive the behaviour of the agent. An overview is given in chapter 3.1.1. The agents often have some attributes which drive their decisions and should create more variety in the set of agents. This is discussed in chapter 3.1.2.
3.1.1 Different types of agents
There is a large variety in the set of agents. At one end of the scale are noise traders with a random forecast value, while at the other end are complex self-learning agents based on generic algorithms or neuronal nets. The agents can be characterized in a two dimensional system. The first dimension describes which optimisation algorithm is used; the second dimension explain the main trading strategy and the aim of the agents.
Very often the more clever agents are driven by a genetic algorithm or different kinds of evolution strategies. The genetic algorithm approach is also used in the Santa Fe market and will be explained in chapter 5.1.1. There are some new approaches of using neuronal nets. [see: LeBaron, B.(2001b):] Agents with these strategies sometimes are called learning agents. Beside the learning agents are a set of more simple agents. These agents trade completely randomly or according to fixed strategies. These agents can be used for bringing noise into the market or as a competitor against the learning agents.
The aim and trading strategy of the agent can be ordered in this list:
1.) Meta strategies or normal trading strategies.
Meta strategy agents decide between different trading strategies. These trading strategies are forecasting the asset prices for the next round. Normal strategy agents have only got one trading strategy (these could be more complex).
2.) Noise traders.
The trading strategies of the noise traders have not the goal to maximize profit. The strategy of using this agent is to create noise in the market by unexpected behaviour of the agents.
3.) Use of a random function.
Some agents use a random function to find new trading strategies or asset prices. The GA based agents use a random function for their mutation of the strategies. A normal
simplex based agent does not use random functions.
4.) Technical Traders.
Technical traders use the history of the market for forecasting future prices or finding a new strategy. Non-technical traders only analyse the actual situation on the market.
5.) Forecasting the behaviour of other agents.
These agents try to forecast the next price by trying to forecast the forecasting value of the other agents.
6.) Different scope of the forecasting
Nearly all agents are myopic and forecast only the price for the next round. But it could be useful to forecast the asset price for more than one round.
3.1.2 What is the best strategy?
The previous chapter shows a lot of different strategies of agents. There is no one best strategy for software agents. It depends on the behaviour of all other agents and the exact market parametrisation which strategy will trade best. So the aim of strategy designer is on one hand to generate a competitive trading agents but on the other hand to design a special strategy. This strategy should be comprehensible and be designed for a special aim.
The competitiveness of an agent can be evaluated if the agent runs against other normally used agents in the market. Another often-used competitor is an agent which generates
completely random numbers. This test needs statistical evaluation to exclude all noises out of the market. Chapter 6 goes into further details of the evaluation problem.
3.1.3 Risk aversion
To prevent the market from easily coming to an equilibrium and to give each agent a more specific behaviour, risk aversions are used. In business the risk aversion is a very common vocabulary to describe how risky a trader is. The trader with a high risk aversion prefers the option with more secure output instead of an insecure higher output (by the same expectancy value). For example a person with a high risk aversion prefers secure output of £50 instead of a gamble with a 50% chance of winning £100 (for low risk aversion or risk friendly vice versa). The value of risk aversion describes the price the person will pay to play the game
with the more secure output.
3.2 Assets
Very often, including the Santa Fe market, the simple approach with two types of assets is used. One asset is a fixed income bond and the other asset is a risky stock. The price of the stock is often set by the demand of all market participants. In some models each asset pays a dividend to its holder. The dividend is often set randomly. A lot models allow the purchase of parts of assets. So the market comes closer to the idea of an ideal market with dividable goods and services, while agents respond to slightly different demands of stocks with different trading behaviour.
3.3 Trading procedure
The trading procedure is the heart of the artificial market and it is not trivial to find a good trading procedure because in nearly all markets the agents have to finish all their decisions before it comes to a negotiation of price.
In the Santa Fe market the pricing of the stock works in the cycle shown in fig. 2:
[Fig2]
The process terminates if the amount of buy and sell orders are the same or if the limit of passes has been reached. The actual limit is set up to ten iterations. The pricing is very simple. If there are more buy orders than sell orders the price increases, or vice versa. Each agent has to make its decision on how many stocks it will buy for each price and has to return it to the trading procedure. If the pricing finds an equilibrium between the amount of stocks to buy and sell the stocks will be traded for that price and superfluous stock will be bought by the trading procedure and lost out of the market. On the other side the trading procedure can sell some extra stocks to satisfy the demand that has not been met. Generally this tool is only used to
reduce price negotiation time and the gap between bought and sold stocks is so small that it has no effect on the market.
4 Find a market for the project
While some stock market models were widely used for a lot of papers, for example the Santa Fe market, some authors designed there own stock market for their particular question, for example in [Ladley and Bullock (2004)]. Before I started my search for an appropriate stock market I defined some requirements for it.
• programmed in an imperative language • the source code should be available for free • run on a Windows or Linux system
• the source code should have some comments in German or English • first focus on the often used markets
• at least one agent should be already implemented
These requirements helped immediately to find a small set of markets, on which I took a closer look to evaluate the quality of the source code. I also wanted to use a market which was more often used, because I expected a higher level of software quality. These simulation models are generally used by a small user group with a high knowledge of the whole system. Hence, the systems will be tested only for their particular purpose. So I expected a lower level of documentation and a source code that looks unfinished.
4.1 The implementation of the Santa Fe market and the choice
First I found the Santa Fe market. It fits to all of my requirements. There are plenty of papers which describe this market model. The market is available in four implementations [SFIASM-Team].
1.) The “original” Santa Fe artificial Stock Market (is written in Objective C) 2.) The Java-Version of these Objective C-Code by Norman Ehrentreich 3.) The Java-Version written by Steve Phelps
4.) The Java-Version written by Jose Manuel Galan Luis R. Izquierdo (documented only in Spanish)
looked very massive and the classes seemed disorganized. I have never used Objective C, so I took a stronger look at number 2. The 10 Java classes looked very similar to the original Objective C code and I found documentation in the source code. For all simulation
functionalities the repast framework is used[Repast-Team] which has the advantage, that they
are programmed on a higher level and have a better documentation.
5 The optimisation algorithm
The aim of the project is to find an agent which is able to trade in this artificial stock market. In the next part of this chapter I will take a look at the actual implemented genetic agent and analyse the technical requirements for a new optimisation algorithm in this market. Then I will take a brief look at possible optimisation techniques and describe the adaptation and improvement of the chosen downhill simplex. In the last sections I will discuss the work of the downhill simplex.
5.1 Requirements for the algorithm
The aim of an optimisation algorithm in an artificial stock market is to make a decision on how many assets to buy in the next round. No human being or computer can really look into the future. All these forecasting processes are based on special models or are guessed. In general for a good forecasting algorithm there are two general requirements.
1.) The forecasting strategy should be competitive against other traders in the market. 2.) The forecasting strategy should based on a describable model. The word model is used
here as a very wide word. Even a random selection of numbers is a forecasting
strategy as well, but these strategies should be comprehensible and describable. These requirements should allow us to evaluate several forecasting strategies.
5.1.1 Analysing the genetic algorithm
The genetic algorithm is the most used strategy to drive the behaviour of agents in artificial stock markets.[LeBaron,Blake (2002)] This algorithm is also implemented in the Santa Fe
market. In the discussion about genetic algorithms the authors often speak about “learning”. [for instance: LeBaron,Blake (1999)]. Learning means that the genes of each agent represent the
the genetic algorithm. The design of the gene is the first crucial design question in designing a genetic algorithm. This decision is driven by the different trading procedures and desired behaviour of the agent.
In the Santa Fe market each agent contains a set of 100 genes. Trading rules are part of the genes of the genetic algorithms. For the genetic algorithms each agents acts individual. Each gene contains a condition part, a forecast part, its fitness value, and its forecast accuracy. The forecasting accuracy is the weighted variance of the performance during the last rounds of the gene. The fitness value stores the actual fitness value of these genes. The forecasting part contains the values PdCoeff and Offset. The condition part describes in which market situation the trading rule will be used [Ehrentreich, Norman(2002)]. Very often more then one
trading rule is in the set of the allowed rules.
The set of genes are optimised in a normal genetic algorithm [See for example: Mitchell, M., (1996)].
[Fig3]
This process is the GA process, which is used in the artificial stock market. The circle starts with a random set of genes, which are benchmarked by the fitness function. The GA process has a lot of parameters or options which can be used to drive the optimisation process. I will give a brief introduction about the main ones for this problem and show how they are set in the Santa Fe market. The parameterisation of the GA is one field of research in artificial stock markets. So there is a big variety of possible parameterisations. [LeBaron,Blake (1999)].
Fitness-function: The fitness-function judges each gene by the forecasting value of the last round and by the fitness of the condition part. The fitness function uses the forecasting quality of these genes for the actual round and the use of technical functions to judge the gene.
Replace the genes: the number of replaced genes is one driver for the learning speed of the agents. The more genes are replaced, the higher the learning speed will become. In this implementation, 20 out of 100 genes will be replaced.
Mutation: “The mutation could be interpreted as learning by experiment or by unintended mistakes.” [Ehrentreich, Norman(2002)] The mutation will have some some random changes of
its strategy, and any changes of the main forecast values PdCoeff and Offset will be taken into account.
There are several strategies to compute the main forecasting values out of the set of Genes. The best gene can be chosen, or an average of a number of genes, which are selected by a specific criterion.[See: Ehrentreich, Norman(2002) p. 5] For my work I take the average value of
all genes. That avoids extreme forecasting values and engenders a more moderate trading strategy.
5.1.2 The optimisation problem and communication with the
market maker
The expected (E) price for the stock and the dividend at the time point t+1 is defined as a linear function of the price (p) and the dividend (d) of the actual round (time point t).
The aim of an optimisation algorithm is to find values for the variables PdCoeff and Offset. The numbers of stocks to own (x) is computed by this formula. The amount of stocks to buy or to sell is the difference between x and the actual owned stock of the agent.
[Ehrentreich, Norman(2002)]
(1)
Where: p: Price of Stock; d: dividend of stock; λ: Risk aversion of agent;σ2variance of the
the forecasting quality of this agent of the previous rounds. The part of the formula (1+rf)p
describes the alternative investment into the fixed income bond. Here rf is the rate of interest.
In the actual model the interest is 10%.
In the actual implementation, the variance of forecasting from the previous rounds is computed with the formula.
A = 1-b and b = 1/75. With the setting of the value b the designer can define the scope of influence of the forecasting quality of the last round on the variance. Actually the value for b and the influence is small. If an agent has got a small variance, then it relies more on its forecasting quality and will buy more stocks than if it has a great variance.
To find the right stock price, the trading procedure gives a trial stock price to formula 2. Each agent returns their demand of stocks for that trial stock price to the market maker. The
demand is computed by formula 2. Then the trading procedure decides to increase or decrease the price of the stocks for the next trial round. Agents cannot change the PdCoeff and Offset values during the price finding period. The price setting function terminates after a fixed number of rounds (currently set to 20), or if the buy and sell orders are equal.
Hence there are two requirements for the optimisation algorithm to find good values for the variables PdCoeff and Offset.
1) Forecast the asset price for the next round
2) The forecast value should be able to interact with the market maker.
A lot of combinations of PdCoeff and Offset can satisfy the first requirements, but the second requirement makes the allowed range for both values smaller.
[Figure 4]
The graph in figure 5 shows all possible combinations of PdCoeff and Offset which satisfy the first constraint. But only a small range of Offset and PdCoeff satisfy the second constraint and give a good market effect.
5.2 Choose of a optimisation algorithm
As written in the minimum requirements, the chosen optimisation techniques should be different to any mutation selection processes, genetic algorithms or other evolutionary based approaches. The idea to work with a set of genes is essentially part of all these strategies. Only the generating, judging and erasing processes differ between all these strategies. The selected algorithm should be implementable in a appropriate amount of time. In no paper I read that the behaviour of more intelligent agents is driven numerically. Numerical based optimisation algorithms try to find an extreme point of a function.
The geometrical approach allows an intuitive feeling of problem solving and provides a lot of adjustment and tuning possibilities. The main task in using a numerical based optimisation techniques is to find a model which satisfies the requirements of the artificial stock market and generates competitive forecasting values, and to find out which of the available numerically based optimisation techniques is a technique which can be adapted to the problem.
All these numerical based optimisation techniques are generally designed to solve offline optimisation problems. That means that an algorithm gets a fixed function and should find the best function value in a certain amount of time. This forecasting problem is different to that
pdCoeff
of
fs
method. Here the design of the function changes very frequently, so the chosen optimisation algorithm should be adaptable so that it can solve this forecasting problem.
After adaptation of the algorithm, the main optimisation strategy should be found and be used as a main part of the forecasting strategy. If the main strategy is adapted out of the
optimisation algorithm, then it is a design of a completely new optimisation algorithm and not aim of the project.
5.2.1 Numerical based algorithms
Numerically based optimisation algorithms are used to find extreme points of functions without knowing the derivation of them. This technique is mainly used for functions with plenty of parameters which makes derivation impossible. Nearly all these optimisation techniques can be modelled in an n-dimensional coordinate plane. Each point of the solution space describes one available parameterisation for the function. So often, these optimisation techniques are understood as a search algorithm in the solution space, so the process in all of these optimisation algorithms are very similar. The algorithms choose a point of the solution space, look for its function value and find the next point. The strategy for finding the next point is different in each optimisation algorithm.
Beside a real describable function other things for judging each point of the solution space are possible. One example is a computer based simulation model with plenty of parameters.1 The
results of each parametrised simulation run is then used to judge each point of the solution space. So the optimisation function can be used to find the best parameterisation for this simulation model.
A look into the book “Numerical recipes” [Press, William H.(2002)] offers a big bunch of
possible optimisation algorithms. Based on the optimisation problem there are some optimisation methods which cannot be well adapted to be used for my aim. First the optimisation strategy should be able to optimise a function with at least two parameters (PdCoeff and Offset).
In several optimisation algorithms the derivative, for example the Gradient Method[Press, William H.(2002) p.317] is used. The derivative gives a hint into which direction or how far away
the optimisation algorithm should try to find the next possible value. For that strategy there are no equivalent in the artificial stock market forecasting problem and none of these
strategies can be used.
Also strategies which mainly perform a random selection of the next point cannot be used as well (For example: Simulated Annealing[Press, William H.(2002)S.343]). These methods are not a
good starting point to design a stock forecasting algorithm. The power of these methods is often the judgement function and strategies that show their power when plenty of iterations will be done, but if the problem changes every iteration this strategy cannot show its advantages.
Out of this requirement and concern I decided to use and adapt a downhill simplex.
5.3 Downhill Simplex
The downhill simplex is a numerical based optimisation technique. It can be used to find the minimum or a maximum of a function.[Press, William H.(2002) p. 306] Because on its graphical representation and its very robust ground algorithm it is very flexible to use. The ground algorithm can be retained by the adaptation. In the following part of this chapter I will describe the basic work of the simplex, adapting it to this problem and ideas to improve its work.
5.3.1 How does the simplex works
The downhill simplex is due to Nelder and Mead. It is a geometrical approach for finding the minimum or maximum of a function with n parameters. Therefore it can be used in
N-dimensional solution space and equilateral N+1-N-dimensional polyhedron.
[Fig5]
optimisation process starts with a random set of the starting points of the triangle. Each
starting point returns a value of the function. In figure four it is pictured in the third dimension as level curves. When all starting points are set, the algorithm chooses the value with the worst function value. To find a new location this point will be point reflected by the middle point of the polyhedron (or line by a triangle), which is created by all non-chosen points. Then the function value of this location will be computed. In the next iteration, the method selects again the point with the worst function value and so on.
To give this method more flexibility a lot of step reduction and enlargement techniques are developed. I take a look on it in 5.3.3.3 and 5.3.3.4.
5.3.2 Main idea of the downhill simplex and its power as a
forecasting algorithm
A really good price forecasting strategy which is in every case better then all other strategies can only be found if humankind can find a way to predict the future, so the focus of creating the trading agent is just to create a good trading agent. But it is also interesting to understand their trading strategies and behaviour. [see 3.1.1 and 3.1.2]
The downhill simplex is an algorithm which started with a big polyhedron and this polyhedron will be reduced during the optimisation time to find a (local) optimum of a function. For the forecasting strategy I will use the idea of storing a small amount of knowledge about solution space in the shape of the triangle. The knowledge is stored in the function value of each point. The downhill simplex tries to improve its position by resetting the point with worst function value. For finding this new position it uses the location of the two other points, so the two points which gave the best results will not be visited again, and the new point lies a edge length of the polyhedron away from the best points.
So I predict that the downhill simplex will be a very uneven trader on market effects. Its forecasting strategy will be spread widely and it can set a market into a stronger oscillation. Also the geometrical approach allows easy implementation of adaptation and tuning ideas. The representation of only a small amount of knowledge (here the location of two good forecasting values) has never been tried before.
The step length of the simplex is the distance between the old and the new location of one point of the simplex triangle. The length of a step is one of the main drivers of the forecasting quality. A wide step represents a greater changes of the values PdCoeff and Offset and vice
versa. The exact change depends on the direction of the step.
5.3.3 Adapting the problem to the downhill simplex
The aim of each optimisation algorithm in this artificial stock market is to find values for PdCoeff and Offset. Hence the downhill simplex needs to run as a triangle in a two
dimensional coordinate system. For further explanation the x-axis of the coordinate system is set for the value PdCoeff and the Y-axis is set for the value Offset. Each point of the triangle represents one combination of values for the variable PdCoeff and Offset. The three vertices of the triangle are named in the following as A,B,C. The return value of the function is the forecasting quality of this point.
The downhill simplex was designed to solve mainly line optimisation problems. An off-line optimisation problem is that the function and the optimal solution never changed during the optimisation period. In the problem of an artificial stock market the best combination of PdCoeff and Offset changes in each round. So the simplex needs other, more problem specific, techniques to find a good next step. Specifically the step-reduction techniques [for example Press, William H.(2002) p. 307] needed to be changed and adapted. But by all this adaptation and tuning the triangle as main idea of the optimisation process should be retained. The simplex runs as a round based optimisation algorithm. For the adaptation to the asset price forecasting problem each iteration (round) of the simplex algorithm returns a new forecasting value. It could be possible to run more then one iteration to generate one new forecasting value. But then a function is needed to choose a result out of the iterations. The system knowledge is only knowledge about past simulation runs and the real prediction about the future should be taken out of the simplex triangle. This function needed to be design up from scratch and does not has anything in common with the basic idea of the downhill simplex. I think that the downhill simplex should only be adapted if it is useful. In the sub parts of this chapter I will discuss all changes that are needed to use this optimisation procedure in the Santa Fe market.
5.3.3.1 Initialisation phase
Simplex can be initialised with three randomly chosen points as well as the normal simplex. But in this area the shape of the triangle is very important and drives the behaviour of the agent immediately. So it is appropriate to set the third point of the triangle in a non-random
fashion. It is the best way to set the third point of the triangle not randomly to greater a special shape of the triangle. So the designer has a parameter to drive the behaviour of the triangle. In an equilateral triangle each step in each direction using the normal step techniques has the same length. Later on this technique can be used to create other shapes of triangle. By
creating these third point scale translation [see 5.3.3.6] must be concerned. The triangle must be in the shape if the triangle is in the mute to move.
5.3.3.2 Swing in time
Eespecially the first optimisation values of the downhill simplex after the initialisation are very inaccurate. Often the algorithm predicts negative or unbelievably high prices and the simplex needs a lot of integration to juggle to good forecasting values. This problem is based on the fact that the triangle starts often with a big shape. It could be possible to start the simplex algorithm with a very small shape and to inflate it later with the step enlargement technique, but it is challenging to find a good step enlargement technique to avoid that the simplex enlarges the step length too fast and generates a big triangle again or the simplex is set for a long time on one small area of the solution space.
In both strategies only systems knowledge which gives the ability to predict a good triangle shape at the beginning, which is similar to the triangle that will be generated after the swing in time can reduce the swing in time. However in this simulation model every simulation run is different and influenced by the behaviour of all agents. So only rough guesses about the shape of the triangle are possible and both starting strategies need, with smaller or greater triangle, an experiment to see which strategy could be more practicable for the problem.
5.3.3.3 Step reduction
The step length of the simplex controls the quality of the changes for the values PdCoeff and Offset. A long step changes the values more then a short step. The step reduction and
enlargement should not change the shape of the triangle. If a change of the shape of the triangle is wished, then it should be done independently from the decision of changing the step length and vice versa.
In the “normal” use of the downhill simplex the step reduction will be done if one point in the coordinate system is used twice [Press, William H.(2002) p. 307]. Step enlargement is only be used if the simplex has “found” a local optimum and the simplex should move to next
that “optimisation process” never ends and aim of the algorithm is not to find exactly the local optimum. So a completely new strategy is needed to detect whether a step enlargement or reduction is needed.
For the price forecasting model a new technique is needed to identify situations where a step reduction or enlargement is appropriated. For a better localisation a straight line is drawn through the coordinate system. This straight line shows all possible combination of PdCoeff and Offset which forecast the right stock price for the actual round. This straight line can be define by the function:
Pricet stands for stock price of the actual round and Pricet-1 represents the price for the
previous round. By the design of this function is the fact ignored that PdCoeff and Offset forecast the combination of Price and dividend [see: Ch. 5.1.2]. This relaxes the calculation of the function. The inexactness is not so dramatic because that only the graphical relation between the simplex triangle and the straight line is used.
[Figure6]
Now we can see how far each vertex of the triangle is away from the optimal combination and Offset. When the line cuts the triangle every move of each vertex would bring the triangle further away from the optimal position of PdCoeff and Offset (see fig.6). So a reduced step towards the optimal line would bring the next vertices nearer towards the straight line. If the
pdCoeff of fs et A B C (5)
straight line does not cut the the triangle a normal step towards the line will be automatically done by the triangle and a step reduction is only needed if the triangle is cut by the line.
Move the vertex the reduce step
The first step is to select the vertex with the worst forecasting value. To retain the shape of the triangle a second vertex is needed. If only one point of a triangle is moved all angles in the triangle will change. This vertex will be chosen randomly. With more system knowledge and experience it could be possible to find a more intelligent way to choose the second vertex. Both vertices now move on the edges towards the third vertex.[See Figure 6]
[Figure 7]
The points A' and B' show the moved positions of the chosen points A and B. To retain the shape both points must move relatively to their actual distance to fix point of the triangle, closer to it. A random number decides about the new size of the triangle. The range for the random number is between 0.1 and 0.9. As distribution for the random number is actually a normal distribution implemented. This random number is multiplied with the actual distance between the fix points and the moving points to compute the new distance between them. The new location for the vertex with the previously worst forecasting value will be returned as the new forecasting value.
5.3.3.4 Step enlargement
Step enlargement is appropriate if the simplex triangle is far away from the the straight line, which represented the optimal combination of PdCoeff and Offset. There are two models in
pdCoeff of fs et A B C B' A'
the optimisation problem:
1. If the distance between downhill simplex and straight line is greater then a specific level, then a step enlargement is appropriate.
2. If the downhill simplex has not been cut by the straight line for number of iteration a step enlargement is appropriate.
In both cases the fixed number of iterations or the distance needed to be found. It is also possible to replace this fixed number by a random number. For instance this random number can be generated by a normal distribution. That would bring more randomness into the optimisation procedure.
I decided to implement the second idea. Due to the adoption in 5.3.3.3 this idea is easier to implement and a definition for the distance between the point and the line is not needed. Later on the other idea could be implemented as well for further evaluations if the algorithm is stable.
The step enlargement works in a very similar way to the step reduction. The aim is here to retain the shape of the triangle. First I have to find out which point has got the best forecasting value (B in fig. 7). Then a randomly chosen point for the second other vertices of the triangle which is needed to be moved to retain the shape (A in fig. 7) is needed. Analogous to the step reduction the step enlargement procedure moves both points away from the fixed one. In figure 7 the two new points are named as A' and B'.
[Figure 8]
The step length of the enlargement will be set randomly by a normal distribution analogous to pdCoeff of fs et A B C B' A'
5.3.3.3. The range for the random number is between 0.1 and 0.9. This random number is multiplied with the actual distance between the fixed points and the moving points and added to the actual distance between them to compute the new distance between them.
5.3.3.5 How to define the forecasting quality of this point
In the normal use of the downhill simplex the quality of a point will be defined by the result of the function which is set with the parameters of this point. In this model the parameters are the two variables PdCoeff and Offset. But the definition of the function is not so easy. This function should judge the quality of the two main tasks of its two parameters:
1) Forecast the asset price for the next round
2) The forecast value should generate a good pricing development function for the price setting.
The first constraint can be satisfied by the function.
The function f describes the deviation of the forecasting values from the market price. I do not include the second constraint into the formula. There is no sufficient way to do it. I tried to penalty unusual and extreme combinations of PdCoeff and Offset, which lead to a very extreme price negotiation function. But I was unable to find a appropriate penalty function to describe this. Because of other problems, I think that this approach does not solve the problem at all. The judgement function only comes into action, if the point is already set and the
combination PdCoeff and Offset value of the point is given to the market maker. This point is also part of the discussion why this optimisation technique does not work. [See: 5.3.5.3]
5.3.3.6 Adapt the shape of the triangle to the solution
A very crucial design task is to find a problem adequate scale for both axes of the solution space. In this model PdCoeff has a higher influence on the forecasting price than Offset. The influence on the new price is driven by the price of the actual round and the effect of Offset is independent.
(6)
Due to the geometrical approach the downhill simplex does not distinguish between steps in different directions. But in this model a step into the PdCoeff direction has a dramatically higher effect on the forecasting price then a step into the Offset direction. A way is needed to nearly equate the effects on steps into both directions.
I decided to expand the PdCoeff-axis by multiplying each PdCoeff value with the actual stock price before the simplex will do its step. When the step is done I will undo these
transformation and read out the new values of PdCoeff and Offset. The straight lines for detecting the need of a step reduction or enlargements needed to be transformed as well. All X-Values of the triangle will be multiplied with the actual stock price and the dividend. This operation enlarges the distance between all points of the triangle.
The points a,b,c are described by their PdCoeff and Offset value.
The function needed to be adapt as well. Both values in this function are stock prices and are greater 0. Hence function has always the same layout in the first quadrant (shown in fig.8).
[Figure 9]
To find out which transformations on the straight line are needed I take two random points out of the straight line. The random points are named a and b, and the PdCoeff part of the points is now transformed by multiplying with stock price and divided. Later on I can generate a new
pdCoeff
of
fset
line out of this moved point and can compare it with the normal line to find out the effect of the scale translation on the line.
The following formula generates a new straight line Offset = a*PdCoeff + b. Therefore the normal formulas for creating a straight line between to points is used.
Then put stock price and dividend in front of the “brackets”.
For the b part the first quotient is one. If two random and untranslated points of the
untranslated straight line are used then the following formula for a and b will be generated:
The comparison between these formula shows that a movement of the points only has only an influence on the slope of the line. The formulas for the b-part is the same. The influence on the slope of the line is the factor
(9)
(10)
(11)
This difference of the slope can now be imported to the straight line to generate the translated line.
The following diagram shows the changes graphically.
(before) (after)
[Diagram 10]
When the simplex has done the step, all transformations need to be undone to read out the values. Therefore the translation of the triangle must be undone. The straight line is not needed any more and needs not to be re-translated.
Finding the next point for the simplex needs a lot of calculation (mirroring,distance measuring and so on). All these calculations must retain the consistency of the triangle, so that it can be re-transformed. Due the geometrical approach of the downhill simplex and its way to find a new location for the vertices, the scale changes is effected less.
The transformations change the shape of the triangle. As discussed in 5.3.1 the shape of the triangle is one of the main drivers of the behaviour of the downhill simplex. The second transformation which reshapes the triangle in each iteration also should be considered by the initialisation of the triangle. That reshaping of the triangle stretches and compresses the triangle. So the shape of the triangle is dramatically influenced by the actual stock price. However the shape of the triangle is the main characteristic of the optimisation method. This
pdCoeff of fs et A C B pdCoeff of fs et A C B (13) (14)
problem is discussed in 5.3.5.3.
5.3.4 Tuning ideas
Because of the easy ground algorithm the downhill simplex algorithm allows to implement a lot of problem-specific improvements. The following tuning ideas try to include more system knowledge or bring more noise into the procedure, reduce the adjustment procedure at the start of the algorithm or drive other behaviour. Due to the problems with the ground algorithm I was unable to evaluate the effects of the tuning ideas. Unlike the adoption the tuning ideas are more small adjustments which can improve the performance or change the behaviour of the algorithm. Due to the short project time I focused on easy to implement tuning ideas. There are possibly better ideas which put more system knowledge into the algorithm.
Reduction of starting rounds
In the normal implementation the simplex uses the first three rounds to set randomly its first three starting points. The fourth round is the round where the real process started. It is possible to reduce the starting rounds and set all three points in the first simplex round as well. The actual implementation allows judgement of all three points. The process can randomly choose one point which will be returned as the value for the first round.
Updating the value of the vertex of the triangle each round
Normally, the downhill simplex only actualises the forecasting value of the moved point; the other results are stored at the last move of the point. The forecasting value of each round can be updated after each round. So the point which has got the worst forecasting value will always be moved.
Rotation the triangle
A random turn of the triangle between some optimisation steps put more randomness into the algorithm. The function value of each point can be calculated as in 5.4.3.3.
Shape of the triangle
Different shapes of the triangle can generate different effects of the optimisation algorithms. It could be interesting to see what happened if one point is far away form the other ones
compared to the equilateral triangle. To create a flat triangle could be interesting as well. A random or strategy based change of the shape during different trials could be interesting compared to fixed shapes.
5.3.5 Problem with the Simplex
The actual implementation of the downhill simplex does not communicate correctly with the price adjustment function. There are some problems which in combination with the aggressive forecasting strategy of the downhill simplex makes it nearly impossible to create a good market effect. In this chapter I present the main problems of this implementation and discuss why it does not make sense to adjust and tune the simplex so that it fits to the model.
5.3.5.1 The price adjustment function
The price adjustment function is very fragile. Even one agent which randomly generates forecasting values out of the range can generate extreme market prices. Extreme market prices mean that the algorithm wants to set a negative price for the stock or the stock prices
increased more then 100% of the actual price. The market maker cannot deal with negative values of PdCoeff and Offset, which describe a very radical trading strategy. Actually the the ranges are for PdCoeff [0.7,1.2 ] and for Offset [-10;19]. These values were set in the source code of the stock market as ranges for the genetic algorithm. These ranges are implemented in each gene of the agent. Due the fact that the market maker actually uses the average value of a set of values the values for PdCoeff and Offset are mainly located in the middle of the ranges. Even in this configuration the market sometimes produces extremes prices. Due the
complexity of the model and the involved randomness it takes a lot of time to understand the behaviour of the price setting function.
5.3.5.2 Prohibit the simplex to run out of range
A borderline in the solution space would prohibit that the downhill simplex juggles not out of the range of PdCoeff and Offset. In the actual implementation the range for PdCoeff is [0.7,1.2 ] and for Offset is [-10;19]. That could lead to the effect that the optimisation algorithm can better deal with the price adjustment function. If I implement this borderline the possible solution space for the downhill simplex gets very small. The simplex runs often against the borderline. Then a lot of unusual work on the downhill simplex needs to be done to readjust the shape of the triangle.
Instead of the borderline it could be possible to implement to penalise the value for PdCoeff and Offset in the judgement function if they are out of the range. This is a soft way to push the triangle back into the allowed solution space. But the market making procedure is so weak that often the whole market crashes if one agent generates values out of that space.
5.3.5.3 What is left of the main idea of the downhill simplex?
The downhill simplex was designed to quickly find the optima of a function. In that area this techniques wanted to be used to predict stock prices. These two task are very different. So a lot of adjustments and changing on the algorithm are needed to teach the optimisation technique to predict stock prices. By all this changes and adjustments the ground algorithm and the main idea of the downhill simplex should never been forgotten . The main ideas are the shape of the triangle and the judgement-function as indicator for the wealth of a point. All of the following adjustment functions waters down the main idea of the downhill simplex:
• Implementation of a borderline see: 5.3.5.2 • changing shape of the triangle see: 5.3.3.6. • inexact judgement function see 5.1.2
Also a problem is that I was unable to find a mathematical model which allows to model a good price negotiation function for the price adjustments. This problem cannot be tackled by optimisation strategy and the function which describes the forecasting quality alone.
All these adjustments techniques and unfitted model are changing the behaviour of the simplex dramatically and influence each step of the downhill simplex. The behaviour of the downhill simplex is not natural in nearly every step it takes. If the behaviour of the simplex is even only driven by restriction and adjustments , then it is better to create a algorithm which randomly guesses forecasting values or to restart to implement a new strategy from scratch or with an other strategy.
5.4 General concerns of usage of numerical optimisation
strategies
The downhill simplex is an instance of a lot of numerical based optimisation strategies. [Referenz] A lot of adaptations need to be done as well as done here if any other numerically based optimisation strategy should be used to design an trading agent for artificial stock markets. Numerically based optimisation algorithms search numerically for extreme points of functions.[see: 5.2.1]
The main difference in these optimisation algorithms is the strategy by which they navigate in the solution space. [see 5.2.1] So a optimisation algorithm should be selected which strategy can be adapted to design stock prices. In the normal use of optimisation algorithm the
function which needs to be optimised by calling with several parameters is given by the problem. I did not find a good function which give the optimisation algorithm a good orientating. This was one of the main problems why the downhill simplex did not run. All orientating for finding a good solution that is not given by the judgement function must be given by the inherent behaviour of the selected strategy. So all the descriptions about the problem what cannot be transformed into the judgement function must be set into the strategy. By all these adjustments on the strategy the main idea of the strategy should be retained. The second problem is the adaptation of the iteration steps. In the normal use the numerically based optimisation uses plenty of steps to find one (the best) value. So the performance of a strategy is mainly measured by at least one value. If each iteration step of the optimisation algorithm is used to generate one forecasting value techniques with the use of penalty function does not work [See: 5.3.5.2]. Also the optimisation algorithm should ensure a minimum level of quality of each value. If more then one iteration steps will be used strategy must be found to integrate a driver into the main strategy. Guidance to judge the different simulation runs in one interval which generates one forecasting value must be found. Generally this guidance cannot be inherent in the numerically optimisation strategy. So a adaptation of the strategy in this point is needed.
As with the downhill simplex, a lot of numerically based optimisation algorithms are deterministic, so the the agents with the same initialisation values predict always the same stock price. That allows on one hand prediction about the performance of the agents based on their initialisation values, but on the other hand there is only a small level of coincidence in the market. So sometimes random events on the whole market or on several agents must be used to get a more unpredictable market.
Numerically based optimisation algorithms are not designed to predict stock prices. So not every strategy is able to predict stock prices and the whether the prices follow any system. If the generated stock prices are completely without any system, then a normal random number generator can do the same job as well, so the requirements for finding an appropriated
strategy are very hard. The strategy should be able to generate interesting stock prices and the strategy should be resistance against all adaptation that must be done.
5.5 Result and resume of the implementation
problems occurred during the implementation period. With a more precise
pre-implementation work more problems might have been recognized earlier. Eventually the project would not lead to an implementation of the downhill simplex. But with the
implementation there will be no doubt left. The work is not completely useless. It is shown that it is not successful to drive the behaviour of the artificial stock market agents with a downhill simplex. It demonstrates the problems of forecasting asset prices with other numerically based strategies.
6 Evaluation of single strategy agents
Normally this chapter should be written about the evaluation of the new designed optimisation algorithm. Due to the fact that the developed optimisation algorithm is unable to run in this stock market environment and caused by its inexact forecasting quality it is not possible to run any trials with the downhill simplex.
During the implementation period of the downhill simplex I ran some trials with fixed strategy agents. Especially in competition with the genetic algorithm agents I discovered some interesting effects on the market. So I decided to put the second focus of my project on the evaluation of these fixed strategy agents.
In this chapter I give a brief overview of fixed strategy agents and the evaluation of artificial stock markets. Then I introduce my aim of analysis and its related model. At least I document the trials and present and discuss their results.
6.1 Aim of the analysis
I focus on the behaviour of the fixed strategy agents. I want to show a relation between the forecasting strategy and its success in the market. I presume that a high value of PdCoeff and Offset and hence the forecasting of a higher stock price is more successful then the prediction of lower prices.
6.2 Fixed strategy agents
Fixed strategy agents retain one fixed value of PdCoeff and Offset for the whole simulation run. Hence, these agents have absolutely no intelligence which drives their behaviour, and they stick with the randomly given decision of the beginning. Because of the design of the
function generating the demand of stocks for the next round out of PdCoeff and Offset [See: 5.12] the demand of stocks changes if the stock price has changed. The selected range for PdCoeff and Offset is same range as for the genetic algorithm. The ranges are for PdCoeff [0.7,1.2 ] and for Offset [-10;19].
Which influence has the risk aversion in formula 2 in 5.12 to fixed strategy agents? The risk aversion is an attribute of an agent which is set at the initialisation of the agent. [See: 3.1.3] A high risk aversion reduces the amount of stocks to buy and vice versa. Some transformations of formula 2 displayed in formula 14 show the influence of the risk aversion on the values PdCoeff and Offset:
The risk aversion influences the fixed expression (PdCoeff-(1+rf) and the PdCoeff value in the
third part whereas rf is a constant value for the whole simulation system and for the following
simulation runs set to 0.1.
These two influences cannot be matched together to make the risk aversion unnecessary. Different risk aversions cannot be modelled in different values for PdCoeff and Offset. The variance of fixed strategy agents can be understood as well as for the other agents [see 5.1.2]. Later on in this chapter some trials are run to show the effect of variance on the trading behaviour of the agents.
Beside the different attributes in PdCoeff and Offset the fixed strategy agents can be different in their risk aversion and in their use of variance. The fixed strategy agents can be divided into three groups due to their forecast asset price. First, the optimistic agents, which have general a positive values of pdCoeff and Offset, forecast a higher stock price for the next round. Second, the pessimistic agents, which predict general negative values for pdCoeff and Offset, forecast a lower stock price for the next round. Third, a small group of agents which can predict a positive or negative development of the stock price based on the actual stock price. This group is called undecided agents. Usually these agents buy and sell only a very
small amount of stocks. This behaviour of the agent can sometimes be caused by rounding differences.
6.3 Configuration of the market
Artificial stock markets are very flexible and provide a lot of parameters. In this chapter I give a brief overview about the main parameters, give a taste about about their effect on the market and how it is configured. Chapter 3 provides an overview about the work of artificial stock markets.
Assets
This market trades with two types of assets; fixed income bond and risky stock. All money of the agents which is not invested in stocks will be invested in bonds. All assets are dividable. The asset price ranges between 0 and 200. In a well adjusted market the price never runs out of this range. If it nevertheless happens the market should be readjusted or bug tracked. Due to the complexity of the market and the weak market maker the borderline allows the market getting into a stable mode again.
Other agents in the market
Beside the fixed strategy agent a genetic algorithm agent is implemented in the market. This agent will be used as a competitor for the simulation runs. The parameterisation of the genetic algorithm agents is shown in 5.1.1. A r