An Agent-Based Model for a Double Auction with Convex Incentives

We studied the influence of convex incentives, e.g. option-like compensations, on the behavior of financial markets. Such incentives, usually o ered to portfolio managers, have been o en considered a potential source of market instability. We built an agent-basedmodel of a double-auctionmarket where some of the agents are endowed with convex contracts. We show that these contracts encourage traders to buy more aggressively, increasing total demand andmarket prices. Our analysis suggests that financial markets with many managers with convex contracts are more likely to be more unstable and less e icient.


Introduction
. Portfolio managers may be induced to take too risky positions by incentives that are convex functions of the final wealth, because losses do not a ect their compensations as much as gains. Because of this feature, Rajan ( ) argued that convex incentive structures can be listed among the causes of instability in highly developed financial markets. Convex incentives have been the subject of several papers who analyzed their connection to the financial crisis of -(see e.g., Bebchuk & Spamann ; Dewatripont et al. ; French et al. ; Gennaioli et al. ). .
Assessing the impact of convex incentives on financial markets is challenging from an empirical point of view because of the di iculty in finding the necessary data. An alternative is to examine experimental evidence, as in Holmen et al. ( ), who found that convex incentives lead to higher market prices. Fabretti et al. ( ) proposed an Agent Based Model (ABM) to examine the laboratory experiments by Holmen et al. ( ) and provided evidence that convex incentives may have a positive e ect on prices, and a negative one on the overall liquidity of the market. This paper extends the analysis of Fabretti et al. ( ) by examining a longer trading period to study the convergence of market prices in the long run, the implications of agents risk preferences on the submissions of limit and market orders, the e ect on the market due to the presence of noise traders and the allocative e iciency of a double auction market in the presence of a convex compensation structure. .
We propose a model with artificial agents who may be either rational or irrational. Rational agents make their decisions by maximizing their expected utility, considering their current portfolio, the distribution of the dividend, and the structure of their compensation. We study two compensation structures, the linear one, where the payo is equal to the final wealth, as it is the case when an agent invests his/her own money, and the convex one, where the payo is determined by an excess return without sharing of the losses . Irrational agents are noise traders who do not maximize any utility function but take their decisions randomly. In our setting convex compensation structure are option-like. The market is organized through a double auction mechanism where traders post their buy or sell orders on the order book or execute their market orders. .
We study how risk aversions and compensation schemes of the rational agents, interacting with the actions of noise traders, influence the dynamics of the prices, of the order book and of the overall market liquidity. Moreover, we measure the e iciency of the market, defined by its capacity to reach an equilibrium where the expectations of the rational agents are satisfied, and the final distribution of the wealth among market participants.
. We find that convex compensation structures increase prices, spreads and market volatility but that they decrease trading volumes, which is in line with the predictions of many theoretical models, e.g. Allen & Gorton ( ), Malamud & Petrov ( ) and Sotes-Paladino & Zapatero ( ). We observe that the correlation of final wealth and risk aversion decreases when agents are endowed with a convex contract, because convex incentives increase agents' risk appetite. This extends the results of Fabretti et al. ( ) who studied a similar setting, but over a shorter time horizon and without noise traders. The total wealth tend to be transferred from the noise traders to the rational ones, an observation that is in agreement to what predicted by Sandroni ( ) and that contributes to the literature on the e ects of noise traders in financial markets, originated by the seminal papers by Long et al. ( ) and Blume & Easley ( ).
. As regard to market e iciency, we see that our artificial market is almost immediately allocative e icient when there are only linear contracts, while it takes longer to reach equilibrium when there are convex contracts. This is in line with Gode & Sunder ( ), who showed that double auctions are allocative e icient market protocol. However, as found out by LiCalzi & Pellizzari ( ), the key assumption for allocative e iciency is the "resampling" mechanism. In Gode & Sunder ( ) this mechanism consists in deleting no executed orders a er each trade so that all inactive (no having exchanged yet) agents have a new chance to trade; similarly in our setting at any trading period t, when any agent is called to act, any previous book order by him/her is cancelled and he/she can post a new one. As claimed by LiCalzi & Pellizzari ( ), this mechanism "expands the opportunities for trades as well as the pool of potential counterparts", which improves the allocative e iciency.
. The analysis of market and limit orders shows that convex compensation structures a ect the type of the orders, but not their quantities. In fact, we observe that, by increasing the percentage of convex contracts, the number of limit orders decreases while the number of market orders increases. In line with the fact that convex contracts lead to an overvaluation of the asset, we observe that the majority of the limit orders is on the sell side, while most market orders come from the buy side.
. The rest of the paper is organized as follows: Section introduces the model, Section reports our simulations with results while Section presents some conclusions. In appendix some details about the analytical study of the agent maximization problem and equilibrium price are reported, although they can be found in Fabretti et al. ( ).

The Model
. We implement a double auction market with an open order book in which artificially intelligent agents trade on a single security. The security pays, at a future time T , a dividend X that is a random variable defined as X = X 1 with probability p X 2 with probability 1 − p , ( ) where X 1 and X 2 are greater than or equal to zero. Shorting assets and borrowing money are not allowed. Each trading period consists of T trading times in which each trader, randomly selected, can submit a market or a limit orders. We refer to Fabretti et al. ( ) for more details and motivations about this setting.

The agents
.
We assume that there are N agents trading the asset and that i-th agent is provided, at the initial time 0, with an amount of cash C i,0 and ω i,0 shares of the asset. An agent can be either a noise or a rational trader. Rational traders take their decisions by maximizing their expected utility at time T . Rational agents have a Constant Relative Risk Aversion (CRRA) utility function where γ i is the parameter of risk preference. Noise traders decide randomly on their trades, only caring of their budget constraints.
( ) The final wealth of agent i is where θ i,T are the units of asset exchanged by agent i at time T for the price P i,T , while C i,T −1 and ω i,T −1 represent the quantities of cash and asset held at time T − 1. W i,T is a random variable which becomes known only a er the dividends X are distributed. Each rational agent i receives a compensation at time T depending on her final wealth a er the dividend distribution. If agent i has a linear contract, he/she receives the amount W i,T ; if he/she has a convex contract he/she receives a fixed amount, while if W i,T is greater than a given level K, he/she also gets an extra proportional to the surplus. The formal specifications of the contract functions are where φ, δ and K are contractually specified constants.
. At time t, the trader i enters into the market with an amount of cash C i,t−1 and ω i,t−1 units of the asset, and determines the amount of units θ * i,t to be exchanged at a price P by maximizing his/her expected utility subject to the budget constraints, that is Note that the agents are myopic, because they optimize their portfolio without considering the possibility of trading at future times. A short discussion of the solution of Equation is contained in the Appendix A to this paper.
The market is organized as a double auction, where agents can submit either market or limit orders. A rational trader entering into the market checks the best quotes available in the book and then decides, by comparing the respective utilities, whether to place a market order (buy or sell), or a limit order with an o er that improves the current trading book with a lower bid or a higher ask price. If the agent is a noise trader, the three decisions (buy, sell, or limit order) are taken randomly with equal probability, while the quantity to be traded is chosen from a uniform distribution with support given by considering both the budget constraints and, in the case of a market order, the bid or asked shares.
. The simulation algorithm proceeds as follows: . Trader i is randomly selected among those who have not yet traded in the present round.
. Any previous book order by trader i, if still present in the book, is cancelled .
. The trader decides (rationally or randomly according to the type) whether to submit a sell order, a buy order, or a limit order.

Rational and noise traders
. A rational trader decides whether to submit a sell order, a buy order, or a limit order by comparing the expected utilities of three alternatives a) Selling at the current bid price P b the number of units equal to the minimum between the units demanded at P b and the units hold by the trader.
b) Buying at the current ask price P a the number of units equal to the minimum between the units o ered at P a and c/P a , where c is the money hold by the trader.
c) Holding her current portfolio until time T .
. If the maximal expected utility is given by a), the trader submits a sell order, if it is b) a buy order, if it is c) a limit order. The specifications of the orders are determined as follows: JASSS, ( ) , http://jasss.soc.surrey.ac.uk/ / / .html Doi: . /jasss.
• (Submission of a sell order). Let P b (t) be the current bid price. Agent i solves Problem (Equation ) with P = P b (t). If the optimal solution θ * i is a negative value then the agent places the order, otherwise the agent does not sell any asset and a new agent enters the market or a new round starts. If the quantity posted in the book is greater (in absolute value) than θ * i , the quantity θ * i is exchanged, otherwise the agent's demand is only partially satisfied and the next bid in the order book is examined.
• (Submission of buy order) The same procedure is repeated by taking P = P a (t), the current ask price. If the optimal solution θ * i is a positive value then the agent places the order. If the quantity posted in the book is greater (in absolute value) than θ * i , the quantity θ * i is exchanged, otherwise the agent's demand is only partially satisfied and the next ask in the order book is examined.
• (Submission of a limit order) A price P r is chosen randomly from a uniform distribution between the current bid and ask price. The agent solves problem (Equation ) with P = P r and, if the optimal quantity θ * is di erent from zero, posts a book order, either buy or sell, according to the sign of θ * . .
A noise trader selects randomly with equal probability one of the following: a) Selling, at the current bid price P b , a random quantity (within the interval going from 0 to the minimum between the total number of his/her units ω and the outstanding lot demanded at P b ).
b) Buying, at the current ask price P a , a random quantity (within the interval going from 0 to the minimum between the outstanding lot o ered at P a and c/P a , where c is the money hold by the trader).
c) Posting a limit order with a random quantity (within his/her budget constraints) at a random price between the bid and the ask prices.
Market and Equilibrium prices .
The market price P t is the mean of all the traded prices recorded during time t. In the case of no trades, P t is taken as the closing mid price, that is the mean of the last ask and bid prices. We will compare P t to the equilibrium price P * t at time t, that is the price which clears the market, i.e. the value P that satisfies is the optimal demand for agent i at time t and at price P . Of course, only rational agents are utility maximizers and are considered for the computation of the equilibrium price. Note that the functions θ * i (P ) are not increasing, but they may not be continuous. Therefore, it is possible that there is a point P at which the total demand changes sign and then Equation does not have a solution. In this case, we take such a point, that is the price which maximizes the exchanges, as the equilibrium price. In general, the equilibrium price has to be determined through a numerical procedure. Appendix B contains more details on this issue. .
To measure the total welfare, we compute, at any time t, the total expected utility and we compare it to the total equilibrium utility, that is the total expected utility that may be reached in case of exchanges at P * t , the equilibrium price computed at time t,

Simulations
. We divide our analysis into four points. The first one focuses on the overall e ect on the market of the presence of irrational traders. The second one studies the correlation between agents portfolios and their risk aversion.  Table : The parameters used for the simulations. C 0 and ω 0 are the initial endowments, the same for all the traders. This choice implies that the expected payo of an agent with a convex contract who does not perform any trade is the same as that of an agent with a linear contract. Figure : Volumes are reported for three percentage of noise agents, %, % and %. As expected, volumes increase as noise agents percentage increase. In this plot the percentage of convex contract is .
The third one compares market prices to equilibrium prices and total utility to equilibrium utility. The fourth one examines market and limit orders. .
We restrict the analysis on risk averse agents assigning risk preference parameters γ i randomly from a uniform distribution between 0 and 10. ). We remark that the values assigned to the parameters of the contract, φ, δ and K and to the initial endowments ω 0 and C 0 are such that an agent with a linear contract has the same expected payo as an agent with a convex contract, if they both keep their initial portfolio. This ensures that, on average, the sum of all the final compensations is constant, independently on the ratio between convex and linear contracts, allowing us to compare the prices under di erent distributions of the contracts among the agents. We also changed the parameters in several other tests (not reported in the paper) to make sure that our qualitative considerations are robust with respect to the choice of the parameters.

The e ect of noise traders .
Figure shows the average percentage volume exchanged across simulations as a function of time for three cases, corresponding to %, % and % of the traders being noise ones. In this experiment, we kept the number of convex contracts equal to % of the total. We performed 1000 simulations, with T = 100 and N agents = 100. For each of the three cases, we see that volumes decrease with time, indicating that a er a certain point, agents almost stop their trading. In general, and not surprisingly, noise traders increase the volumes of exchanges. To study the distribution of wealth between noise traders and rational ones we report in Figure the average units of assets (le ) and the average amount of cash (right) per capita as a function of the time, for the case of % of the traders being noise ones. We note the transfer of wealth from the noise traders to the rational ones. This is in line with Sandroni ( ) who studied the conditions for the extinction of noise traders in a competitive market.

Correlation between risk aversion and wealth .
To study how the specification of the contract a ects the decisions of the rational traders, we computed, for each simulation and for each time t, the correlations between the risk aversions and the cash or the units of assets hold by each rational agent. We represent the mean values across the simulations of the two correlation for each t in Figure for the cases of all linear contracts and all convex contracts. For both contracts, the mean correlation is always positive for the cash (le ) and negative for the units of asset (right). This is expected, since higher risk aversion should lead to a position with more cash and less assets. We also see that convex contracts exhibit a lower correlation (in absolute value), which is sometimes not even significantly di erent from zero. This means that convex incentives strongly a ects the choices of the traders, by weakening the influence of their risk aversions. We note that the correlation starts from zero, since the initial endowments are constant among agents and then it converges towards a constant level. In the linear case, the stable level is reached earlier.

Market prices and equilibrium prices .
To evaluate the e iciency of the double auction market and the influence of linear and convex contracts, we observe the market prices P t and compute the equilibrium prices P * t and the corresponding total equilibrium utility U * t as well as the total utility U t . In a first set of simulations, we considered rational traders endowed with a linear contract and noise traders. In the second set the rational traders had a convex contract. Figures and refer, respectively, to the linear and to the convex cases. Each figure reports, on the le , the average market price P t across all simulations, the equilibrium price P * t and a constant line representing the equilibrium price at time 0, on the right, the average across all the simulations of the ratio between U t and U * t . Observing the figures on the le we see that the prices for the linear case are much lower than those of the convex one. This is due to the fact that the convex contract increases the demand for the risky asset, boosting its price. In the linear case the market prices bounce around the equilibrium price. In the convex case they Figure : On the le hand side, the market price is plotted with the static equilibrium and the dynamic equilibrium for T = 100, N agents = 100, all linear contracts, 10% of noise traders. On the right hand side, the ratio between the total expected utility and the total equilibrium utility. Values approaching 1 means that the market is allocative e icient. Figure : On the le hand side the market price is plotted with the static equilibrium and the dynamic equilibrium for T = 100, N agents = 100, all convex contracts, 10% of noise traders. On the right hand side the ratio between the total expected utility and the total equilibrium utility. Contrary to the linear case, values approach 1 only on the long run. tend to be above it and have wider oscillations. This fact may be a consequence of the characteristics of the demand functions, continuous for the linear contracts and discontinuous for the convex ones, see Figure in Appendix A. Holders of the convex contract tend to assume more extreme positions, proposing and accepting exchanges at prices higher than equilibrium. The Figures on the right show that in both the cases, the ratio of the two expected utilities converge to one, meaning that the market mechanism is e icient and reaches a global welfare. However, we note that the convergence is faster in the linear case. As already observed in the previous analysis of the correlations ( Figure ), the presence of convex contracts make the market more unstable and slower in reaching a steady state.

The order book analysis .
To analyze the order book quantities and their dependence on convex contracts we simulated a market with traders, varying the proportion of convex contracts between and , while keeping noise traders percentage equal to 10%. Parameters are as given in Table . For any percentage of convex contracts we made simulations and for each simulation we recorded the following quantities: • LOs: the total number of limit orders; • MOs: the total number of market orders; • MOBs: the total number of market orders from the buy side;  • LOBs: the total number of buy limit orders; • LOSs: the total number of sell limit orders; • LOBEs: the total number of executed buy limit orders; • LOSEs: the total number of executed sell limit orders.
. The main e ect of a convex incentive is increasing the greed of the traders. This is evident when examining the number of limit and market orders versus the proportion of convex contracts. Indeed, Figure shows that the number of limit orders decreases with the number of convex contracts, while market orders increase with it. Overall, the total amount of limit and market orders is independent of the percentage of convex contracts. Agents with convex contracts are more impatient and prefer submitting market orders rather than posting limit orders. Figure shows how limit orders are distributed between bid and o er. We see that only the number of limit orders on the sell side reacts to the increase of convex contracts, while the number of those on the buy side remains constant. However, when we observe the number of executed limit orders, see Figure , we see that changing the ratio of convex contracts has no impact, both on the buy and on the sell side. This means that one of the e ects of convex contracts is that of decreasing the number of the non-executed selling orders, as the traders submit o ers at prices that are in general too high. Interestingly, we see that market orders exhibit an opposite behavior. In fact, see Figure , the number of market orders on the buy side increases with the percentage of convex contracts, while the number of market orders on the sell side stays almost constant. Agents endowed with convex contract tend to buy more than sell. We can observe that when the percentage of convex contract is above 50%, market orders on the sell side react weakly, while market order on the buy side become flatter. This can be a side e ect because when more agents have similar demand functions, fewer exchanges take place. Such e ect may also be visible in the right panel of Figure , where the number of sell limit orders decreases at a lower rate as the percentage of convex contracts approaches %. In conclusion, the order book analysis confirms that convex contracts do change the way agents post their orders as shown by the analysis in Appendix A. In particular, Figure shows that a convex contract pushes a risk averse trader towards a demand similar to that of a more risk loving agent: convex contracts reduce risk aversion!

Conclusions
. With our agent based model, we investigated the impact of convex contracts on the price dynamics and on the order book. We found that convex contracts produce higher prices and larger deviation of prices from the rational equilibrium (the price that clears the market when only rational traders are involved). However, we showed that our artificial double auction market is e icient as it permits convergence to a global welfare but the presence of convex contracts make such a convergence slower. Furthermore, our analysis on correlation shows that convex contracts have a strong influence on the decisions of the traders, dominating the e ect of risk aversion. .
The structure of the order book is strongly a ected by the presence of convex contracts, in fact they reduce the number of limit orders submitted on the sell side, while increasing the number of market orders from the   buy side. Convex contracts encourage traders to buy more aggressively, increasing the total demand and consequently the market prices. The analysis of the order book shows that prices increase in presence of convex contract because convex contract pushes agents to buy more and to sell less, and to buy in a rush, using market orders rather than limit orders. .
In conclusion, we remark that our model examined the e ects of one particular kind of convex compensation, that is the option-like structure, which flattens bad outcomes, and linearly rewards good ones. This is the structure that is mostly used for real markets. We believe that our qualitative results still hold for the case of other convex structures, but this should be verified with further tests. Another important limitation of the present analysis is the assumption of myopic agents who optimize their portfolio as if there were only one period to go. By introducing expectations on the evolution of market prices and on the probability of a limit order to be executed, one could try to model a more complex and maybe more realistic model, where the agent perform a dynamic optimization and are not myopic but far-sighted.

Acknowledgements
A previous version of this paper was presented at the th edition of the Artificial Economics Conference, held in Porto on -September . We would like to thank Tim Verwaart and Pedro Campos for editing the special section for JASSS and an anonymous referee for many helpful comments. This research was supported by the Swedish Research Council (grant -).

Appendix A: Rational demands
In this section we analyze the optimization problem of the rational agent's to give some insights on the optimal demand function and how it changes according to the contract type. Then we study the equilibrium price aggregating the agents' optimal demand.
Recall that the rational trader solves the problem (Equation ). We consider separately linear and convex contract functions, starting from the linear case.
Let ν(θ, P ) be the first derivative with respect to θ of the expected utility of the final wealth W (θ, P ), that is For any given price P , the function ν(θ, P ) is decreasing with respect to θ when the utility function is concave (risk-averse agent) while it is increasing for a convex utility. In the risk-averse case, the optimal demand θ * , that is the solution to problem (Equation ), either satisfies the First Order Condition (FOC) ν(θ, P ) = 0, ( ) when it belongs to the feasible interval [−ω, C0 P ] or it coincides with one bound of the interval. More precisely, it is equal to the lower bound −ω when the marginal expected utility ν(−ω, P ) is negative, it is equal to the upper bound C0 P when ν( C0 P , P ) is positive, for all the remaining cases it lies within the feasible interval. Thus, the optimal demand is the continuous function where z(P ) satisfies the FOC ν(z(P ), P ) = 0, ( ) P d is the solution to ν C 0 P , P = 0 ( ) and P u satisfies (−ω, P ) = 0. ( ) When the agent is not risk averse, that is when his utility is a convex function, his optimal demand is where the switching price P s satisfies In the risk-averse case, that is for γ positive, it is easy to obtain P u = E[X] and The demand function is When the agent is risk-neutral, i.e. when γ = 0, we get and the optimal demand function becomes Note that in the case P = E[X], the agent is indi erent between buying or selling any amount of the asset and Problem (Equation ) is solved by any feasible θ.
When the contract function is convex and the agent is risk-averse, the expected utility in Problem (Equation ) is piece-wise concave as a function of θ. The reason of the piece-wise concavity stems from the fact the contract function in this case is piece-wise linear. Since the asset X assumes only two values, the expected utility has two nodes, corresponding to the values of θ satisfying In this case, the optimal demand θ * (P ) may coincide with the boundaries of the feasibility interval. This leads to an optimal demand function always discontinuous, which can be found only numerically. It is defined as in Equation for any value of the parameter gamma.
Figure represents the optimal demand functions in all cases, linear contract first line and convex contract second line for di erent levels of risk preference. The demand function is continuous for a risk-averse agent, but it is discontinuous for a risk-neutral and a risk-seeking agent. The discontinuity point is the highest price P s at which the agent is willing to invest all the money in the risky asset. It can be identified by solving Equation .
The value of P s depends on the risk preferences and it decreases with the level of risk preference γ. When the incentive is convex, the optimal demand function is always discontinuous, independently of the risk preferences. By comparing the plots in the linear and convex case in Figure , we found that the convex incentive increased the demand of the risky asset for each level of risk propension.

Appendix B: The equilibrium price
We can consider theoretical the equilibrium price only when all the traders are rational. The equilibrium price is the price which clears the market, that is the value P that solves the Equation .
The aggregate demand function is a not increasing function of P , with a number of points of discontinuity that is less than or equal to the total number of agents. Given that the aggregate demand is discontinuous, Equation may not have a solution, and hence an equilibrium price may not exist. However, we can always identify the value, where the aggregated demand changes its sign. This price, denoted by P eq represents the price that maximizes the volume of exchanges between the agents. We call it the "quasi-equilibrium" price. Of course, any equilibrium price is also a quasi-equilibrium price.
For the existence of an equilibrium price, there must be a su icient degree of heterogeneity among agents. We assume that agents have the same initial endowment (C 0 units of cash and ω units of asset). Therefore, if they also have the same level of risk preference and the same contract function, they will make the same choices and Figure : The optimal demand functions are represented for linear contract (up) and convex contract (down) for a risk averse agent (on the le hand side), a risk neutral agent (on the middle) and for a risk lover agent (on the right hand side). Only the risk averse agent with a linear contract has a continuous optimal demand, others have a discontinuous demand which correspond to a bang bang strategy. The switching price (the discontinuity point) increases with risk propensity and is higher in case of convex contract (ceteris paribus).
obviously no price can clear the market (however, also in this case, there would exist a quasi-equilibrium price). When agents' preferences or contracts exhibit enough variation among agents, the market clearing condition Equation could be satisfied.
To clarify this point, let us consider a simple example with only two agents whose demand functions are θ * i (P ) = W0 P if P ≤ P si −ω if P > P si ( ) with P s1 ≤ P s2 . By aggregating the demands we get The aggregate demand is equal to zero only if P s1 = P s2 , that is when the two agents have di erent preferences. In such a case, the equilibrium price P eq exists and is equal to C0 ω if and only if P s1 < P eq < P s2 , thus it depends on the utility functions and on the type of the contract through the values P si .
It is possible to generalize the previous argument to a set of N agents with discontinuous demand functions given by θ * i (P ) = C 0 P 1 P <Psi − ω1 P >Psi , i = 1, . . . , N ( ) where 1 A is the indicator function of the set A. Assuming, without loss of generality, that the sequence of nodes P si is increasing, the equilibrium price exists and is given by for an integer κ between 1 and N − 1, if and only if P sκ < P eq < P sκ+1 . ( )