Final Report 2

  • April 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Final Report 2 as PDF for free.

More details

  • Words: 15,163
  • Pages:
Simulating a stock market: report Guilherme Costa Instituto Superior Técnico 2008

1

Contents 1. Introduction 1.1 Objectives ...................................................................................... 3 1.2 Review of previous literature ........................................................ 3 2. The artificial stock market 2.1 In what it consists .......................................................................... 4 2.2 How it works ................................................................................. 5 3. Experimental results 3.1 Does the artificial market resembles a real stock market? ........... 7 3.1.1 Type a) example: The Down Jones market between 1 January 1981 .......... 8 and 1 January 2008: weekly opening prices variations 3.1.2 Type b) example: the Nikkei 225 index between 27 July 2004 ................. 11 and 27 December 2004 - daily opening prices variations

3.2 In particular, do crashes happen in this artificial market? ........... 14 3.2.1 A crash ....................................................................................... 14 4. Conclusions 5. References 6 . Appendixes

2

1. Introduction 1.1 Objectives The objective of the work here described work was to create a computer aided simulation of a very simple “one stock"1 market capable of showing "real life like"2 market behavior. In particular, we were interested in showing that with a very simple model, we could achieve “typical” stock market crashes resulting solely from the interactions of the agents in the market. We created a "simple"3 market, consisting of a group of investors placing buying and selling orders, each according to a previously defined strategy belonging to a very small group of "simple", "realistic" and "endogenous"4 strategies. 1.2 Review of previous literature The attempt to model the functioning of markets wasn’t born with the computer era. Economic theory has long been making conceptual models of different economical dynamics and trying to fit them to observed economic data [2,3]. Nevertheless, computers have become quite useful due to the fact they can do large calculations that would otherwise be impossible to execute by hand. This as become specially important because economic theories such as the rational expectations theory (“agents deduce their optimum behavior by logical processes from the circumstances of any situation, assuming that other agents do likewise”) seem to have been definitely abandoned by mainstream economics [1,2,3]. Some now considered more trustable approaches, such as models from the field of evolutionary economics or econophysics are characterized by “a general lack of analytical methods - most work is largely computational” [1,3]. The problem with all these know attempts to simulate markets in general is always in attesting the simulations adequacy in attaining it’s goal (which is to correctly emulate market behavior). This problem arises due to three commonly known facts: 1) Markets conceptually viewed as being the same and intended to be studied as a single “one type stock market” may exhibit very dissimilar characteristics. When we talk about comprehending the way stock markets work, we are naming a group consisting of entities showing very different behavior. 2) Markets are influenced by external variables 5 which seem very difficult (if not impossible) to simulate. Consequentially, complete replicas of actual prices from real markets are not to be expected. The comparisons provided between our simulated data and real market will always be subject to this constraint. 3) Even when aware of point 2), the tests used to judge our simulated results are always subjective. Great emphasis has been put, for example, in finding statistical distinguishing factors of the stock markets variation prices, namely, knowing what (if any) statistical distribution is best fitted to describe them. These results, with the aid of commonly known statistical tests can be used to verify 1 Actually,

for what we are interested in, it would serve to consider any other high liquidity asset

2

It’s not easy to precise this notion, as described below

3

See the detailed description of this market below

4

Meaning that the investor’s strategies and, consequently, the market’s stock price variations are determined by variables belonging to the market’s intrinsic properties and not to any external factor 5

For some markets, the finding of oil wells, to name an example 3

the more or less success of our simulation. On the other hand, many authors content themselves in looking for the presence of certain typical market behavior (like bubbles or crashes) [1]. An additional note about thes references section: regarding the process of actually building a simulation of a stock, [1] is still one of the most cited papers on the subject; concerning the highly studied distribution of stock market prices variations, Mandelbrot paper on the subject [5] seems to be considered a classic (at least it is cited in literally all other writings we found touching the same issues); for information concerning market crashes, Sornette [8] looks very complete.

2. Our artificial stock market 2.1 In what it consists When a “new market”1 is created, it is created with a specific number of investors. Each one of these investors is determined to have an initial number of stocks, an initial amount of money and, more importantly, an acting strategy, consisting in a set of rules determining the investor’s behavior in his attempt to maximize his earnings. Each investor can have one and only one strategy. This can be chosen from four possible strategies, whose descriptions you can find in the end of this chapter. Please note: for design simplicity, after the market is created, the total number of investors (and their strategies), stocks and money cannot be changed. We make time t discrete and refer to the interval from t-1 to t as the tth time tick. The market starts functioning with t=0 and with a reference first stock price of 1.0 (this is configurable). At each time tick, we can roughly describe our market by specifying the following components 2: a) The current set of investors, each investor having a current number of stocks and amount of money. b) The current stock price. The current stock price is defined as the value of the last stock exchanged in this time tick. c) The current market history. The market history is a record of the way the stock price evolved from time t=0 the present time tick. d) The orders book. When an investor wants to buy or sell stocks he does so by placing buying or selling orders (for comprehension reasons, it can be supposed that the investors place their orders to a kind of “central authority” capable of matching different orders according to a defined set of rules3). The orders who aren’t instantly fulfilled (as an example, suppose someone places a selling order for one of his stocks, demanding a price no one is whiling to give at the moment) are kept in the orders book so they can possibly be fulfilled in the future.

2.2 How it works The computer is instructed to simulate the functioning of the market over time by successively specifying the number of times ticks to pass. 1

We think it must be more or less obvious that what we are trying to simulate is a somehow “abstract” idea of a stock market and not a particular stock market in the sense of having a fixed number of investors, a fixed number of stocks, etc. 2

This part will become clearer in 2.2

3 Actually,

most market trade orders are sent to be handled by stock brokers. Stock markets vary greatly in their functioning. The referred set of rules, sometimes called the “clearance mechanism” varies according to the market in question [14]. The by us chosen will be explained in the 2.2 4

In each time tick, investors from the current set of investors are randomly chosen to actualize their orders (the number of investors chosen is a configurable predefined percentage of the current total). This is done by placing a new buying order and a new selling order (possibly replacing older orders) in the orders book according to the investors strategy. A buying order consists of an indication from the investor who places the order, stating one of the following1 alternatives: B1 - The investor is willing to buy a single stock2 for the best offered price. This is the lowest amount of money someone will sell him a stock for. The investor doesn’t know what this value is when he places the order, so he puts no maximum limit for the money he may have to spend on buying a stock B2 - The investor is willing to buy a single stock for a specified price bp (or a smaller one) B3 - The investor won’t buy stocks A selling order consists of an indication from the investor who places the order, stating one of the following alternatives: S1 - The investor is willing to sell a single stock for the best offered price. This is the highest amount of money someone will buy him a stock for. The investor doesn’t know what this value is when he places the order so he puts no minimum limit for the money he may get for selling a stock S2 - The investor is willing to sell a single stock for a specified price sp (or a greater one) S3 - The investor won’t sell stocks Please note: if, for any reason, an investor has debts3 or happens to have no stocks, he is forced, regardless of his strategy, to place orders stating respectively that he doesn’t buy stocks and that he doesn’t sell them. We define the best buying order in the orders book as follows: if there exists a C1 type order, that is the best buying order (if many of these orders exist, the one placed first is chosen). If that is not the case, the best buying order is the C2 type order offering the highest value for a stock (if many of these orders exist, the one placed first is chosen). We define the best selling order in the orders book as follows: if there exists a S1 type order and the orders book contains a best buying order of type C1, that S1 type order is the best selling order (if many of these orders exist, the one placed first is chosen) . If that is not the case, the best selling order is the S2 type order offering a stock for the lowest value, as long as there exists a best buying order of the C1 type in the orders book or a best buying order found the C2 type with the price specified in it greater than the one present in the S2 type order (again, if many of these orders exist, the one placed first is chosen). Each time a different investor places his order, the clearance mechanism is activated. The clearance mechanism tries to match the different orders in the orders list. Here is, in chronological order, how it works 4: 1- The best buying order in the orders book, if there is one, is found. 2 - The best selling order in the orders book, if there is one, is found.

1

We from know one will designate one of the presented orders as order of type B1,S1,etc... , accordingly to what is shown 2

There doesn’t seem to be a problem mimicking real market behavior forcing investors to place “one stock order” at a time and this approach has been followed by others [3] 3 4

It can happen, as you will see below

There are a great many solutions to this problem and it is not easy to previously know the best fitted to correctly simulate real life markets specially because, as was stated earlier, real markets have different solutions for this problem. A list of possible ones is available in [3] 5

3 - A transaction is made between the investor who placed the best buying order and the one who placed the best selling order. The transaction is made at price tp calculated as follows according the nature of the orders involved: a) With a C1 type order and an S1 type order1, tp takes the value of the current stock price b) With a C1 type order and an S1 type order, tp takes the value of the current stock price c) With a C1 type order and an S2 type order , tp takes the value from the price present in the S2 order d) With a type C2 type order and an S2 type order, tp takes the value of the arithmetic mean of the prices present in the orders, that is, if pc2 is the price present in the C2 order and ps2 the one in the s2 order, tp=(pc2+ps2)/2 The investor who is buying gives tp of its money to the one selling (possibly “borrowing”2) and receives a stock in exchange. Steps one to three are repeated until no transactions can be made: no best buying order exists or there is one but there isn’t a best selling order. Strategies description Strategy 1: when called, the investor places a buying order to buy at best price if the stock has been going up for at least X time ticks, where X as an exponential distribution with parameter 'exponential lambda' (this is a configurable value). The investor places a selling order to sell for the best price if the action has been going down for at least X time ticks Strategy 2: when called, the investor places a buying order to buy at best price if the stock has been going up for at most X time ticks, where X has an exponential distribution with parameter 'exponential lambda'. The investor places a selling order to sell for the best price if the action has been going down for at most X time ticks Strategy 3: when called, the investor places a buying order, buying for at most X-'pip'*X. The investor places a selling order, selling for at least X+'pip'*X. How is X calculated? X is assigned a value from a random variable with normal distribution having mean current stock price and variance 'variance'. Defining csp=current stock price and cp=chopping parameter, we have: if X > csp*(1+cp) or X < cps*(1-cp), the process is repeated until csp*(1-cp ) < X < csp*(1+cp) Note: 0<'chopping parameter'<1. Both this parameter, ‘variance’ and ‘pip’ are configurable Strategy 4: when called, the investor places a buying order, buying for at most M-'pip'*M. The investor places a selling order, selling for at least M+'pip'*M. How is M calculated? M is assigned a value from a random variable with normal distribution having mean 'first stock price' and variance 'variance'. Defining fsp=current stock price and cp=chopping parameter, we have: if M > fsp*(1+cp) orM
1

This case is not likely to happen, specially in stock markets which have many investors. Thus it is a somewhat of an artificial situation (it is not likely to happen during simulations either). The solution presented seemed to us the conducing to the most “natural” results 2 As

noted before, the investor can have debts in the sense that he is represented as having “negative money”. We didn’t want to make the model more complex by introducing a “real life like” representation of borrowing. Nevertheless, the discussed solution didn’t seem to generate any “bad results” (it wasn’t expected to do so; borrowing DOES exist) and was substantially more easy to implement for technical reasons 6

3. Experimental results 3.1 Does the artificial market resembles a real stock market? We have already pointed out that it is not easy to precise in what this “resemblance” consists. We considered using statistical tests built to compare wether two samples proceed from the same distribution. Specifically, we were trying to defend the hypothesis that the price variations of our generated data and the price variations of data gathered from real markets follows the same statistical distribution. It turns out, however, this hypothesis is unlikely to be true. The Dow Jones composite average index1 2 can offer us a typical example of the problem. We calculated the weekly variation (in percentage) of the opening prices between 1 January 1981 and 1 January 2008. Below (figure 1 (a)) is the histogram showing the relative frequencies of the variations from our sample, followed by a graphic of the Down jones between the referred period. a) Figure 1 (a) histogram showing the relative frequencies of the Dow jones price variations (in percentage) between 1 January 1981 and 1 January 2008, (b) Dow Jones index value between 1980 and 2008

Price

b)

4000

3000

2000

1000

Weeks passed 200

400

600

800

1000

1200

1

This data was retrieved from [15]; it can be found at the end of this report

2

We will from now on refer to this index as the “Down Jones” 7

1400

Notice how the right side of the histogram (suppose it centered at 0) has a much larger area than the left one. This effect seems to be easy explained by the overall trend in the Dow jones to rise in value during the selected period, as depicted in figure 2. Such a large rise over such a great period cannot fully be explained by the market endogenous dynamics. Most probably, the presented rise is the reflect on a true rise in the production value of the companies represented by the index and, thus, of an exogenous variable. As a result of this, even in the short term we cannot expect our model to adequately reproduce some of the aspects of real stock markets functioning since, as we have seen (and hence the histogram looks), long term market behavior resulting from non endogenous variables does seem to affect short term market behavior. On the other hand, it should be obvious that different markets as well as the same market at different times can exhibit very dissimilar conducts. Even the same market can show different behaviors according to the time scale we use to analyze it [2]. For this reason, it is not easy to establish a well defined term of comparison for our simulated results. It follow that attempts to directly compare this results with real market data will most likely fail. Nevertheless, our presented models is in no way badly suited to serve our purposes, namely, showing it possible to produce real like market behavior exclusively using investors trading on strategies depending solely of endogenous parameters. We have therefore followed the approach of showing the adequateness of our model by comparing certain very specific statistical aspects of our generated data with arbitrarily real market data1, while taking into account the above explained problems. Particularly, we expected that, for any pair of generated/real data values, a) In the general case, the price variations from both samples are not adequately modeled by a Gaussian distribution for there is a much higher probability attributed to values belonging to the “end” of the gaussian distribution tails; a logistic distribution, for example, will yield better approximation results [6,11] b) In the particular cases for which the real market data doesn’t seem to exhibit long term exogenous based trends, common statistical tests should indicate that price variations in the real market data and price variations in the generated market data follow the same distribution 3.1.1 Type a) example: The Down Jones market between 1 January 1981 and 1 January 2008: weekly opening prices variations 2 Bellow you can see (figure 2 (a)) a graph representing the price variations obtained from the real data and the simulated price variations (figure 2 (b)), as well as the actual price over the referred period (figure 3 (a)) and the simulated price during a chosen one (figure 3 (b)). Our initial market setup consisted of:

1

In fact, as we stated already, we wish only to prove the model can produce adequate results. The process followed was that of experimental changing the simulation parameters in order to obtain the desired results. The description of that process as well as the possible conclusions to be drawn from the parameters obtained is out of the scope of this text 2

Numerical data can be found at the end of this report 8

Global parameters

Strategies parameters

Investors

first stock price=376.08 (This was chosen to mach the real data first stock price value)

exponential lambda=1.0

10 strategy 1 investors with stocks=1000 and money=1000

pip=0.01

variance=25

100 strategy 3 investors with stock=1000 and money=1000

percentage=10%

chopping parameter=0.99

100 strategy 4 investors with stocks=1000 and money=1000

The market was kept running for 1410 time ticks (so as to make one time tick per week).1

a)

1

Numerical data can be fond at at the end of this report 9

b)

Figure 2 (a) weekly opening prices variations in the the Down jones between 1 January 1981 and 1 January 2008 (percentage values), (b) simulated data prices variations per time tick (percentage values)

Price

a) 4000

3000

2000

1000

Weeks passed 200

400

600

800

10

1000

1200

1400

Price

b) 395

390

385

380

375

Weeks passed 200

400

600

800

1000

1200

1400

Figure 3 (a) opening prices in the Down jones between 1 January 1981 and 1 January 2008 , (b) simulated prices

It is obvious that such differences as depicted in the graphics from figure 3 most somehow reflect themselves in the statistical distribution of the prices variations. Nevertheless, using the ShapiroWilk test [12] for testing a formal agreement with normality (or not) we have, as expected, a) For the real data: W = 0.9586, p-value < 2.2e-16 b) For the simulated data: W = 0.9845, p-value = 3.611e-11 According to the usual significance levels, we therefore reject, in both cases, the hypothesis that the distribution in study is normal. On the other hand, resorting to the Kolmogorv-smirnof test for comparison with a logistic distribution, we have: a) For the real data, using a logistic distribution of location parameter 0.001985 (we used the sample mean) and scale parameter 0.012: D = 0.0276, p-value = 0.2346 b) For the simulated data, choosing a logistic distribution of location parameter 2.298826e-05 (we used the sample mean) and scale parameter 0.0036: D = 0.0211, p-value = 0. 0.56 According to the usual significance levels, as expected, no evidence is found to reject the hypothesis that both samples proceed from a Logistic distribution. 3.1.2 Type b) example: the Nikkei 225 index between 27 July 2004 and 27 December 2004 - daily opening prices variations1 Bellow you can see (figure 3 (a)) a graph representing the prices variations obtained from the real data and the simulated price variations (figure 3 (b)), as well as the actual price over the referred period (figure 3 (a)) and the simulated price during a chosen one (figure 3 (b)).

1

This data was retrieved from [16]; it can be found at the end of this report 11

Global parameters

Strategies parameters

Investors

first stock price=11.37452 (This was chosen to mach the real data first stock price value)

exponential lambda=1.0

10 strategy 1 investors with stocks=10 and money=10

pip=0.01

variance=0.15

10 strategy 2 investors with stock=10 and money=10

percentage=10%

chopping parameter=0.99

10 strategy 3 investors with stocks=10 and money=10 10 strategy 4 investors with stocks=10 and money=10

The market was kept running for 104 time ticks (so as to make one time tick per week)1.

a)

1

Numerical data can be fond at at the end of this report 12

b)

Figure 3 (a) daily opening prices variations in the the Nikkei 225 between 27 July 2004 and 27 December 2004 (percentage values), (b) simulated data prices variations per time tick (percentage values)

Price

a)

11400 11300 11200 11100 11000 10900 10800

20

40

60

13

80

100

Days passed

Price

b) 11.7 11.6 11.5 11.4 11.3 11.2

20

40

60

80

100

Days passed

Figure 4 (a) opening prices in the the Nikkei 225 between 27 July 2004 and 27 December 2004 (b) simulated prices

Notice how the graphics in figure 4 seem much more alike than the ones displayed in figure 2. As promised, many statistical indicators can now be find to provide corroboration for the thesis that the prices variations distributions in the real market is the same as the one obtained from our simulated market: The sample variance of each set of values is “very similar”: a) For the real data: 9.158376e-05 b) For the simulated data: 9.409476e-05 Using, the Wilcoxon rank sum test with continuity correction [13], we have: W = 5413, p-value = 0.8957 And again recurring to the kolmorov-smirnof test, we have: D = 0.1286, p-value = 0.3586 In both tests we conclude, using the usual significance levels, there is no evidence to reject the null hypothesis, namely, that the two samples proceed from the same distribution. 3.2 In particular, do crashes happen in this artificial market? There isn’t a generally used rigorous quantitative definition of a “market crash”. Most scholars more or less refer to market crashes as “a sudden dramatic decline of stock prices across a significant cross-section of a stock market ” [8,9]. Before trying any simulation, we committed ourselves in defining “a sudden dramatic decline” and, quite arbitrarily, we proposed to obtain in a simulation, at least a 50% price drop in a time interval no longer than 5% of the total existence time of the simulated market. That was achieved, as the following example will show: 3.2.1 A crash 14

The initial market setup was: Global parameters

Strategies parameters

Investors

first stock price=11.37452 (This was chosen to mach the real data first stock price value)

exponential lambda=1.0

100 strategy 1 investors with stocks=100 and money=10

pip=0.01

variance=1

10 strategy 2 investors with stock=10 and money=10

percentage=10%

chopping parameter=0.99

10 strategy 3 investors with stocks=10 and money=10 10 strategy 4 investors with stocks=10 and money=10

The market was kept running for 400 time ticks 1. Bellow is a graph (figure 3 (a)) with the generated prices. In red, we marked the location of the identified crash. This consists of a 75.53% drop (from 9.367 to 2.292) in a 18 time ticks period (starting at the 265 time tick and ending at the 283), which amounts to 4.5% of the total time the market was running.

Figure 5. Simulated prices with a “crash” (located in the red rectangle)

1

Numerical data can be found at the end of this report 15

It is important to recognize that the here presented initial market setup was in no way arbitrarily chosen. In fact, we realized being much easier to simulate crashes making strategy 1 or strategy 2 investors in far greater number than the other types. This was of course to be expected since, in a way, this investors “amplify” the effects from the other investors actions. Setting them with little money and many stocks, lead them to sell more than to buy, causing great sudden falls in the stock price.

4. Conclusions We created a computer aided simulation of a simple “one stock" market consisting of a group of investors placing buying and selling orders, each according to a previously defined strategy belonging to a small set of "simple", "realistic" and "endogenous"1 strategies. We showed it was possible to somehow simulate the behavior of a real stock market by attending , as was our objective, exclusively to the interactions of the investors composing the market. The way in which this simulation was successful, however, was shown very hard to judge. The idea for us followed was using typical statistical tests for the comparison of two samples: one consisting on the prices variations of real market data and the other being the prices variations of our simulated data. This comparison showed our simulation to be adequate while considering markets not affected by long term exogenous variables. When attending to markets who were affected by long term exogenous variables, the referred tests didn’t provide the desired results. Nevertheless, commonly know statistical properties of real stock markets behavior were still possible to find in our generated data, namely, the prices variations being adequately modeled not by normal distributions but by logistic distributions Other typical market behavior could be perceived in the generated data. In particular, market crashes were shown to occur.

References [1] R.G. Palmer, W. Brian Arthur, John H. Holland, Blake LeBaron, and Paul Tayler, Artificial Economic Life: A Simple Model of a Stockmarket, Physica D 75, 264-274 (1994) [2] P. Bak, M. Paczuski, M. Shubik, Price Variations in a Stock Market With Many Agents, Physica A, 246, 3-4, December 1, 1997, 430-453 [3] P. Ball, Critical mass, Arrow books, 2004 [4] W. Brock, C. Hommes, Rational route to randomness, Ecconometrica 65, 1997 [5] B. Mandelbrot, the variation of certain speculative prices, J.Bus. 35, 1963 [6] R. Mantegna, H. Stanley, Scaling behaviour in the dynamics of and iconomic index Nature, vol. 376, 1995 [7] T. Lux, M. Marchesi, Scaling and criticality in a stochastic multi-agent model of a financial market, Nature, vol. 397, 1999 [8] D. Sornette, Critical market crashes, 2003 [9] C. P. Kindleberger, Manias, panics and crashes, Wiley investement classics, 1978 [10] K. Steiglitz, D. Shapiro, Simulating the madness of crowds: price bubbles in an auction-mediated robot market, Princeton, 1997 [11] N. Balakrishnan. Handbook of the Logistic Distribution, Marcel Dekker, New York, 1992

1 As

stated in the introduction, meaning that the investor’s strategies and, consequently, the market’s stock price variations are determined by variables belonging to the market’s intrinsic properties and not to any external factor 16

[12] S. S. Shapiro, M. B. Wilk, "An analysis of variance test for normality (complete samples)", Biometrika, 52, 3 and 4, pages 591-611 (1965) [13] D. Bauer, Constructing confidence sets using rank statistics, Journal of the American Statistical Association 67, 687–690 , 1972 [14] "Stock basics: how stocks trade" Investopedia. Retrieved September 2, 2008 (http://www.investopedia.com/ university/stocks/stocks3.asp). [15] "Historical prices for Down Jones composite average" Yahoo! Finance. Retrieved September 2, 2008 (http:// finance.yahoo.com/q/hp?s=^DJA&a=00&b=1&c=1981&d=00&e=1&f=2008&g=w). [16] "Historical prices for Nikkei 225" Yahoo! Finance. Retrieved September 2, 2008 http://finance.yahoo.com/q/hp? s=^N225&a=06&b=27&c=2004&d=11&e=27&f=2004&g=d).

Appendix A: numerical data (all results are presented in chronological order) 1) Down Jones weekly opening prices between 8 January 1981 and 8 January 2008 375.53, 376.08, 378.81, 373.7, 376.32, 365.58, 368.85, 373.56, 361.17, 358.52, 369.51, 372.75, 381.94, 383.58, 389.42, 390.3, 390.98, 391.51, 394.56, 378.44, 378.02, 384.66, 380.38, 388.64, 384.79, 391.32, 385.8, 383.29, 370.3, 370.69, 371.37, 367.36, 371.18, 368.72, 371.14, 361.51, 351.51, 336.11, 339.19, 326.58, 315.46, 339.79, 343.01, 333.81, 332.03, 343.48, 342.87, 345.04, 343.77, 355.21, 357.75, 351.61, 351.46, 348.32, 348.22, 342.37, 329.46, 325.82, 335.89, 333.09, 324.68, 327.3, 323.56, 318.53, 311.55, 318.04, 321.84, 329.34, 332.57, 332.49, 338.51, 332.33, 341.85, 337.99, 327.7, 319.64, 314.28, 315.88, 306.16, 312.58, 310.66,

17

319.48, 321.36, 318.71, 311.91, 299.6, 306.33, 333.34, 341.7, 359.05, 353.1, 353.41, 357.06, 350.74, 383.33, 385.79, 398.15, 388.7, 409.82, 402.89, 399.16, 393.33, 404.65, 400.14, 399.63, 409.15, 409.86, 420.83, 425.71, 404.79, 418.04, 429.2, 428.08, 431.81, 439.43, 451.48, 443.19, 442.61, 450.84, 445.1, 446.8, 461.83, 468.06, 472.92, 481.1, 474.38, 465.79, 475.52, 479.17, 481.71, 492.55, 495.98, 486.19, 485.92, 475.76, 489.2, 473.6, 468.22, 472.78, 474.39, 467.71, 486.68, 497.09, 489.5, 501.42, 486.33, 505.43, 503.19, 496.51, 493.53, 493.13, 502.99, 505.49, 512.54, 506.87, 505.93, 496.59, 498.25, 503.08, 512.88, 505.91, 500.12, 490.32, 468.17, 456.86, 449.94, 456.94, 461.19, 448.75, 459.38, 452.06, 457.65, 442.89, 447.94, 452.58, 453.28, 455.38, 453.09, 440.55, 429.38, 441.31, 438.86, 423, 440.27, 439.29, 437.35, 432.59, 423.55, 432.04, 470.02, 469.93, 468.96, 474.78, 471.81, 463.92, 478.38, 471.63, 473.6, 466.31, 470.96, 485.01, 475.2, 482.46, 483.62, 471.94, 484.06, 473.68, 466.38, 473.6, 484.68, 486.83, 482.38, 492.6, 497.75, 515.61, 515.11, 524.48, 522.98, 518.32, 528.26, 515.61, 508.41, 509.65, 514.75, 511.36, 514.62, 512.58, 512.97, 507.12, 524.46, 534.31, 534.47, 544.35, 542.89, 536.56, 542.66, 551.05, 554.29, 557.76, 564.12, 556.94, 557.55, 545.6, 543.13, 548.88, 553.7, 551.24, 537.3, 537.86, 536.99, 537.95, 543.34, 552.59, 548.8, 562.46, 569.82, 579.17, 585.75, 588.65, 594.21, 615.11, 614.66, 615.03, 616.77, 602.21, 612.68, 620.25, 632.36, 645.42, 661.62, 675.46, 678.25, 674.39, 701.12, 700.08, 717.69, 681.17, 698.83, 718.46, 713.41, 691.85, 694.79, 685.2, 709.79, 721.65, 705.28, 718.82, 715.3, 724.33, 725.39, 701.75, 686.69, 696.4, 678.98, 688.84, 717.86, 730.4, 737.03, 731.74, 689.15, 699.7, 699.17, 707.15, 713.7, 720.98, 725.46, 742.1, 745.27, 736.24, 745.27, 749.91, 760.28, 745.45, 751.58, 747.33, 753.73, 777.61, 798.88, 807.67, 820.59, 840.53, 841.89, 856.55, 850.71, 863.04, 853.38, 877.59, 844.45, 893.43, 868.13, 854.7, 826.55, 846.49, 872.85, 853.41, 849.66, 867.32, 871.43, 902.13, 910.78, 912.87, 915.06, 918.27, 928.3, 925.4, 943.46, 959.45, 988.67, 988.77, 962.41, 930.72, 951.18, 924.36, 944.31, 964.18, 917.12, 778.96, 693.19, 730.16, 720.99, 725.26, 703.57, 688.77, 656.56, 686.58, 728.45, 720.99, 718.29, 718.69, 723.57, 710.39, 734.81, 712.44, 736.07, 751.96, 757.69, 767.37, 759.36, 777.76, 743.35, 749.85, 782.45, 744.51, 754.54, 755.12, 745.86, 740.95, 724.82, 731.46, 770.85, 784.44, 777.82, 799.42, 793.98, 789.28, 790.83, 767.86, 793.45, 790.34, 759.76, 758.06, 757.27, 770.1, 776.95, 782.51, 784.78, 794.92, 811.43, 802.66, 820.49, 807.55, 808.27, 789.91, 781.37, 787.48, 799.92, 816.88, 816.47, 824.73, 823.86, 835.51, 845.88, 854.38, 881.6, 889.48, 869.57, 888.16, 863.24, 870.77, 871.7, 862.97, 847.87, 874.21, 880.2, 890.21, 917.94, 920.86, 912.35, 932.71, 956.31, 956.65, 958.82, 954.78, 949.69, 971.09, 946.09, 969.58, 984.73, 1000.89, 1022.42, 1033.64, 1062.06, 1072.15, 1085.57, 1108.56, 1082.05, 1067.53, 1067.99, 1075.08, 1111.14, 995.69, 1021.83, 993.95, 1002.44, 1005.13, 1007.07, 1008.85, 1037.41, 1032.03, 1029.58, 1021.93, 1033.23, 1029.31, 1000.67, 1002.57, 964.21, 965.82, 979.93, 966.5, 958.72, 995.14, 995.83, 1011, 1012.23, 1004.17, 1008.16, 1027.45, 993.77, 975.35, 998.03, 1031.48, 1030.41, 1023.65, 1051.13, 1042.23, 1053.16, 1033.45, 1031.12, 1034.37, 1061.94, 1040.15, 1018.5, 954.71, 944.03, 919.9, 901.41, 896.24, 920.5, 888.49, 875.58, 865.55, 881.48, 854.15, 882.55, 862.09, 878.99, 875.44, 895.65, 876.8, 898.29, 909.12, 906.14, 923.74, 919.05, 898.95, 877.4, 935.17, 957, 979.8, 1015.2, 1037.95, 1044.01, 1045.35, 1042.13, 1030.11, 1011.83, 1031.69, 1033.23, 1044.01, 1054.64, 1045.26, 1050.47, 1055.2, 1035.65, 1044.74, 1083.99, 1073.21, 1080.71, 1047.24, 1036.74, 1040.88, 1061.11, 1070.84, 1062.3, 1073.11, 1066.98, 1018.31, 1079.7, 1081.38, 1062.66, 1060.75, 1069.7, 1068.75, 1061, 1073.56, 1111.29, 1088.94, 1103.25, 1102.05, 1072.73, 1049.78, 1040.64, 1056.7, 1064.65, 1064.19, 1128.88, 1159.22, 1150.17, 1179.35, 1164.71, 1154.37, 1161.53, 1173.44, 1188.4, 1179.72, 1163.74, 1163, 1178.98, 1158.57, 1157.42, 1155.25, 1186.88, 1173.02, 1183.88, 1200.78, 1193.14, 1195.79, 1195.23, 1200.35, 1179.16, 1154.9, 1149.13, 1180.02, 1172.21, 1158.86, 1153.38, 1188.66, 1162.17, 1157.67, 1132.12, 1138.01, 1147.17, 1172.94, 1165.59, 1144.59, 1121.54, 1110.94, 1131.41, 1152.26, 1162.97, 1172.94, 1164.7, 1164.38, 1191.63, 1195.62, 1191.37, 1206.12, 1208.12, 1207.38, 1201.66, 1214.15, 1208.75, 1228.01, 1275.47, 1259.93, 1229.59, 1253.42, 1267.49, 1268.17, 1268.91, 1277.78, 1262.29, 1288.02, 1320.41, 1282.66, 1282.56, 1281.25, 1278.27, 1285.97, 1298.85, 1302.83, 1285.97, 1273.58, 1279.29, 1288.68, 1284.34, 1295.94, 1312.68, 1318.99, 1321.52, 1324.82, 1336.5, 1351.98, 1342.71, 1341.17, 1337.6, 1326.4, 1330.74, 1328.98, 1338.21, 1343.8, 1364.5, 1347.59, 1360.93, 1351.22, 1362.41, 1367.68, 1373.99, 1377.02, 1384.54, 1379.82, 1398.36, 1412.76, 1415.19, 1437.76, 1405.57, 1407.97, 1399.45, 1383.58, 1381.3, 1379.41, 1377.84, 1353.88, 1272.68, 1305.29, 1293.87, 1293.52, 1314.99, 1285.37, 1264.51, 1299.67, 1306.85, 1315.39, 1306.44, 1308.22, 1266.27, 1276.49, 1292.36, 1299.99, 1297, 1301.81, 1306.51, 1310.1, 1296.57, 1336.92, 1333.38, 1316.21, 1321.12, 1282.29,

18

1287.84, 1265.6, 1299.27, 1295.33, 1314.01, 1277.9, 1270.78, 1270.53, 1241.36, 1251.79, 1224.86, 1256.6, 1272.22, 1273.28, 1291.21, 1313.26, 1294.02, 1305.08, 1319.39, 1328.51, 1339.82, 1354.64, 1336.6, 1345.26, 1358.45, 1374.05, 1386.86, 1399.48, 1414.95, 1413.88, 1436.9, 1425.61, 1452.69, 1429.67, 1438.36, 1458.46, 1456.56, 1487.51, 1511.35, 1505.26, 1561.64, 1566.5, 1551.9, 1575.98, 1569.77, 1543.92, 1559.47, 1560.23, 1572.64, 1599.83, 1618.16, 1602.09, 1617.47, 1605.26, 1615.08, 1603.14, 1600.09, 1634.46, 1640.73, 1668.51, 1687.5, 1707.01, 1718.76, 1701.84, 1684.11, 1689.45, 1711.42, 1661.55, 1686.71, 1706.6, 1732.24, 1791.72, 1764.29, 1811.68, 1794.89, 1759.8, 1817.39, 1843.13, 1820.05, 1815.53, 1794.57, 1824.29, 1815.47, 1799.74, 1813.35, 1868.5, 1885.64, 1837.13, 1854.78, 1836.99, 1854.08, 1847.37, 1808.39, 1786.07, 1743.77, 1741.94, 1806.11, 1805.76, 1815.3, 1825.47, 1782.36, 1806.04, 1851.62, 1859.75, 1855.51, 1890.22, 1879.07, 1913.94, 1902.71, 1907.65, 1968.12, 2005.12, 2037.99, 2047.77, 2026.31, 1996.8, 2036.18, 2061.44, 2048.01, 2086.31, 2122.09, 2096.21, 2112.33, 2118.61, 2157.87, 2133.18, 2111.07, 2174.88, 2148.03, 2125.82, 2094.1, 2068.24, 2022.77, 2114.8, 2114.2, 2219.72, 2241.57, 2245.46, 2277.58, 2288.81, 2316.95, 2381.65, 2387.2, 2371.4, 2437.06, 2442.11, 2432.28, 2494.19, 2516.11, 2483.42, 2411.7, 2460.95, 2406.9, 2471.84, 2474.59, 2556.42, 2529.92, 2586.82, 2593.35, 2551.73, 2503.25, 2471.06, 2496.53, 2490.12, 2546.05, 2568.46, 2642.45, 2583.9, 2549.43, 2536.25, 2619.29, 2476.13, 2583.19, 2564.94, 2638.97, 2688.75, 2773.66, 2738.51, 2746.66, 2790.46, 2827.85, 2851.38, 2840.34, 2928.5, 2891.3, 2960.65, 2861.58, 2914.62, 2881.67, 2866.99, 2880.21, 2822.51, 2860.66, 2806.71, 2813.88, 2870.51, 2897.68, 2920.11, 2947.59, 2821.32, 2783.97, 2698.52, 2642.73, 2686.12, 2559.58, 2492.14, 2510.08, 2497.08, 2585.95, 2490.13, 2520.06, 2648.83, 2649.32, 2707.75, 2786.1, 2758.24, 2845.58, 2871.67, 2830.94, 2733.11, 2792.97, 2868.96, 2874.43, 2985.13, 2907.12, 2838.14, 2911.51, 2882.32, 2853.62, 2876.62, 2875.7, 2989.07, 3018.35, 3030.32, 3006.11, 3015.4, 3050.46, 3191.65, 3228.16, 3269.48, 3335.19, 3294.39, 3283.63, 3214.05, 3271.56, 3187.44, 3269.97, 3202.3, 3316.59, 3324.08, 3313.98, 3255.5, 3187.69, 3182.43, 3212.56, 3239.92, 3243.91, 3236.7, 3207.13, 3138.9, 2989.94, 2998.87, 3107.71, 2937.84, 3021.07, 3130.4, 3101.23, 3131.27, 3138.64, 3102.87, 3165.39, 3123.93, 3141.92, 3176.7, 3215, 3243.88, 3271.21, 3179.85, 3035.69, 3087.98, 2946.94, 2896.29, 2780.19, 2907.95, 2789.33, 2989.78, 3090.85, 3069.93, 3131.98, 2979.38, 3108.99, 3110.61, 3082.67, 3107.28, 3082.68, 3011.71, 3121.45, 3086.27, 3032.83, 3011.79, 2991.28, 3073.04, 3148.37, 3117.8, 3068.77, 3175.19, 3242.53, 3242.24, 3245.34, 3254.11, 3295.83, 3252.24, 3180.2, 3175.39, 3132.22, 3054.48, 3068.15, 3133.4, 3235.11, 3198.42, 3239.77, 3205.49, 3153.91, 3241.41, 3152.68, 3252.32, 3318.1, 3219.07, 3156.75, 3166.02, 3226.4, 3286.47, 3292.93, 3286.33, 3199.85, 3210.64, 3245.1, 2993.33, 2911.22, 3059.69, 2994.95, 3104.54, 3209.12, 3270.81, 3281.18, 3257.62, 3374.29, 3308.73, 3295.54, 3261.76, 3139.19, 3119.24, 3144.04, 3097.32, 3178.54, 3172.09, 3126.13, 3160.53, 3109.81, 3057.6, 3109.16, 3008.74, 2920.68, 2490.37, 2599.21, 2687.74, 2720.21, 2671.15, 2720.73, 2670.21, 2755.03, 2826.59, 2847.03, 2807.07, 2877.13, 2810.4, 2867.82, 2913.3, 2978.08, 2895.65, 2849.23, 2886.31, 2889.32, 2818.2, 2853.36, 2868.78, 2991.68, 3081.87, 3068.59, 3038.55, 3045.6, 2986.46, 2993.64, 2998.34, 2911.09, 2940, 2887.95, 2962.49, 2942.24, 2891.05, 2788.24, 2774.3, 2757.23, 2743.09, 2724.86, 2518.06, 2325.47, 2353.14, 2366.1, 2497.01, 2503.31, 2553.1, 2472.42, 2415.34, 2376.28, 2282.21, 2236.02, 2169.97, 2193.76, 2285.22, 2344.93, 2376.39, 2378.87, 2391.19, 2435.23, 2457.21, 2413.38, 2381, 2406.99, 2359.63, 2443.44, 2488.97, 2431.43, 2293.81, 2278.16, 2223.03, 2214, 2238.35, 2200.26, 2179.02, 2191.57, 2382.23, 2293.2, 2326.96, 2314.34, 2382.86, 2392.98, 2472.33, 2477.64, 2497.08, 2494.54, 2563.56, 2597.16, 2604.99, 2625.32, 2575.33, 2588.43, 2616.05, 2626.01, 2651.97, 2619.85, 2623.62, 2659.74, 2666.92, 2695.07, 2733.24, 2729.58, 2781.4, 2691.95, 2773.46, 2799.8, 2811.7, 2785.37, 2843.43, 2856.63, 2833.56, 2783.22, 2838.15, 2854.06, 2904.05, 2956.52, 2972.94, 2993.44, 2997.33, 3031.79, 3045.48, 2984.4, 2997.37, 3012.02, 3005.3, 3016.29, 3021.35, 2943.78, 2924.5, 2938.7, 3023.2, 3004.54, 2996.25, 3016.09, 2946.22, 2905.38, 2884.45, 2880.61, 2959.85, 2974.39, 3008.18, 3030.42, 3054.03, 3031.93, 3001.42, 3001.54, 2951.26, 3005.94, 2920.04, 2920.37, 3006.57, 3023.99, 3054.03, 3085.11, 3095.15, 3037.5, 3096.93, 3088.37, 3075.88, 3056.15, 3152.36, 3241.74, 3303.17, 3261.78, 3310.51, 3316.37, 3298.26, 3350.96, 3402.11, 3395.94, 3304.06, 3292.46, 3239.14, 3279.67, 3365.19, 3381.56, 3381.25, 3423.27, 3480.01, 3439.88, 3404.48, 3362.97, 3352.59, 3341.48, 3213.65, 3258.75, 3270.22, 3311.21, 3224.07, 3355.09, 3367.29, 3362.61, 3349.86, 3396.7, 3302.7, 3342.66, 3393.54, 3443.33, 3481.43, 3494.32, 3459.35, 3470.31, 3453.87, 3425.14, 3457.02, 3499.07, 3512.33, 3456.47, 3538.99, 3442.74, 3391.79, 3364.4, 3442.63, 3510.47, 3563.51, 3612.23, 3663.67, 3641.85, 3629,

19

3670.9, 3696.58, 3638.19, 3699.95, 3681.73, 3649.56, 3720.83, 3669.81, 3703.99, 3768.79, 3773.72, 3787.18, 3758.07, 3837.18, 3811.64, 3777.09, 3807.89, 3791.13, 3870.72, 3860.45, 4001.91, 3917.64, 3796.8, 3861.75, 3903.5, 3777.81, 3821.35, 3848.1, 3931.45, 3903.53, 3779.8, 3781.91, 3839.64, 3831.14, 3738.37, 3863.26, 3810.13, 3861.96, 3805.23, 3873.78, 3854.35, 3911.2, 3971.74, 4025.12, 4068.08, 4090.93, 4037.86, 4094.28, 4158.2, 4149.16, 4128.33, 4138.55, 4162.98, 4085.36, 4121.51, 4103.74, 4178.46, 4202.96, 4158.54, 4273.8, 4274.93, 4352.79, 4358.66, 4156.76, 4200.33, 4164.82, 4316.72, 4252.56, 4334.14, 4374.48, 4497.19, 4506.93, 4546.96, 4556.37, 4619.19, 4554.61, 4641.64, 4492.94, 4575.37, 4468.5, 4498.02, 4580.2, 4685.29, 4666.56, 4414.32, 4359.44, 4419.23, 4334.51, 4444.17, 4404.21, 4325.84, 4419.31, 4508.83, 4510.74, 4607.52, 4604.78, 4435.16, 4543.72, 4497.18, 4351.72, 4354.53, 4299.8, 4436.44, 4569.67, 4448.21, 4460.08, 4433.92

2) Down Jones weekly opening prices variations (percentage values) between 8 January 1981 and 8 January 2008 (in chronological order) 375.53, 376.08, 378.81, 373.7, 376.32, 365.58, 368.85, 373.56, 361.17, 358.52, 369.51, 372.75, 381.94, 383.58, 389.42, 390.3, 390.98, 391.51, 394.56, 378.44, 378.02, 384.66, 380.38, 388.64, 384.79, 391.32, 385.8, 383.29, 370.3, 370.69, 371.37, 367.36, 371.18, 368.72, 371.14, 361.51, 351.51, 336.11, 339.19, 326.58, 315.46, 339.79, 343.01, 333.81, 332.03, 343.48, 342.87, 345.04, 343.77, 355.21, 357.75, 351.61, 351.46, 348.32, 348.22, 342.37, 329.46, 325.82, 335.89, 333.09, 324.68, 327.3, 323.56, 318.53, 311.55, 318.04, 321.84, 329.34, 332.57, 332.49, 338.51, 332.33, 341.85, 337.99, 327.7, 319.64, 314.28, 315.88, 306.16, 312.58, 310.66, 319.48, 321.36, 318.71, 311.91, 299.6, 306.33, 333.34, 341.7, 359.05, 353.1, 353.41, 357.06, 350.74, 383.33, 385.79, 398.15, 388.7, 409.82, 402.89, 399.16, 393.33, 404.65, 400.14, 399.63, 409.15, 409.86, 420.83, 425.71, 404.79, 418.04, 429.2, 428.08, 431.81, 439.43, 451.48, 443.19, 442.61, 450.84, 445.1, 446.8, 461.83, 468.06, 472.92, 481.1, 474.38, 465.79, 475.52, 479.17, 481.71, 492.55, 495.98, 486.19, 485.92, 475.76, 489.2, 473.6, 468.22, 472.78, 474.39, 467.71, 486.68, 497.09, 489.5, 501.42, 486.33, 505.43, 503.19, 496.51, 493.53, 493.13, 502.99, 505.49, 512.54, 506.87, 505.93, 496.59, 498.25, 503.08, 512.88, 505.91, 500.12, 490.32, 468.17, 456.86, 449.94, 456.94, 461.19, 448.75, 459.38, 452.06, 457.65, 442.89, 447.94, 452.58, 453.28, 455.38, 453.09, 440.55, 429.38, 441.31, 438.86, 423, 440.27, 439.29, 437.35, 432.59, 423.55, 432.04, 470.02, 469.93, 468.96, 474.78, 471.81, 463.92, 478.38, 471.63, 473.6, 466.31, 470.96, 485.01, 475.2, 482.46, 483.62, 471.94, 484.06, 473.68, 466.38, 473.6, 484.68, 486.83, 482.38, 492.6, 497.75, 515.61, 515.11, 524.48, 522.98, 518.32, 528.26, 515.61, 508.41, 509.65, 514.75, 511.36, 514.62, 512.58, 512.97, 507.12, 524.46, 534.31, 534.47, 544.35, 542.89, 536.56, 542.66, 551.05, 554.29, 557.76, 564.12, 556.94, 557.55, 545.6, 543.13, 548.88, 553.7, 551.24, 537.3, 537.86, 536.99, 537.95, 543.34, 552.59, 548.8, 562.46, 569.82, 579.17, 585.75, 588.65, 594.21, 615.11, 614.66, 615.03, 616.77, 602.21, 612.68, 620.25, 632.36, 645.42, 661.62, 675.46, 678.25, 674.39, 701.12, 700.08, 717.69, 681.17, 698.83, 718.46, 713.41, 691.85, 694.79, 685.2, 709.79, 721.65, 705.28, 718.82, 715.3, 724.33, 725.39, 701.75, 686.69, 696.4, 678.98, 688.84, 717.86, 730.4, 737.03, 731.74, 689.15, 699.7, 699.17, 707.15, 713.7, 720.98, 725.46, 742.1, 745.27, 736.24, 745.27, 749.91, 760.28, 745.45, 751.58, 747.33, 753.73, 777.61, 798.88, 807.67, 820.59, 840.53, 841.89, 856.55, 850.71, 863.04, 853.38, 877.59, 844.45, 893.43, 868.13, 854.7, 826.55, 846.49, 872.85, 853.41, 849.66, 867.32, 871.43, 902.13, 910.78, 912.87, 915.06, 918.27, 928.3, 925.4, 943.46, 959.45, 988.67, 988.77, 962.41, 930.72, 951.18, 924.36, 944.31, 964.18, 917.12, 778.96, 693.19, 730.16, 720.99, 725.26, 703.57, 688.77, 656.56, 686.58, 728.45, 720.99, 718.29, 718.69, 723.57, 710.39, 734.81, 712.44, 736.07, 751.96, 757.69, 767.37, 759.36, 777.76, 743.35, 749.85, 782.45, 744.51, 754.54, 755.12, 745.86, 740.95, 724.82, 731.46, 770.85, 784.44, 777.82, 799.42, 793.98, 789.28, 790.83, 767.86, 793.45, 790.34, 759.76, 758.06, 757.27, 770.1, 776.95, 782.51, 784.78, 794.92, 811.43, 802.66, 820.49, 807.55, 808.27, 789.91, 781.37, 787.48, 799.92, 816.88, 816.47, 824.73, 823.86, 835.51, 845.88, 854.38, 881.6, 889.48, 869.57, 888.16, 863.24, 870.77, 871.7, 862.97, 847.87, 874.21, 880.2, 890.21, 917.94, 920.86, 912.35, 932.71, 956.31, 956.65, 958.82, 954.78, 949.69, 971.09, 946.09, 969.58, 984.73, 1000.89, 1022.42, 1033.64, 1062.06, 1072.15, 1085.57, 1108.56, 1082.05, 1067.53, 1067.99, 1075.08, 1111.14, 995.69, 1021.83, 993.95, 1002.44, 1005.13, 1007.07, 1008.85, 1037.41, 1032.03, 1029.58, 1021.93, 1033.23, 1029.31, 1000.67, 1002.57, 964.21, 965.82, 979.93, 966.5, 958.72, 995.14, 995.83, 1011, 1012.23, 1004.17,

20

1008.16, 1027.45, 993.77, 975.35, 998.03, 1031.48, 1030.41, 1023.65, 1051.13, 1042.23, 1053.16, 1033.45, 1031.12, 1034.37, 1061.94, 1040.15, 1018.5, 954.71, 944.03, 919.9, 901.41, 896.24, 920.5, 888.49, 875.58, 865.55, 881.48, 854.15, 882.55, 862.09, 878.99, 875.44, 895.65, 876.8, 898.29, 909.12, 906.14, 923.74, 919.05, 898.95, 877.4, 935.17, 957, 979.8, 1015.2, 1037.95, 1044.01, 1045.35, 1042.13, 1030.11, 1011.83, 1031.69, 1033.23, 1044.01, 1054.64, 1045.26, 1050.47, 1055.2, 1035.65, 1044.74, 1083.99, 1073.21, 1080.71, 1047.24, 1036.74, 1040.88, 1061.11, 1070.84, 1062.3, 1073.11, 1066.98, 1018.31, 1079.7, 1081.38, 1062.66, 1060.75, 1069.7, 1068.75, 1061, 1073.56, 1111.29, 1088.94, 1103.25, 1102.05, 1072.73, 1049.78, 1040.64, 1056.7, 1064.65, 1064.19, 1128.88, 1159.22, 1150.17, 1179.35, 1164.71, 1154.37, 1161.53, 1173.44, 1188.4, 1179.72, 1163.74, 1163, 1178.98, 1158.57, 1157.42, 1155.25, 1186.88, 1173.02, 1183.88, 1200.78, 1193.14, 1195.79, 1195.23, 1200.35, 1179.16, 1154.9, 1149.13, 1180.02, 1172.21, 1158.86, 1153.38, 1188.66, 1162.17, 1157.67, 1132.12, 1138.01, 1147.17, 1172.94, 1165.59, 1144.59, 1121.54, 1110.94, 1131.41, 1152.26, 1162.97, 1172.94, 1164.7, 1164.38, 1191.63, 1195.62, 1191.37, 1206.12, 1208.12, 1207.38, 1201.66, 1214.15, 1208.75, 1228.01, 1275.47, 1259.93, 1229.59, 1253.42, 1267.49, 1268.17, 1268.91, 1277.78, 1262.29, 1288.02, 1320.41, 1282.66, 1282.56, 1281.25, 1278.27, 1285.97, 1298.85, 1302.83, 1285.97, 1273.58, 1279.29, 1288.68, 1284.34, 1295.94, 1312.68, 1318.99, 1321.52, 1324.82, 1336.5, 1351.98, 1342.71, 1341.17, 1337.6, 1326.4, 1330.74, 1328.98, 1338.21, 1343.8, 1364.5, 1347.59, 1360.93, 1351.22, 1362.41, 1367.68, 1373.99, 1377.02, 1384.54, 1379.82, 1398.36, 1412.76, 1415.19, 1437.76, 1405.57, 1407.97, 1399.45, 1383.58, 1381.3, 1379.41, 1377.84, 1353.88, 1272.68, 1305.29, 1293.87, 1293.52, 1314.99, 1285.37, 1264.51, 1299.67, 1306.85, 1315.39, 1306.44, 1308.22, 1266.27, 1276.49, 1292.36, 1299.99, 1297, 1301.81, 1306.51, 1310.1, 1296.57, 1336.92, 1333.38, 1316.21, 1321.12, 1282.29, 1287.84, 1265.6, 1299.27, 1295.33, 1314.01, 1277.9, 1270.78, 1270.53, 1241.36, 1251.79, 1224.86, 1256.6, 1272.22, 1273.28, 1291.21, 1313.26, 1294.02, 1305.08, 1319.39, 1328.51, 1339.82, 1354.64, 1336.6, 1345.26, 1358.45, 1374.05, 1386.86, 1399.48, 1414.95, 1413.88, 1436.9, 1425.61, 1452.69, 1429.67, 1438.36, 1458.46, 1456.56, 1487.51, 1511.35, 1505.26, 1561.64, 1566.5, 1551.9, 1575.98, 1569.77, 1543.92, 1559.47, 1560.23, 1572.64, 1599.83, 1618.16, 1602.09, 1617.47, 1605.26, 1615.08, 1603.14, 1600.09, 1634.46, 1640.73, 1668.51, 1687.5, 1707.01, 1718.76, 1701.84, 1684.11, 1689.45, 1711.42, 1661.55, 1686.71, 1706.6, 1732.24, 1791.72, 1764.29, 1811.68, 1794.89, 1759.8, 1817.39, 1843.13, 1820.05, 1815.53, 1794.57, 1824.29, 1815.47, 1799.74, 1813.35, 1868.5, 1885.64, 1837.13, 1854.78, 1836.99, 1854.08, 1847.37, 1808.39, 1786.07, 1743.77, 1741.94, 1806.11, 1805.76, 1815.3, 1825.47, 1782.36, 1806.04, 1851.62, 1859.75, 1855.51, 1890.22, 1879.07, 1913.94, 1902.71, 1907.65, 1968.12, 2005.12, 2037.99, 2047.77, 2026.31, 1996.8, 2036.18, 2061.44, 2048.01, 2086.31, 2122.09, 2096.21, 2112.33, 2118.61, 2157.87, 2133.18, 2111.07, 2174.88, 2148.03, 2125.82, 2094.1, 2068.24, 2022.77, 2114.8, 2114.2, 2219.72, 2241.57, 2245.46, 2277.58, 2288.81, 2316.95, 2381.65, 2387.2, 2371.4, 2437.06, 2442.11, 2432.28, 2494.19, 2516.11, 2483.42, 2411.7, 2460.95, 2406.9, 2471.84, 2474.59, 2556.42, 2529.92, 2586.82, 2593.35, 2551.73, 2503.25, 2471.06, 2496.53, 2490.12, 2546.05, 2568.46, 2642.45, 2583.9, 2549.43, 2536.25, 2619.29, 2476.13, 2583.19, 2564.94, 2638.97, 2688.75, 2773.66, 2738.51, 2746.66, 2790.46, 2827.85, 2851.38, 2840.34, 2928.5, 2891.3, 2960.65, 2861.58, 2914.62, 2881.67, 2866.99, 2880.21, 2822.51, 2860.66, 2806.71, 2813.88, 2870.51, 2897.68, 2920.11, 2947.59, 2821.32, 2783.97, 2698.52, 2642.73, 2686.12, 2559.58, 2492.14, 2510.08, 2497.08, 2585.95, 2490.13, 2520.06, 2648.83, 2649.32, 2707.75, 2786.1, 2758.24, 2845.58, 2871.67, 2830.94, 2733.11, 2792.97, 2868.96, 2874.43, 2985.13, 2907.12, 2838.14, 2911.51, 2882.32, 2853.62, 2876.62, 2875.7, 2989.07, 3018.35, 3030.32, 3006.11, 3015.4, 3050.46, 3191.65, 3228.16, 3269.48, 3335.19, 3294.39, 3283.63, 3214.05, 3271.56, 3187.44, 3269.97, 3202.3, 3316.59, 3324.08, 3313.98, 3255.5, 3187.69, 3182.43, 3212.56, 3239.92, 3243.91, 3236.7, 3207.13, 3138.9, 2989.94, 2998.87, 3107.71, 2937.84, 3021.07, 3130.4, 3101.23, 3131.27, 3138.64, 3102.87, 3165.39, 3123.93, 3141.92, 3176.7, 3215, 3243.88, 3271.21, 3179.85, 3035.69, 3087.98, 2946.94, 2896.29, 2780.19, 2907.95, 2789.33, 2989.78, 3090.85, 3069.93, 3131.98, 2979.38, 3108.99, 3110.61, 3082.67, 3107.28, 3082.68, 3011.71, 3121.45, 3086.27, 3032.83, 3011.79, 2991.28, 3073.04, 3148.37, 3117.8, 3068.77, 3175.19, 3242.53, 3242.24, 3245.34, 3254.11, 3295.83, 3252.24, 3180.2, 3175.39, 3132.22, 3054.48, 3068.15, 3133.4, 3235.11, 3198.42, 3239.77, 3205.49, 3153.91, 3241.41, 3152.68, 3252.32, 3318.1, 3219.07, 3156.75, 3166.02, 3226.4, 3286.47, 3292.93, 3286.33, 3199.85, 3210.64, 3245.1, 2993.33, 2911.22, 3059.69, 2994.95, 3104.54, 3209.12, 3270.81, 3281.18, 3257.62, 3374.29, 3308.73, 3295.54, 3261.76, 3139.19, 3119.24, 3144.04, 3097.32, 3178.54,

21

3172.09, 3126.13, 3160.53, 3109.81, 3057.6, 3109.16, 3008.74, 2920.68, 2490.37, 2599.21, 2687.74, 2720.21, 2671.15, 2720.73, 2670.21, 2755.03, 2826.59, 2847.03, 2807.07, 2877.13, 2810.4, 2867.82, 2913.3, 2978.08, 2895.65, 2849.23, 2886.31, 2889.32, 2818.2, 2853.36, 2868.78, 2991.68, 3081.87, 3068.59, 3038.55, 3045.6, 2986.46, 2993.64, 2998.34, 2911.09, 2940, 2887.95, 2962.49, 2942.24, 2891.05, 2788.24, 2774.3, 2757.23, 2743.09, 2724.86, 2518.06, 2325.47, 2353.14, 2366.1, 2497.01, 2503.31, 2553.1, 2472.42, 2415.34, 2376.28, 2282.21, 2236.02, 2169.97, 2193.76, 2285.22, 2344.93, 2376.39, 2378.87, 2391.19, 2435.23, 2457.21, 2413.38, 2381, 2406.99, 2359.63, 2443.44, 2488.97, 2431.43, 2293.81, 2278.16, 2223.03, 2214, 2238.35, 2200.26, 2179.02, 2191.57, 2382.23, 2293.2, 2326.96, 2314.34, 2382.86, 2392.98, 2472.33, 2477.64, 2497.08, 2494.54, 2563.56, 2597.16, 2604.99, 2625.32, 2575.33, 2588.43, 2616.05, 2626.01, 2651.97, 2619.85, 2623.62, 2659.74, 2666.92, 2695.07, 2733.24, 2729.58, 2781.4, 2691.95, 2773.46, 2799.8, 2811.7, 2785.37, 2843.43, 2856.63, 2833.56, 2783.22, 2838.15, 2854.06, 2904.05, 2956.52, 2972.94, 2993.44, 2997.33, 3031.79, 3045.48, 2984.4, 2997.37, 3012.02, 3005.3, 3016.29, 3021.35, 2943.78, 2924.5, 2938.7, 3023.2, 3004.54, 2996.25, 3016.09, 2946.22, 2905.38, 2884.45, 2880.61, 2959.85, 2974.39, 3008.18, 3030.42, 3054.03, 3031.93, 3001.42, 3001.54, 2951.26, 3005.94, 2920.04, 2920.37, 3006.57, 3023.99, 3054.03, 3085.11, 3095.15, 3037.5, 3096.93, 3088.37, 3075.88, 3056.15, 3152.36, 3241.74, 3303.17, 3261.78, 3310.51, 3316.37, 3298.26, 3350.96, 3402.11, 3395.94, 3304.06, 3292.46, 3239.14, 3279.67, 3365.19, 3381.56, 3381.25, 3423.27, 3480.01, 3439.88, 3404.48, 3362.97, 3352.59, 3341.48, 3213.65, 3258.75, 3270.22, 3311.21, 3224.07, 3355.09, 3367.29, 3362.61, 3349.86, 3396.7, 3302.7, 3342.66, 3393.54, 3443.33, 3481.43, 3494.32, 3459.35, 3470.31, 3453.87, 3425.14, 3457.02, 3499.07, 3512.33, 3456.47, 3538.99, 3442.74, 3391.79, 3364.4, 3442.63, 3510.47, 3563.51, 3612.23, 3663.67, 3641.85, 3629, 3670.9, 3696.58, 3638.19, 3699.95, 3681.73, 3649.56, 3720.83, 3669.81, 3703.99, 3768.79, 3773.72, 3787.18, 3758.07, 3837.18, 3811.64, 3777.09, 3807.89, 3791.13, 3870.72, 3860.45, 4001.91, 3917.64, 3796.8, 3861.75, 3903.5, 3777.81, 3821.35, 3848.1, 3931.45, 3903.53, 3779.8, 3781.91, 3839.64, 3831.14, 3738.37, 3863.26, 3810.13, 3861.96, 3805.23, 3873.78, 3854.35, 3911.2, 3971.74, 4025.12, 4068.08, 4090.93, 4037.86, 4094.28, 4158.2, 4149.16, 4128.33, 4138.55, 4162.98, 4085.36, 4121.51, 4103.74, 4178.46, 4202.96, 4158.54, 4273.8, 4274.93, 4352.79, 4358.66, 4156.76, 4200.33, 4164.82, 4316.72, 4252.56, 4334.14, 4374.48, 4497.19, 4506.93, 4546.96, 4556.37, 4619.19, 4554.61, 4641.64, 4492.94, 4575.37, 4468.5, 4498.02, 4580.2, 4685.29, 4666.56, 4414.32, 4359.44, 4419.23, 4334.51, 4444.17, 4404.21, 4325.84, 4419.31, 4508.83, 4510.74, 4607.52, 4604.78, 4435.16, 4543.72, 4497.18, 4351.72, 4354.53, 4299.8, 4436.44, 4569.67, 4448.21, 4460.08, 4433.92

3) First example simulation price variations per time tick (percentage values) 0.0214995, -0.0272182, 0.0221232, 0.0348301, -0.046853, 0.00850722, -0.00139035, 0.0152384, -0.00233968, -0.0124429, 0.0218935, -0.0139634, 0.00673193, -0.0141064, 0.0116976, -0.00802627, 0.00774684, 0.00582421, 0.00790895, -0.0225202, 0.0306469, 0.00565189, -0.00520663, -0.00163761, -0.013663, 0.00518246, -0.0258027, -0.00233174, 0.0226086, -0.000155681, -0.00820681, 0.000277005, 0.000937656, -0.0295406, 0.0121699, -0.0022742, 0.0419092, -0.0112718, -0.00258967, 0.00833287, -0.0102825, -0.00748946, 0.0136389, -0.0143242, -0.0242991, 0.0133298, -0.0189625, 0.0155205, -0.000162244, 0.0177649, -0.00385638, -0.00303704, -0.0139495, 0.0144118, -0.0353038, 0.0320492, 0.0142076, -0.023735, 0.00677287, -0.00169207, -0.0185323, 0.0475381, -0.017738, 0.0190735, 0.00019331, -0.0104062, -0.011431, -0.00707543, 0.0122444, -0.0246221, 0.0351006, -0.0126304, 0.0293289, -0.0243394, 0.00732083, -0.022007, -0.00649741, 0.00963632, 0.010192, -0.00762205, 0.0272922, -0.0170144, -0.00501289, -0.0092565, 0.0111325, 0.00228816, 0.0000831217, -0.028916, -0.00465729, 0.0292277, -0.0151704, 0.00641907, 0.0114009, -0.00487898, 0.0103912, -0.0503335, 0.00153126, -0.0123584, 0.0273803, 0.00980822, 0.0432737, -0.0242951, 0.00545451, -0.0133233, -0.000744161, -0.0205533, 0.00575059, -0.0111947, -0.0248568, 0.0306418, 0.0286466, -0.019453, 0.00330508, -0.00922633, 0.0115038, 0.0127364, 0.00768512, -0.0121639, 0.00568497, -0.057937, 0.0598747, -0.00463656, 0.012434, -0.0138377, 0.0018331, -0.000383175, 0.0193449, -0.00154389, 0.00955344, -0.0193196, 0.00241999, -0.0142413, 0.000111979, -0.0110488, 0.015738, -0.00416864, -0.00216804, -0.00644453, 0.0353008, -0.0409236, 0.00882884, 0.0171372, -0.00982856, -0.00790504, 0.0306566, -0.00371934, 0.00994237, 0.0000991154, -0.0145749, 0.00732269, -0.000691968, -0.0162401,

22

-0.00909157, 0.00617545, -0.0207928, 0.0378503, -0.030997, 0.0114519, -0.00647645, 0.00582283, -0.013743, 0.00688925, -0.00182578, 0.00296025, 0.00351451, -0.0182091, 0.0208755, -0.00400526, 0.0347918, -0.0434937, 0.0159222, 0.00390121, -0.00215668, 0.0129796, -0.0296528, -0.00540855, 0.0250263, -0.0042539, 0.0119234, -0.0229504, 0.000760711, 0.00565726, 0.0104467, -0.0204803, 0.00225987, 0.00375682, 0.0226377, -0.0138118, 0.000951436, 0.00473217, -0.00487602, 0.00591788, 0.0233481, -0.00392123, 0.00106236, 0.00510397, -0.0220821, 0.00361513, -0.0108021, 0.0161691, -0.0277559, 0.0131277, 0.0270612, -0.016101, -0.0232177, 0.00279958, 0.00731996, -0.00988754, 0.0249438, -0.0067172, 0.0520396, -0.0527492, 0.0356966, -0.0120296, -0.0258834, 0.0265306, -0.0249588, 0.016187, -0.0138893, -0.00311826, 0.0262969, -0.0317338, 0.017625, -0.0418742, 0.0295919, 0.0102094, -0.00742301, -0.000867044, 0.0146478, -0.0109056, 0.00834133, -0.025189, 0.00103082, 0.0120351, -0.023852, 0.00173054, 0.0113234, -0.0270455, 0.0264554, -0.0100937, 0.0148325, -0.0013302, -0.0121196, 0.0360959, -0.00256043, 0.0131973, -0.0102488, 0.0144235, -0.0246389, -0.0218053, 0.0304639, -0.0355966, 0.033503, -0.0137132, 0.0389892, -0.0477323, 0.0323759, -0.00276669, 0.00184268, -0.0243258, 0.0152942, -0.0206711, 0.00285129, 0.0157487, 0.0110522, -0.00894624, 0.0222292, -0.0136232, 0.00767827, -0.0245147, 0.0224741, -0.00071167, -0.0100578, 0.00114585, -0.0179419, 0.0147474, -0.0108567, 0.0229909, -0.00322393, 0.0103871, -0.0430421, 0.0302333, 0.0217532, -0.0196531, 0.018426, -0.0287311, 0.0143554, -0.030899, 0.0304144, -0.0193945, 0.0188482, 0.00153563, -0.0173119, 0.0130178, -0.0197368, 0.0148242, -0.00656474, -0.00280053, -0.0053413, 0.0230789, 0.00458014, -0.00365444, -0.0144096, 0.017844, -0.016576, 0.0184523, -0.0328632, 0.0371885, -0.00331564, -0.0104343, -0.0180686, -0.00998027, 0.00738017, 0.0113562, -0.0102266, 0.00799395, -0.0171411, 0.00988521, 0.00513883, 0.005347, -0.0113767, 0.00615166, -0.00867868, 0.0366737, -0.0233983, 0.01102, 0.0205774, 0.00143376, -0.0227139, 0.00483313, -0.0162487, -0.0048022, 0.0152301, -0.00668749, 0.0228956, -0.0153704, 0.0235662, -0.046771, 0.0225563, -0.00306698, -0.008296, 0.029563, -0.0258495, 0.0236935, -0.00788367, 0.0421478, -0.0187357, 0.00830153, 0.00525256, -0.0303341, 0.00755364, -0.00381332, 0.0169587, -0.0127001, -0.0123952, 0.00849094, 0.00253759, 0.0209301, -0.0193778, 0.0015985, -0.0164293, 0.0136181, 0.00766457, -0.0136967, 0.000845418, 0.00133916, 0.00250657, -0.00392616, -0.0135233, 0.00589005, -0.00704509, 0.00978062, 0.010987, 0.00279664, 0.0014527, -0.0230465, 0.0193761, 0.00283508, -0.0176476, 0.0105283, 0.00541056, 0.00646636, -0.0386193, 0.00649773, 0.00647691, 0.00729487, 0.00540604, -0.0369262, 0.0178681, -0.0170707, 0.011545, -0.0123024, 0.0145366, 0.00300992, 0.0177433, -0.0159832, 0.0134334, -0.0249561, 0.0295316, -0.0201108, 0.0217542, 0.00741154, -0.0239765, 0.000249895, 0.0130726, -0.0168519, 0.0309455, 0.00728462, 0.0185827, -0.0261487, 0.00241865, -0.00677681, -0.00787119, 0.0371941, -0.0371007, -0.00803489, 0.0170303, -0.0123105, 0.0134866, 0.00240881, -0.0196633, 0.000658612, -0.0373879, 0.0202012, -0.00844557, 0.0309392, 0.00628112, -0.0303427, 0.0010904, 0.00583195, 0.00554228, -0.0111513, 0.0228519, -0.00118177, 0.0114314, -0.033685, 0.0271864, -0.0328844, -0.00123519, 0.0221276, -0.00966693, 0.0272265, -0.0349587, 0.0420799, -0.049951, 0.00951219, 0.00649215, 0.0311488, 0.00387592, -0.0431597, 0.0287504, 0.000837101, -0.0322448, 0.0120465, 0.00464642, 0.0353343, -0.00651046, 0.0224702, -0.0174177, 0.0104331, -0.041147, 0.00648638, 0.00583889, 0.000582175, -0.00396038, -0.00456725, 0.0291029, -0.0195729, 0.0222329, -0.0231185, 0.0143627, -0.0139738, 0.00709717, 0.00269367, -0.0118624, 0.0055198, -0.0095258, 0.00883731, -0.0337019, 0.0346022, 0.00204252, -0.00296062, -0.018589, 0.0226185, 0.0130317, -0.0107975, -0.000745462, -0.00497802, 0.0298105, -0.0304383, 0.0304106, -0.00621639, -0.0262637, 0.00953058, 0.0268023, -0.0166867, -0.0150189, 0.00570867, 0.00877254, -0.00922783, 0.00591281, -0.0263288, 0.000548757, -0.00064295, 0.0182102, 0.00502654, -0.00263862, -0.0137105, 0.0255866, -0.0211244, 0.0344184, -0.0196042, 0.00384681, -0.00299005, 0.0266797, -0.0308647, -0.0104155, -0.0105921, 0.0454216, -0.0298578, 0.0300534, -0.0323218, 0.00629905, -0.0248919, 0.0385475, 0.0138737, -0.0205223, 0.00941908, -0.0244874, -0.0243631, 0.0232612, -0.000886066, 0.0222762, -0.0034258, -0.0123429, 0.00166118, -0.0456125, 0.0104653, -0.0020081, 0.0367598, -0.00614376, 0.0287458, -0.00956004, -0.0124909, 0.0283183, -0.0229037, 0.0169981, -0.0230171, -0.00359912, 0.0194082, 0.00145218, -0.0175858, 0.0137614, -0.00732045, 0.0152236, 0.0101927, 0.00611539, -0.0243731, 0.0153846, -0.00687801, 0.0381834, -0.00909287, 0.00724952, -0.0404898, -0.00265909, 0.00131783,

23

0.00477213, 0.00157657, -0.0158486, -0.0117463, 0.00538103, -0.00847792, 0.0219307, -0.000789904, 0.0168026, -0.0146851, 0.02408, -0.00423407, 0.000938985, -0.00873879, -0.00641615, -0.00401278, 0.00846001, -0.0355182, 0.00777181, -0.00949936, 0.0193912, 0.00135256, -0.00113974, 0.000241234, 0.0108504, 0.0190191, -0.00620622, -0.0155948, 0.0133406, -0.0150682, 0.0389879, -0.00664519, -0.00449091, 0.0054813, 0.00565915, -0.0359582, 0.0231082, -0.00203465, 0.00830231, -0.0313291, 0.0113549, 0.00137529, -0.0239833, -0.0113283, 0.0340319, 0.0342741, -0.0224579, -0.00746158, -0.0146479, 0.0122428, 0.000465063, -0.0256074, 0.0260956, -0.0123062, 0.0126061, 0.0120317, -0.0393103, 0.0144487, 0.00102689, 0.00663041, -0.0397641, 0.0301173, -0.00300836, 0.00678183, -0.0113133, 0.0174573, -0.0154907, 0.0159546, -0.0357644, 0.0528679, -0.0224178, -0.00131077, 0.0213194, -0.022799, 0.00685384, 0.0000553242, 0.00285945, 0.0321069, -0.014869, 0.0251521, -0.023138, -0.00594209, 0.0140878, -0.00735401, -0.0367393, 0.0290401, -0.00865456, 0.0269022, -0.0259936, 0.00278019, 0.0020525, 0.00607629, -0.0332919, 0.0125573, -0.0184594, 0.00343883, -0.0065193, 0.0240513, -0.015412, 0.000406152, 0.00774439, 0.000888391, 0.00916669, 0.00986251, -0.0181497, 0.0270659, -0.0239426, 0.0401225, -0.0202842, -0.0184759, 0.0348409, -0.0135545, -0.0087682, 0.0070738, -0.0411382, 0.0155138, -0.00314167, 0.0236099, -0.014174, 0.0292894, -0.0394382, 0.006428, 0.0215229, -0.0150397, -0.0068826, 0.0357525, 0.00244604, -0.0115533, -0.0156554, 0.010693, 0.00998791, -0.0176284, 0.0442754, -0.0122036, 0.0166238, -0.0418629, 0.000187384, -0.00240184, 0.0112068, 0.0131679, -0.00529502, -0.0110957, 0.0214208, -0.00300747, -0.0290327, 0.0370679, -0.00873547, -0.00267793, 0.0272717, -0.0425795, -0.00217317, 0.0252263, -0.0286815, -0.000140417, 0.00275449, 0.00301332, -0.0000574348, 0.00129784, 0.0147148, -0.0203049, 0.00338432, 0.00473238, -0.00315981, 0.025006, -0.000532876, 0.0079013, -0.00920706, -0.00431927, -0.0100954, 0.000804748, -0.0272731, -0.00114737, 0.0352886, -0.0188628, 0.0277251, -0.0521131, 0.0201209, 0.0109407, -0.043484, 0.0374441, -0.010559, 0.010003, -0.0213149, 0.0244794, 0.0152114, -0.00693648, -0.0132977, 0.0231193, -0.0246943, 0.0408303, -0.0599554, 0.0130163, 0.0118604, 0.00254809, -0.0203994, 0.0200271, 0.00973011, -0.0209108, 0.0292865, -0.00623959, 0.0171641, -0.00304807, -0.011048, 0.00903497, -0.0127355, -0.0168949, -0.006127, -0.00263084, -0.0028502, 0.0338576, 0.00890691, 0.00761328, -0.0279906, 0.0260641, -0.0384691, -0.0000960434, 0.018568, 0.0072398, -0.0260374, 0.00613689, 0.0192767, -0.0192071, 0.0427064, 0.00166753, -0.00721942, -0.0102241, -0.00736108, 0.00237073, -0.0269763, 0.0222169, -0.0457892, 0.00958696, 0.0108932, -0.000319006, 0.0247073, 0.00664363, 0.0060915, -0.0275333, 0.0273744, 0.00716932, -0.0137372, 0.0112297, -0.0117481, -0.00713855, 0.0203029, 0.00782366, -0.0264463, 0.0287129, -0.0474952, 0.0275034, -0.00257183, 0.0280906, -0.0173321, -0.0204277, -0.00884346, 0.0287223, 0.012676, -0.0231098, 0.0213702, -0.0228675, -0.0117973, -0.00362853, 0.00366103, -0.00396829, -0.0110014, 0.0255512, -0.000176381, -0.00823903, 0.0186737, 0.00238001, -0.0256321, 0.00497408, 0.0235111, -0.0127383, 0.0231998, -0.019329, 0.0233937, -0.0165326, -0.0257337, 0.0242095, -0.0179453, 0.00541075, 0.0117103, -0.00978138, 0.0379151, -0.0322353, -0.00773747, 0.00905168, 0.0256813, -0.00120133, 0.0165452, -0.0183586, 0.00535339, -0.012988, -0.0070968, -0.0173384, 0.00822754, 0.0316758, -0.0386739, 0.0124936, 0.0014037, -0.00700952, 0.0117244, 0.00235755, -0.0105657, -0.0183148, 0.0147962, 0.0108304, -0.0176976, 0.0201372, -0.0145827, -0.000464067, 0.00204257, 0.0176238, -0.00752157, 0.0146474, -0.019385, -0.0105565, 0.0149513, -0.00855959, -0.00430452, -0.000274595, 0.002068, -0.00418121, 0.0221669, -0.0311481, 0.0182176, -0.0230962, 0.0258448, -0.00510766, 0.0224663, -0.017257, 0.0139945, -0.0124855, -0.013773, 0.00400804, -0.0171963, -0.00165423, -0.0177483, 0.00963486, -0.003246, -0.00251495, 0.0182865, 0.0129942, 0.0123808, -0.0376628, 0.0469805, -0.00633233, 0.017146, -0.013159, -0.020239, 0.0125827, -0.0292848, 0.018997, 0.00470598, 0.0173481, -0.0262957, 0.0394561, -0.0212989, -0.0139893, 0.0104759, -0.0269088, 0.0239033, 0.0103264, -0.0155529, -0.0168303, 0.0111683, 0.00967887, -0.0262792, 0.0372327, -0.0287045, 0.0168325, 0.0159217, -0.0419769, 0.0139475, -0.00871533, -0.00940683, 0.0628212, -0.0117921, -0.00920367, -0.0128204, 0.017188, -0.023333, 0.0516267, -0.0136127, 0.0090655, -0.00595426, -0.0181031, -0.00115681, 0.0150877, -0.0168824, 0.00514018, -0.00371733, -0.00247544, 0.011435, -0.0198683, 0.0167258, 0.00755848, -0.0357571, 0.00666777, 0.00835366, -0.0112097, -0.0155571, 0.0138184, -0.00540188, 0.00079277, 0.0260457, -0.00342409, 0.0367525, 0.00325387, -0.00899095, -0.00188983, -0.0174164, -0.00579611, 0.0306339, -0.0129557, 0.0165615, -0.0166899, 0.00741263, -0.0044107,

24

-0.0060843, -0.00915009, 0.00441946, -0.0102472, 0.0115301, 0.00159275, -0.0288994, 0.0165053, 0.0115628, -0.00683845, -0.0163797, 0.0441561, -0.0431748, -0.00938419, 0.0579695, -0.0208958, 0.00920386, -0.0160616, -0.0121491, 0.00978738, -0.0100835, 0.0164088, -0.0149974, 0.00193194, 0.00451632, -0.00639038, -0.0155314, 0.0208675, -0.0234936, 0.0189247, -0.0043959, -0.00407639, 0.0217691, -0.0203308, 0.00648311, -0.00736506, 0.0214515, -0.0204499, -0.00632445, 0.00672251, 0.0137592, 0.00336601, -0.0161621, 0.027148, -0.0236026, 0.0130854, -0.0171693, 0.00388563, 0.00295515, -0.0318995, 0.00260488, -0.00482888, 0.0219056, -0.00249246, -0.00426257, 0.0093375, 0.00173205, -0.0396764, 0.0146679, -0.00289155, 0.00470867, -0.0245236, 0.0273563, -0.0245957, 0.0132362, 0.0368471, 0.0178938, -0.0177344, 0.0172013, -0.00787623, 0.0213215, -0.00985409, 0.000108776, -0.0267407, 0.00942324, 0.0251606, -0.00616735, -0.0157095, 0.0279598, -0.0237662, 0.00580043, 0.0179849, -0.0239589, 0.0194962, -0.0328675, 0.00299484, 0.00191261, -0.0253711, 0.01834, -0.0103744, 0.00400246, 0.0142342, 0.0227638, -0.0139189, -0.0194998, 0.0187371, -0.031269, 0.029226, -0.00191492, 0.0176029, 0.0035393, -0.0188373, 0.0108087, -0.00282272, 0.00122284, 0.0129239, -0.0329832, -0.00381628, 0.0332275, -0.0164743, 0.0328826, -0.0216368, 0.0293563, -0.0165484, 0.00479689, -0.0257654, 0.0204238, -0.0271056, 0.0184988, 0.00421665, -0.0142696, -0.0215011, 0.0301216, -0.017522, 0.0241122, -0.0197336, -0.00621824, 0.0131675, -0.0028107, 0.0144145, -0.0268152, 0.0110561, -0.0166747, 0.012, 0.00077976, -0.00838481, 0.0214058, -0.0320151, 0.00175961, -0.0154208, 0.029031, -0.000512126, 0.0207799, -0.0332232, 0.0150017, 0.0166194, 0.00541629, -0.0353462, 0.0142189, 0.02496, -0.0198652, 0.0133858, -0.0217686, -0.010973, 0.0593339, -0.0350209, 0.00908277, -0.0148931, -0.00415369, -0.0223379, 0.0244824, -0.00232038, 0.00938559, -0.00527073, -0.0124608, 0.00724143, 0.0144237, -0.0318317, 0.00205679, 0.00644735, 0.00951138, 0.00547656, -0.00702914, -0.0172409, 0.0310598, -0.0262266, -0.00896481, 0.0650574, -0.0333501, -0.00780761, 0.0149216, 0.00176801, -0.0249896, 0.0387814, -0.0080484, -0.00185933, -0.00176756, 0.0100854, -0.00762917, -0.0196259, -0.00399948, 0.00304138, 0.00288787, 0.0245466, -0.00328865, -0.00552771, -0.00236956, 0.00740068, -0.0279805, 0.00800592, 0.00883395, 0.0168266, -0.0114901, -0.00353854, -0.000380823, 0.0363043, -0.00870403, 0.00383072, -0.00732617, -0.0243702, 0.0144272, -0.0172559, 0.025644, -0.0127164, 0.0300028, -0.0169087, 0.0167716, -0.0115609, 0.00306692, 0.00703233, -0.0188363, -0.00919542, -0.00468645, -0.00166712, 0.0360462, -0.0144471, 0.00419025, -0.0235528, 0.00639276, -0.0137814, 0.0125323, -0.0146515, 0.0373197, -0.0439917, 0.0163015, -0.0309066, 0.015363, 0.00189395, 0.0106844, 0.00611958, -0.0182242, 0.00849821, -0.00436762, 0.0360739, -0.0528901, 0.0211012, -0.0108477, 0.0512401, -0.0232437, 0.0280142, -0.0181341, 0.000189506, -0.0145506, 0.00375731, 0.0153164, -0.00573401, -0.000959136, 0.0243323, -0.0453924, -0.000384679, 0.00632188, 0.00632204, -0.0218681, 0.0164794, -0.00045936, 0.0225554, -0.0269522, 0.00368439, -0.0201934, 0.00353153, 0.0302381, -0.0227541, 0.0016008, 0.00844236, -0.00357178, -0.0169517, 0.0124221, 0.0112544, -0.0274938, 0.0507274, -0.0131491, 0.0196046, -0.0133077, 0.014394, -0.00628836, -0.0265997, 0.0158652, -0.0137382, 0.00892741, 0.0150431, -0.00396933, 0.0185114, 0.0148454, -0.0208541, 0.0193918, -0.0483514, -0.0054508, 0.000874471, -0.0217218, -0.00820317, -0.00770281, 0.0191641, 0.00309581, 0.0337042, 0.00371277, -0.0001962, 0.0138656, -0.0328789, -0.000991237, 0.00230474, -0.0550402, 0.0203731, 0.00845808, -0.0079499, 0.0577664, -0.0161224, 0.0107653, -0.0182734, -0.000707996, 0.00683833, -0.0124034, 0.00293215, 0.01748, 0.000101959, 0.0114866, -0.0139793, 0.0339233, -0.0141198, -0.00112777, -0.00149689, -0.012027, 0.0133114, 0.0116006, -0.0206343, 0.0176652, -0.0391379, 0.0191301, -0.036235, 0.0218803, -0.0209022, 0.0477912, 0.00608366, -0.0492101, 0.0314403, -0.0318481, 0.0367351, 0.0160658, -0.0337352, 0.010278, -0.0210083, 0.0496674, -0.0141234, -0.00945994, 0.0397443, -0.00534093, 0.00680708, -0.0194485, -0.0027929, 0.00323485, -0.0196371, 0.0156902, -0.0163663, 0.0018541, -0.0127601, -0.00886909, 0.0290925, -0.0017974, -0.00429425, 0.00729003, -0.0165219, -0.0205321, 0.00249415, -0.00808694, 0.0369979, -0.0197893, 0.015826, -0.00474971, 0.00020021, 0.0195017, -0.0261815, 0.00907142, 0.00281163, -0.0235635, 0.0257712, -0.00107184, 0.0143095, 0.00749228, -0.0128198, 0.00483069, -0.016805, 0.023874, -0.0158521, 0.0111906, -0.0289207, 0.0106957, -0.00576668, -0.00857789, 0.0253477, -0.00537807, -0.00967362, 0.0362623, -0.0000288746, 0.0043809, -0.0308932, 0.0110359, -0.0145991, 0.00916827, 0.0110211, -0.0239484, 0.0337028, -0.0222753, 0.00638687,

25

0.00349585, -0.00397866, -0.00146035, 0.00142437, -0.00834872, 0.0198574, -0.0338926, 0.0148325, 0.00160062, -0.0322693, 0.0161854

4) First simulation prices per time tick 376.08, 378.486, 378.103, 380.844, 383.988, 384.874, 384.372, 385.429, 385.52, 380.689, 382.849, 382.602, 386.097, 388.355, 387.91, 387.557, 387.524, 390.455, 387.883, 389.694, 391.328, 390.652, 389.791, 393.76, 393.05, 391.404, 391.13, 393.736, 389.308, 392.98, 390.833, 391.042, 390.661, 390.99, 389.171, 390.392, 387.395, 390.522, 393.18, 394.603, 392.126, 393.677, 391.228, 391.437, 386.316, 388.383, 391.141, 388.834, 391.548, 390.588, 392.567, 392.762, 387.243, 388.475, 391.407, 390.066, 391.64, 386.201, 389.339, 389.078, 393.644, 393.349, 392.005, 396.413, 392.061, 396.792, 395.173, 396.536, 396.667, 387.886, 391.584, 395.179, 394.057, 395.854, 397.31, 396.528, 393.035, 398.393, 398.389, 397.937, 395.756, 396.08, 392.004, 391.88, 391.695, 394.124, 395.417, 397.446, 388.536, 390.447, 385.308, 387.974, 390.862, 389.539, 389.317, 390.093, 390.358, 392.212, 388.755, 391.498, 390.462, 388.429, 389.454, 390.747, 389.858, 388.091, 391.092, 387.529, 389.807, 385.043, 385.992, 387.293, 387.877, 385.656, 387.776, 387.791, 383.973, 385.449, 384.805, 388.565, 388.328, 386.727, 388.511, 383.583, 385.636, 384.677, 385.725, 387.427, 388.52, 383.03, 384.047, 385.846, 386.176, 381.517, 385.275, 382.305, 382.715, 383.909, 376.514, 381.828, 384.366, 384.855, 384.718, 386.596, 383.169, 384.87, 382.691, 383.81, 380.85, 382.832, 384.419, 385.764, 385.016, 385.394, 384.28, 382.859, 382.523, 386.326, 386.559, 386.651, 386.158, 389.433, 385.479, 388.064, 388.383, 388.993, 384.319, 386.475, 387.974, 387.358, 388.849, 387.03, 386.727, 385.278, 391.316, 386.331, 388.648, 384.638, 384.847, 385.304, 384.538, 386.216, 386.331, 378.701, 382.276, 384.307, 385.853, 387.199, 388.327, 383.822, 389.019, 389.834, 387.987, 387.889, 390.296, 391.389, 392.269, 385.966, 386.163, 385.014, 384.955, 388.038, 385.362, 386.484, 383.562, 385.542, 385.016, 386.237, 386.224, 381.033, 384.271, 383.675, 387.682, 388.924, 386.308, 390.542, 384.689, 385.367, 383.8, 384.8, 382.925, 385.269, 383.122, 383.63, 384.507, 380.223, 383.175, 380.333, 382.017, 381.207, 382.063, 378.916, 379.816, 382.359, 381.427, 385.275, 381.879, 384.625, 384.647, 383.81, 383.221, 382.122, 381.7, 382.924, 382.981, 381.61, 382.712, 383.656, 379.865, 381.221, 381.136, 381.155, 381.535, 376.605, 378.395, 380.153, 380.401, 379.584, 379.749, 378.863, 385.968, 383.551, 384.402, 383.654, 384.515, 382.283, 380.149, 379.7, 383.534, 379.977, 380.302, 381.686, 378.077, 379.432, 379.052, 381.614, 380.791, 381.745, 382.77, 382.022, 384.732, 382.806, 383., 382.159, 384.307, 382.31, 385.472, 385.51, 385.621, 385.35, 382.272, 381.986, 385.196, 380.691, 380.337, 378.327, 377.821, 381.736, 378.725, 379.846, 376.336, 379.096, 375.823, 377.2, 376.765, 375.89, 375.212, 373.795, 374.4, 373.976, 380.373, 378.323, 377.981, 379.475, 379.052, 380.951, 378.476, 376.562, 381.123, 377.416, 378.005, 376.877, 381.431, 375.048, 375.191, 376.691, 376.852, 378.782, 379.75, 379.85, 379.767, 381.597, 381.629, 377.771, 378.415, 380.024, 379.177, 378.802, 378.087, 378.192, 379.877, 379.713, 382.687, 382.118, 383.003, 379.816, 377.875, 380.048, 380.976, 376.055, 380.94, 379.457, 382.288, 380.688, 383.115, 374.782, 377.35, 381.297, 381.007, 381.771, 380.843, 381.244, 383.835, 384.189, 381.467, 380.641, 379.425, 378.535, 379.698, 378.08, 378.055, 380.754, 381.056, 382.33, 381.159, 387.178, 380.618, 382.046, 376.327, 380.9, 377.85, 378.822, 377.925, 381.215, 378.629, 378.466, 380.78, 379.174, 381.351, 381.551, 382.586, 378.589, 378.745, 379.414, 377.958, 379.1, 379.246, 376.012, 375.079, 377.25, 377.308, 375.061, 376.888, 377.786, 378.164, 375.551, 376.379, 374.725, 375.78, 378.546, 378.085, 379.179, 380.502, 380.141, 382.33, 382.516, 381.561, 384.317, 383.014, 384.488, 383.439, 387.813, 385.831, 384.559, 387.245, 385.4, 382.679, 382.896, 383.147, 382.836, 383.991, 382.163, 387.228, 382.277, 383.146, 383.72, 377.996, 382.739, 379.554, 379.788, 378.572, 377.742, 381.125, 379.596, 383.356, 381.132, 379.267, 377.784, 378.423, 378.432, 377.847, 380.989, 380.547, 381.001, 378.403, 377.898, 377.716, 380.338, 380.299, 382.355, 376.758, 378.605, 379.053, 376.405, 376.097, 378.133, 378.128, 382.61, 379.644, 379.433, 378.464, 375.591, 374.559, 376.142, 373.134, 372.437, 373.877, 370.85, 375.57, 376.551, 374.672, 375.707, 375.679, 378.628, 375.112, 378.986, 377.887, 380.072, 377.753, 378.098, 378.3, 379.446, 379.588, 379.63, 377.918, 379.401, 378.354, 377.647, 378.935, 378.094, 379.889, 377.649, 377.438, 379.009, 378.259, 380.658, 379.447, 382.192, 381.723, 382.493, 379.452, 379.48, 377.878, 378.856, 380.389, 376.908, 377.608, 379.842, 380.781, 378.338, 378.733, 377.451, 376.544, 377.661, 377.652, 379.284, 378.847, 382.324, 380.223, 380.563, 378.108, 377.748, 379.618, 379.081, 379.466, 381.291, 378.045, 377.68,

26

379.575, 378.737, 378.726, 379.281, 377.853, 376.35, 376.377, 376.161, 375.619, 377.787, 376.343, 377.28, 375.921, 378.675, 376.601, 379.759, 379.875, 376.888, 374.66, 377.03, 373.077, 374.43, 373.203, 375.175, 371.263, 371.805, 372.093, 373.413, 371.525, 372.538, 374.78, 375.025, 374.284, 376.336, 375.043, 378.003, 376.5, 378.556, 374.326, 379.288, 378.166, 378.692, 378.169, 379.288, 378.292, 377.066, 379.84, 376.182, 376.697, 376.942, 370.945, 374.994, 375.223, 376.76, 378.83, 379.73, 380.16, 381.115, 379.961, 381.823, 379.31, 382.864, 379.11, 383.902, 381.178, 382.302, 376.239, 378.12, 376.509, 377.99, 375.449, 377.922, 380.163, 378.924, 381.369, 379.08, 379.075, 382.107, 379.142, 381.347, 378.824, 378.483, 379.16, 377.636, 382.11, 379.786, 382.587, 368.089, 375.131, 375.462, 374.836, 376.027, 374.226, 376.245, 377.983, 375.537, 378.956, 380.72, 379.998, 381.841, 382.921, 381.271, 382.679, 382.318, 379.276, 380.428, 378.881, 378.483, 376.827, 379.398, 375.753, 379.107, 380.188, 377.468, 379.991, 379.09, 380.934, 379.696, 381.683, 376.967, 377.266, 377.961, 380.334, 381.299, 380.228, 381.225, 379.349, 380.23, 380.933, 380.333, 381.065, 382.163, 374.919, 377.241, 378.986, 379.993, 381.92, 382.033, 382.504, 382.313, 383.396, 383.841, 382.144, 380.371, 381.79, 382.493, 382.057, 384.244, 378.329, 378.933, 378.401, 380.078, 379.94, 380.502, 381.018, 380.509, 381.733, 381.417, 382.189, 382.675, 383.341, 382.35, 383.935, 382.587, 383.137, 383.14, 383.658, 383.537, 386.031, 385.484, 387.4, 385.583, 386.188, 383.12, 383.585, 383.041, 383.929, 381.938, 382.019, 380.714, 379.827, 386.279, 383.475, 385.386, 379.323, 386.352, 382.685, 385.224, 383.422, 383.941, 382.312, 386.211, 385.702, 387.874, 387.381, 388.45, 385.772, 383.701, 381.081, 380.237, 381.59, 381.887, 380.754, 386.668, 383.444, 382.076, 382.999, 380.718, 381.592, 381.698, 381.775, 380.558, 381.549, 380.616, 379.398, 382.607, 382.239, 382.503, 381.856, 385.088, 382.455, 385.848, 386.232, 384.097, 385.387, 380.023, 385.098, 383.023, 384.939, 384.812, 387.165, 376.772, 379.194, 381.032, 380.014, 384.309, 381.373, 382.104, 378.093, 379.36, 379.208, 379.632, 380.779, 381.062, 378.148, 377.278, 379.205, 381.139, 380.801, 377.704, 376.698, 379.628, 378.276, 379.845, 377.686, 378.59, 378.915, 377.669, 380.548, 377.991, 378.939, 376.92, 378.318, 375.795, 375.093, 377.857, 375.943, 375.428, 373.411, 375.974, 374.743, 373.301, 374.161, 374.269, 373.857, 373.126, 375.409, 375.324, 376.851, 376.677, 378.168, 378.432, 376.735, 375.581, 379.745, 378.531, 380.982, 378.201, 377.533, 378.068, 380.862, 379.468, 379.596, 379.379, 384.047, 381.131, 381.22, 379.27, 381.263, 379.565, 380.882, 379.072, 380.492, 380.988, 380.365, 382.741, 382.159, 382.309, 383.776, 384.678, 381.896, 382.889, 377.451, 378.262, 378.807, 376.099, 381.549, 378.319, 379.313, 378.1, 377.574, 379.992, 377.905, 380.083, 376.345, 374.519, 374.339, 375.268, 373.873, 375.927, 373.247, 377.774, 376.769, 381.38, 379.902, 378.125, 378.901, 378.795, 385.263, 380.94, 385.561, 380.546, 379.38, 379.833, 379.948, 373.035, 374.997, 372.658, 372.61, 374.169, 370.703, 369.877, 375.276, 374.144, 377.058, 375.828, 378.611, 377.063, 377.732, 376.303, 377.828, 376.468, 378.598, 376.558, 384.064, 379.026, 380.758, 378.365, 378.289, 379.802, 379.347, 381.761, 380.371, 380.121, 381.708, 380.418, 386.343, 382.603, 385.884, 383.345, 383.258, 385.403, 382.448, 381.277, 384.397, 377.663, 378.161, 376.45, 376.429, 378.322, 375.404, 375.943, 379.854, 379.781, 377.984, 374.898, 389.408, 383.606, 382.929, 384.892, 378.54, 378.919, 375.911, 375.35, 375.718, 373.884, 374.478, 373.909, 376.874, 376.017, 373.718, 374.194, 374.585, 375.228, 376.229, 373.097, 373.896, 374.628, 376.293, 376.061, 378.617, 378.958, 378.832, 378.279, 377.861, 377.256, 381.141, 379.738, 385.424, 381.847, 383.763, 381.394, 382.228, 380.08, 381.835, 381.524, 381.414, 384.176, 381.991, 379.202, 381.484, 379.063, 377.859, 379.648, 380.398, 380.275, 386.396, 383.579, 380.576, 381.07, 377.371, 376.662, 380.041, 380.89, 379.566, 381.738, 381.06, 380.241, 377.914, 381.501, 380.992, 384.252, 378.151, 381.59, 379.78, 382.966, 384.745, 382.391, 385.03, 382.208, 381.319, 381.044, 382.863, 383.202, 380.418, 381.144, 382.559, 383.753, 380.057, 379.317, 376.6, 377.16, 377.003, 378.316, 378.451, 378.973, 379.901, 379.879, 382.229, 379.352, 377.576, 379.3, 375.232, 378.335, 375.552, 375.051, 377.537, 375.745, 380.282, 379.148, 378.907, 380.857, 381.483, 379.84, 381.647, 380.34, 378.813, 376.769, 380.809, 380.034, 382.981, 379.09, 381.415, 381.303, 380.523, 380.024, 382.901, 372.789, 377.288, 376.429, 378.553, 378.886, 378.62, 376.977, 379.183, 376.666, 378.607, 375.007, 378.971, 380.74, 380.203, 377.854, 377.906, 379.896, 375.368, 376.114, 377.741, 371.395, 375.468, 376.665, 379.006, 379.428, 374.56, 374.597, 375.184, 375.657, 370.659, 374.802, 374.393, 375.523, 376.648, 375.871, 381.993, 380.143, 382.207, 380.309, 381.918, 382.787, 383.169, 380.324, 381.407, 381.192, 374.772, 375.672, 375.257, 378.571, 379.687, 379.638, 377.899, 377.421, 380.055, 376.639, 383.245, 381.296, 377.607, 378.562, 381.169, 380.992, 382.912, 380.606,

27

379.274, 377.381, 376.709, 376.554, 380.639, 378.753, 377.233, 378.994, 378.773, 377.223, 378.797, 377.276, 378.658, 378.874, 378.089, 381.601, 378.289, 380.258, 375.041, 374.842, 374.036, 373.958, 380.549, 377.635, 375.81, 379.277, 377.043, 380.17, 378.841, 376.435, 374.177, 378.28, 376.38, 380.698, 377.203, 378.686, 377.795, 380.992, 378.608, 376.73, 376.223, 379.401, 378.812, 376.967, 377.794, 377.354, 378.5, 378.258, 377.659, 375.653, 374.835, 376.333, 376.715, 373.223, 375.646, 376.802, 376.094, 375.203, 377.819, 372.779, 372.198, 376.318, 372.661, 376.841, 377.543, 377.629, 377.146, 377.618, 375.162, 377.357, 378.932, 378.245, 382.189, 380.131, 375.977, 377.562, 376.783, 376.839, 375.46, 375.967, 374.122, 377.524, 377.73, 376.248, 379.27, 379.32, 378.043, 381.435, 375.339, 377.346, 377.667, 375.264, 379.308, 377.818, 379.105, 379.07, 382.787, 379.811, 381.293, 377.13, 376.567, 379.311, 376.004, 375.839, 375.109, 376.813, 374.599, 375.612, 377.016, 377.321, 378.474, 375.506, 376.175, 376.199, 375.818, 376.776, 376.602, 374.358, 374.899, 374.844, 375.961, 376.482, 371.754, 373.028, 373.692, 372.095, 373.347, 372.288, 377.629, 376.962, 378.384, 377.859, 376.926, 379.804, 376.581, 376.176, 377.142, 377.065, 378.615, 376.474, 375.733, 378.331, 377.785, 379.732, 377.809, 382.143, 379.602, 377.673, 375.444, 380.721, 380.704, 382.638, 381.54, 385.58, 383.37, 389.521, 384.51, 385.683, 383.9, 385.45, 380.162, 379.979, 382.135, 377.427, 378.831, 380.573, 378.803, 381.837, 380.753, 386.573, 382.748, 382.779, 380.447, 378.575, 381.173, 379.463, 381.284, 377.19, 378.256, 377.842, 378.89, 380.477, 380.607, 381.574, 381.234, 379.966, 379.486, 381.668, 381.949, 379.41, 378.571, 381.778, 380.114, 378.875, 377.448, 377.276, 381.111, 378.302, 383.385, 376.857, 377.589, 376.417, 376.349, 376.453, 374.938, 378.744, 380.382, 380.044, 384.008, 383.878, 382.261, 381.115, 380.455, 379.694, 381.164, 376.011, 375.032, 376.418, 375.38, 379.192, 379.773, 378.525, 380.54, 381.418, 380.366, 382.042, 378.487, 383.411, 382.288, 378.438, 377.648, 383.021, 380.354, 383.317, 383.272, 384.154, 381.939, 380.506, 382.679, 381.91, 380.063, 380.182, 377.717, 376.397, 375.296, 374.706, 377.404, 378.229, 375.038, 374.113, 375.045, 375.721, 377.287, 378.112, 375.022, 378.941, 377.309, 378.434, 377.568, 377.587, 377.237, 378.884, 378.322, 379.738, 380.847, 380.319, 382.818, 381.976, 386.416, 381.963, 383.899, 378.873, 379.7, 378.339, 377.48, 378.125, 380.318, 380.439, 380.274, 381.673, 378.683, 379.968, 378.673, 379.417, 379.405, 378.607, 380.713, 381.655, 378.078, 377.97, 378.395, 376.85

5) The Nikkei 225 index daily opening prices variations between 27 July 2004 and 27 December 2004 0.000648016, 0.00483497, 0.00213546, 0.00564168, -0.00391682, -0.0136034, -0.00156533, -0.0104492, -0.0106911, 0.00204108, 0.0184429, -0.00404261, -0.00941107, -0.0158308, 0.00403207, -0.00440206, 0.0127834, -0.000261464, 0.0094695, 0.00152437, -0.00173975, 0.021604, -0.00429428, 0.00296819, -0.00555839, -0.00128607, 0.00670608, 0.000248673, -0.00853239, 0.0170105, 0.00619408, -0.0060493, -0.0165468, 0.00451492, 0.0155072, -0.00301077, -0.0164878, 0.00354828, 0.00145077, -0.00331085, -0.0159549, -0.00646331, -0.00531052, 0.00631336, -0.000337506, 0.00211404, 0.0200364, 0.0131171, -0.00316775, 0.0158517, -0.00772057, -0.00144633, -0.00527576, -0.00755376, -0.0170699, 0.00564403, 0.000568857, -0.00325342, -0.0100478, -0.00306009, -0.0119664, -0.00620958, 0.00828736, 0.00637299, -0.000368208, -0.00685786, 0.0040984, 0.0200186, 0.00449107, 0.00502171, -0.011566, 0.000497849, 0.00448844, -0.016372, 0.0219288, 0.0140399, -0.00913864, 0.00449513, -0.00546857, -0.0147946, -0.0113532, 0.00194608, 0.00657416, -0.00733126, 0.00598376, -0.0108898, 0.0122442, 0.0129713, -0.00389453, -0.00453219, -0.0148361, 0.0113273, -0.0183416, 0.00882355, 0.00163879, 0.0101367, -0.00396432, 0.0027417, 0.0122815, 0.00466607, 0.00725379, 0.00861509, 0.0063756

6) The Nikkei 225 index daily opening prices between 27 July 2004 and 27 December 2004 11126.3, 11133.5, 11187.3, 11211.2, 11274.5, 11230.3, 11077.5, 11060.2, 10944.6, 10827.6, 10849.7, 11049.8, 11005.1, 10901.6, 10729., 10772.2, 10724.8, 10861.9, 10859.1, 10961.9, 10978.6, 10959.5, 11196.3, 11148.2, 11181.3, 11119.2, 11104.9, 11179.3, 11182.1, 11086.7, 11275.3, 11345.1, 11276.5, 11089.9, 11140., 11312.7, 11278.7, 11092.7, 11132.1, 11148.2, 11111.3, 10934., 10863.4, 10805.7, 10873.9, 10870.2, 10893.2, 11111.5, 11257.2, 11221.5, 11399.4, 11311.4, 11295.1, 11235.5, 11150.6, 10960.3, 11022.1, 11028.4, 10992.5, 10882.1, 10848.8, 10718.9, 10652.4, 10740.7, 10809.1, 10805.1, 10731., 10775, 10990.7, 11040.1, 11095.5, 10967.2, 10972.6,

28

11021.9, 10841.4, 11079.2, 11234.7, 11132.1, 11182.1, 11120.9, 10956.4, 10832., 10853.1, 10924.5, 10844.4, 10909.3, 10790.5, 10922.6, 11064.3, 11021.2, 10971.2, 10808.4, 10930.9, 10730.4, 10825.1, 10842.8, 10952.7, 10909.3, 10939.2, 11073.6, 11125.2, 11205.9, 11302.5, 11374.5

7) Second simulation price variations per time tick 0.00251288, -0.0136055, 0.00578835, 0.00228871, 0.00501239, 0.000202718, -0.0137441, 0.0171823, -0.00720104, 0.00682166, -0.00174398, 0.00447185, -0.00505981, -0.00109736, 0., 0.0107126, -0.00905989, -0.000373942, 0.00913318, -0.00280637, 0.00206441, -0.0196743, 0.0218309, 0., -0.00582976, -0.00660633, 0.00330935, 0., 0.00424119, 0.00258209, 0.00205103, -0.0000695189, -0.00041496, 0.0114059, -0.0062842, 0., -0.0142889, 0.000102147, -0.00229026, 0.0020989, -0.0061941, -0.00122596, -0.00659162, 0.00641506, 0.000371597, -0.0196157, 0.0155132, 0.00108407, 0.00318924, 0.00374374, -0.000769282, -0.00322508, -0.0026384, 0.0296579, -0.0111341, 0.000766057, -0.00748185, 0.0306606, -0.0329234, 0.00895452, 0.000550093, 0.000194438, 0.0028756, -0.0163547, 0.0251693, -0.0109422, 0.00306881, 0.00292443, 0.0021537, 0.000878957, -0.00216753, -0.00664049, 0.00665064, -0.00421255, 0.00968413, -0.00638443, -0.00240221, 0.00139713, -0.0205952, 0.00866815, 0.00373153, 0.0000299195, -0.00191104, -0.00183452, 0.00813283, 0.00234247, 0.00905274, -0.00469916, -0.0101031, -0.0042518, 0.0173132, -0.013577, -0.00866604, 0.010691, -0.000669449, 0.00768126, -0.00466843, -0.00551403, 0.00763694, 0.00107216, 0.000312429, -0.00953073, 0.0103485

8) Second simulation prices per time tick 11.3745, 11.4031, 11.248, 11.3131, 11.339, 11.3958, 11.3981, 11.2414, 11.4346, 11.3523, 11.4297, 11.4098, 11.4608, 11.4028, 11.3903, 11.3903, 11.5123, 11.408, 11.4037, 11.5079, 11.4756, 11.4993, 11.273, 11.5191, 11.5191, 11.452, 11.3763, 11.414, 11.414, 11.4624, 11.492, 11.5156, 11.5148, 11.51, 11.6413, 11.5681, 11.5681, 11.4028, 11.404, 11.3779, 11.4017, 11.3311, 11.3172, 11.2426, 11.3148, 11.319, 11.0969, 11.2691, 11.2813, 11.3173, 11.3596, 11.3509, 11.3143, 11.2844, 11.6191, 11.4897, 11.4985, 11.4125, 11.7624, 11.3752, 11.477, 11.4833, 11.4856, 11.5186, 11.3302, 11.6154, 11.4883, 11.5236, 11.5573, 11.5821, 11.5923, 11.5672, 11.4904, 11.5668, 11.5181, 11.6296, 11.5554, 11.5276, 11.5437, 11.306, 11.404, 11.4465, 11.4469, 11.425, 11.404, 11.4968, 11.5237, 11.628, 11.5734, 11.4565, 11.4078, 11.6053, 11.4477, 11.3485, 11.4698, 11.4621, 11.5502, 11.4963, 11.4329, 11.5202, 11.5325, 11.5361, 11.4262, 11.5444, 11.4848

9) Crash simulation prices per time tick 11.3745, 11.4031, 11.248, 11.3131, 11.339, 11.3958, 11.3981, 11.2414, 11.4346, 11.3523, 11.4297, 11.4098, 11.4608, 11.4028, 11.3903, 11.3903, 11.5123, 11.408, 11.4037, 11.5079, 11.4756, 11.4993, 11.273, 11.5191, 11.5191, 11.452, 11.3763, 11.414, 11.414, 11.4624, 11.492, 11.5156, 11.5148, 11.51, 11.6413, 11.5681, 11.5681, 11.4028, 11.404, 11.3779, 11.4017, 11.3311, 11.3172, 11.2426, 11.3148, 11.319, 11.0969, 11.2691, 11.2813, 11.3173, 11.3596, 11.3509, 11.3143, 11.2844, 11.6191, 11.4897, 11.4985, 11.4125, 11.7624, 11.3752, 11.477, 11.4833, 11.4856, 11.5186, 11.3302, 11.6154, 11.4883, 11.5236, 11.5573, 11.5821, 11.5923, 11.5672, 11.4904, 11.5668, 11.5181, 11.6296, 11.5554, 11.5276, 11.5437, 11.306, 11.404, 11.4465, 11.4469, 11.425, 11.404, 11.4968, 11.5237, 11.628, 11.5734, 11.4565, 11.4078, 11.6053, 11.4477, 11.3485, 11.4698, 11.4621, 11.5502, 11.4963, 11.4329, 11.5202, 11.5325, 11.5361, 11.4262, 11.5444, 11.4848

Appendix B: java code of the software (by class) package com.guilherme.historyRelated; import java.util.*; import javax.swing.JTextArea; import com.guilherme.math.Calculator; public class TransactionsHistoryArray {

29

public ArrayList theArray; public boolean goingUp=false; public int timeInThisDirection=0; public TransactionsHistoryArray() { theArray=new ArrayList(); } public Integer[] getArray() { Integer[] res=new Integer[theArray.size()]; int i=0; while(i
30

}

public class Global { public static void showAllHistoryT(StockHistoryArray passedSH, TransactionsHistoryArray passedHA,JTextArea text) { int i=0; text.setText(""); while(i<passedSH.theArray.size()) { text.append(String.format("Time: %5d Stock price: %1.3f Transactions: %d\n",i,passedSH.theArray.get (i),passedHA.theArray.get(i)));i++;} } } package com.guilherme.historyRelated; import java.util.*; import javax.swing.JTextArea; import com.guilherme.math.Calculator; public class StockHistoryArray { public ArrayList theArray; public boolean goingUp=false; public int timeInThisDirection=0; public StockHistoryArray() { theArray=new ArrayList(); } public double[] getArray() { double res[]=new double[theArray.size()]; int i=0; while(i
31

int i=0; text.setText(""); while(i theArray; private double lastPrice; public ArrayOfInvestors() { theArray=new ArrayList(); } public int getNumberOfInvestors() { return theArray.size(); } public Investor getInvestorAtIndex(int number) { return theArray.get(number); } public void addInvestor(Investor startInvestor) { theArray.add(startInvestor); } public void removeInvestor(Investor passedInvestor) { theArray.remove(passedInvestor); } public void removeAll() { theArray.clear(); } public double getLastPrice() { return lastPrice; } public void showAll() { int i=0; while(i
32

i++; } } } package com.guilherme.investorRelated; import java.util.ArrayList; import javax.swing.JComboBox; import javax.swing.JTextArea; import com.guilherme.main.Parameters; import com.guilherme.math.Calculator; import com.guilherme.orderRelated.*; public class Investor{ public double money; public int numberOfStocks; public BuyingOrder currentBuyingOrder; public SellingOrder currentSellingOrder; public Integer strategy; public Investor(double startMoney, int startNumberOfStocks, BuyingOrder startBuyingOrder, SellingOrder startSellingOrder) { money=startMoney; numberOfStocks=startNumberOfStocks; currentBuyingOrder=startBuyingOrder; currentSellingOrder=startSellingOrder; strategy=0; } public void addStrategy(int passedStrategy) { strategy=passedStrategy; } public void addMoney(double newValue) { money=money+newValue; } public void takeMoney(double newValue) { money=money-newValue; } public void addStocks(int newValue) { numberOfStocks=numberOfStocks+newValue; } public void takeStocks(int newValue) { numberOfStocks=numberOfStocks-newValue; } public double getMoney() { return this.money; } public float getNumberOfStocks() { return this.numberOfStocks; } public void showInfo() { } public void showTagedInfo(int tag) { System.out.print(" Investor "+tag+" --> Money: "+money+" Number of stocks: "+numberOfStocks); if (currentBuyingOrder.doesNothing) {System.out.print(" Buying orders: doesn't buy");} if (currentBuyingOrder.negotiatesAtBestPrice) {System.out.print(" Buying orders: buys at best price");} if (!currentBuyingOrder.doesNothing && !currentBuyingOrder.negotiatesAtBestPrice) {System.out.print(" Buying orders: buys for "+currentBuyingOrder.orderPrice);} if (currentSellingOrder.doesNothing) {System.out.print(" and doesn't sell");} if (currentSellingOrder.negotiatesAtBestPrice) {System.out.print(" and sells at best price");} if (!currentSellingOrder.doesNothing && !currentSellingOrder.negotiatesAtBestPrice) {System.out.print(" and sells for "+currentSellingOrder.orderPrice);} System.out.print(" Strategies:"); if (strategyQ(1)) {System.out.print(" 1");} if (strategyQ(2)) {System.out.print(" 2 ");} if (strategyQ(3)) {System.out.print(" 3 ");} System.out.println(""); } public BuyingOrder getCurrentBuyingOrder() { return currentBuyingOrder; } public SellingOrder getCurrentSellingOrder() { return currentSellingOrder; } public void replaceCurrentBuyingOrder(BuyingOrder passedOrder) {

33

this.currentBuyingOrder=passedOrder; } public void replaceCurrentSellingOrder(SellingOrder passedOrder) { this.currentSellingOrder=passedOrder; } public boolean strategyQ(int passedStrategy) { return strategy==passedStrategy; } public int getStrategiesTag() { int res=0; if (strategyQ(1)) res=res+100; if (strategyQ(2)) res=res+10; if (strategyQ(3)) res=res+1; return res; } public void actualize(double passedStockPrice, boolean passedGoingUp, int passedTimeInThisDirection, boolean passedTransactionGoingUp, int passedTTimeInThisDirection) { if (strategyQ(1)) { Double aux=Calculator.randomExponentialInteger(Parameters.exponentialLambda); if (passedGoingUp && passedTimeInThisDirection>aux) {currentBuyingOrder.change(false, true, currentBuyingOrder.orderPrice); currentSellingOrder.change(true, false, currentSellingOrder.orderPrice);} else if (!passedGoingUp && passedTimeInThisDirection>aux) {currentSellingOrder.change(false, true, currentSellingOrder.orderPrice); currentBuyingOrder.change(true, false, currentBuyingOrder.orderPrice);} else {currentSellingOrder.change(true, false, currentSellingOrder.orderPrice); currentBuyingOrder.change(true, false, currentBuyingOrder.orderPrice);} } if (strategyQ(2)) { Double aux=Calculator.randomExponentialInteger(Parameters.exponentialLambda); if (passedGoingUp && passedTimeInThisDirection
34

if (strategyQ(1)) {res=res.concat(" if (strategyQ(2)) {res=res.concat(" if (strategyQ(3)) {res=res.concat(" if (strategyQ(4)) {res=res.concat(" res=res.concat("\n\n"); text.append(res);

1 2 3 4

");} ");} ");} ");}

} public Investor copy() { Investor res=new Investor(money, numberOfStocks, currentBuyingOrder, currentSellingOrder); int i=1; while(i<4) {if (strategyQ(i)) {res.addStrategy(i);} i++;} return res; } } package com.guilherme.IO; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class BufferedInputFile { public static String read(String filename) throws IOException { BufferedReader in = new BufferedReader( new FileReader(filename)); String s; StringBuilder sb = new StringBuilder(); while((s = in.readLine())!= null) sb.append(s + "\n"); in.close(); return sb.toString(); } } package com.guilherme.IO; import java.io.File; import java.io.IOException; import com.guilherme.historyRelated.StockHistoryArray; public class Exporter { public static void write(String text,StockHistoryArray historyInUse, String filename) throws IOException { java.io.File exportFile=new File(filename); java.io.FileWriter fw = new java.io.FileWriter( exportFile, false ); java.io.PrintWriter pw = new java.io.PrintWriter( fw, true ); int i=0; pw.println(text); pw.println("\n\nHISTORY"); while(i
35

} package com.guilherme.main; public class Parameters { public static Double firstStockPrice=1.0; public static Double exponentialLambda=1.0; public static Double variance=0.1; public static Double choppingParameter=0.999999; public static Double pip=0.01; public static Double percentage=0.1; public static void show() { System.out.println(" System.out.println(" System.out.println(" System.out.println(" System.out.println(" } }

First stock price: "+firstStockPrice); Exponential lambda: "+exponentialLambda); Variance: "+variance); Chopping parameter: "+choppingParameter); Pip: "+pip);

package com.guilherme.main; public class Preferences { public static Boolean showTransactions=false; public static Boolean showTransactorsInfo=false; public static Boolean showDirection=true; public static Boolean showTransactionsDirection=true; public static void show() { if (showTransactions) {System.out.println(" Show transactions: yes");} else {System.out.println("Show transactions: no");} if (showTransactorsInfo) {System.out.println(" Show transactors's info: yes");} else {System.out.println(" Show transactor's info: no");} } } package com.guilherme.main; import javax.swing.*; import javax.swing.border.BevelBorder; import javax.swing.border.Border; import javax.swing.border.LineBorder; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.plaf.basic.BasicBorders; import javax.swing.plaf.metal.MetalBorders; import com.guilherme.GUI.Painter; import com.guilherme.IO.BufferedInputFile; import com.guilherme.IO.Exporter; import com.guilherme.IO.graphicsWriter; import com.guilherme.historyRelated.Global; import com.guilherme.historyRelated.StockHistoryArray; import com.guilherme.historyRelated.TransactionsHistoryArray; import com.guilherme.investorRelated.ArrayOfInvestors; import com.guilherme.investorRelated.Investor; import com.guilherme.marketRelated.Statistics; import com.guilherme.marketRelated.StockMarket; import com.guilherme.orderRelated.BuyingOrder; import com.guilherme.orderRelated.MapOfBuyingOrdersValues; import com.guilherme.orderRelated.MapOfSellingOrdersValues; import com.guilherme.orderRelated.SellingOrder; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.io.IOException; import java.util.*; public class Program { private static void init(MapOfBuyingOrdersValues mapInUseB,MapOfSellingOrdersValues mapInUseS,StockHistoryArray historyInUse,TransactionsHistoryArray transactionsHistoryInUse,StockMarket marketInUse) {

36

mapInUseB.theMap.clear(); mapInUseS.theMap.clear(); historyInUse.clearHistory(); marketInUse.stockPrice=Parameters.firstStockPrice; marketInUse.time=0; historyInUse.addFirstStockPrice(marketInUse.stockPrice); transactionsHistoryInUse.addFirstTransactionValue(0); } private static void addStrategiesFromText(Investor passedInvestor, JTextField passedField) { Integer k=0; String aux=passedField.getText(); while (k
37

mainWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); mainWindow.setBackground(Color.white); mainWindow.setLayout(new FlowLayout()); mainWindow.setResizable(false); final JTextField inputText=new JTextField("0",10); inputText.setToolTipText("Number of time ticks to pass"); final JTextArea mainText=new JTextArea(); mainText.setSize(370,380); mainText.setLineWrap(true); mainText.setEditable(false); mainText.setWrapStyleWord(true); final JScrollPane scrollPane = new JScrollPane(mainText); scrollPane.setPreferredSize(new Dimension(370,380)); scrollPane.setBorder(new LineBorder(Color.BLACK,1)); final JTextArea statisticsText=new JTextArea(); statisticsText.setSize(193,380); statisticsText.setLineWrap(true); statisticsText.setEditable(false); statisticsText.setWrapStyleWord(true); statisticsText.setFont(new Font("Plain",0,12)); final JScrollPane scrollPaneStatistics = new JScrollPane(statisticsText); scrollPaneStatistics.setPreferredSize(new Dimension(193,380)); scrollPaneStatistics.setBorder(new LineBorder(Color.BLACK,1)); JButton button10=new JButton("Show orders book"); class histButtonListener implements ActionListener { public void actionPerformed(ActionEvent e) { ordersT.setText("BUYING ORDERS\n"); mapInUseB.showInfoT(ordersT); ordersT.append("\nSELLING ORDERS\n"); mapInUseS.showInfoT(ordersT); ordersWindow.setVisible(true); } } histButtonListener listener10=new histButtonListener(); button10.addActionListener(listener10); JButton button6=new JButton("Show history"); class difButtonListener implements ActionListener { public void actionPerformed(ActionEvent e) { Global.showAllHistoryT(historyInUse,transactionsHistoryInUse,historyT); historyWindow.setVisible(true); } } difButtonListener listener7=new difButtonListener(); button6.addActionListener(listener7); final JTextArea coordinates=new JTextArea(); coordinates.setSize(50,10); coordinates.setEditable(false); double[] testValues={0,0,0,0}; final Painter panel=new Painter(testValues); panel.setPreferredSize(new Dimension(580,200)); panel.setBorder(new LineBorder(Color.BLACK,1)); class myMouseListener implements MouseMotionListener { public void mouseDragged(MouseEvent arg0) { } public void mouseMoved(MouseEvent arg0) { if (marketInUse.time rel="nofollow">0) {int x=arg0.getX()*panel.getNumberOfPoints()/5800+1; double y=(200-arg0.getY())*(panel.showMax()-panel.showMin())/200+panel.showMin(); coordinates.setText("Time passed "+x+" Money "+y);} else {coordinates.setText("");} } } myMouseListener myListener=new myMouseListener(); panel.addMouseMotionListener(myListener); //Statistics window final JFrame statisticsWindow=new JFrame(); statisticsWindow.setTitle("Statistics configuration"); statisticsWindow.setBounds(80,100,500,115); statisticsWindow.setBackground(Color.white); statisticsWindow.setLayout(new FlowLayout());

38

statisticsWindow.setResizable(false); statisticsWindow.setAlwaysOnTop(true); JTextArea label1=new JTextArea("Select first strategy to follow: "); label1.setEditable(false); String[] data3={"Strategy 1","Strategy 2","Strategy 3","Strategy 4"}; final JComboBox comboStrategy2=new JComboBox(data3); comboStrategy2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String aux=(String) comboStrategy2.getSelectedItem(); if (0==aux.compareTo("Strategy 1")) StatisticsPrefs.strategyToFollow=1; if (0==aux.compareTo("Strategy 2")) StatisticsPrefs.strategyToFollow=2; if (0==aux.compareTo("Strategy 3")) StatisticsPrefs.strategyToFollow=3; if (0==aux.compareTo("Strategy 4")) StatisticsPrefs.strategyToFollow=4; } }); JTextArea label2=new JTextArea("Select second strategy to follow: "); label2.setEditable(false); final JComboBox comboStrategy3=new JComboBox(data3); comboStrategy3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String aux=(String) comboStrategy3.getSelectedItem(); if (0==aux.compareTo("Strategy 1")) StatisticsPrefs.strategyToFollow2=1; if (0==aux.compareTo("Strategy 2")) StatisticsPrefs.strategyToFollow2=2; if (0==aux.compareTo("Strategy 3")) StatisticsPrefs.strategyToFollow2=3; if (0==aux.compareTo("Strategy 4")) StatisticsPrefs.strategyToFollow2=4; } }); JTextArea label3=new JTextArea("Dimension of interval (to use in sharpest rise and sharpest fall): "); Integer auxInteger=new Integer(StatisticsPrefs.scale); final JTextField scale=new JTextField(auxInteger.toString()); statisticsWindow.add(label1); statisticsWindow.add(comboStrategy2); statisticsWindow.add(label2); statisticsWindow.add(comboStrategy3); statisticsWindow.add(label3); statisticsWindow.add(scale); //Statistics window JButton button=new JButton("Pass time"); class ButtonListener implements ActionListener { public void actionPerformed(ActionEvent e) { if (inputText.getText().compareTo("0")!=0 && inputText.getText().compareTo(" ")!=0) { int aux=new Integer(0).decode(inputText.getText()); int i=0; while(i
39

} ButtonListener listener=new ButtonListener(); button.addActionListener(listener); class menuItemListener0 implements ActionListener { public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null, "Guilherme Ferreira da Costa \[email protected]",null,JOptionPane.PLAIN_MESSAGE); } } menuItemListener0 myMenuListener0=new menuItemListener0(); class menuItemListener1 implements ActionListener { public void actionPerformed(ActionEvent e) { JOptionPane optionPane=new JOptionPane(); String aux2=JOptionPane.showInputDialog("Enter 'first stock price'",Parameters.firstStockPrice); if (aux2!=null) Parameters.firstStockPrice=new Double(aux2); JOptionPane optionPane2=new JOptionPane(); String aux3=JOptionPane.showInputDialog("Enter 'pip'",Parameters.pip); if (aux3!=null) Parameters.pip=new Double(aux3); String aux4=JOptionPane.showInputDialog("Enter 'precentage'",Parameters.percentage); if (aux4!=null) Parameters.percentage=new Double(aux4); } } menuItemListener1 myMenuListener1=new menuItemListener1(); class menuItemListener2 implements ActionListener { public void actionPerformed(ActionEvent e) { statisticsWindow.setVisible(true); } } menuItemListener2 myMenuListener2=new menuItemListener2(); class menuItemListener3 implements ActionListener { public void actionPerformed(ActionEvent e) { JOptionPane optionPane=new JOptionPane(); String file=JOptionPane.showInputDialog("Type in a name for the file","exported.txt"); try { Exporter.write(mainText.getText().concat("\n\nSTATISTICS\n"+statisticsText.getText ()),historyInUse,file); Exporter.writeForWork(historyInUse, "/Users/GI/Desktop/Important data/work.txt"); } catch (IOException e1) { e1.printStackTrace(); } } } menuItemListener3 myMenuListener3=new menuItemListener3(); JMenu myMenu=new JMenu("Other actions"); JMenu helpMenu=new JMenu("Help"); JMenuItem item0=new JMenuItem("Show credits"); JMenuItem item1=new JMenuItem("See/Change global parameters"); JMenuItem item2=new JMenuItem("Configure statistics"); JMenuItem item3=new JMenuItem("Export data"); JMenuItem item4=new JMenuItem("How the market works"); item0.addActionListener(myMenuListener0); item1.addActionListener(myMenuListener1); item2.addActionListener(myMenuListener2); item3.addActionListener(myMenuListener3); myMenu.add(item0); myMenu.add(item1); myMenu.add(item2); myMenu.add(item3); helpMenu.add(item4); JMenuBar mb=new JMenuBar(); mb.add(myMenu); mb.add(helpMenu); mainWindow.setJMenuBar(mb); mainWindow.add(button); mainWindow.add(inputText); mainWindow.add(scrollPane); mainWindow.add(scrollPaneStatistics); mainWindow.add(button10); mainWindow.add(button6); mainWindow.add(panel); mainWindow.add(coordinates); //MAIN WINDOW

40

//INVESTORS WINDOW final JFrame investorsWindow=new JFrame(); investorsWindow.setTitle("Investors"); investorsWindow.setBounds(620,37,380,260); investorsWindow.setBackground(Color.white); investorsWindow.setLayout(new FlowLayout()); investorsWindow.setResizable(false); final JTextField numberOfInvestorsT=new JTextField("0",3); numberOfInvestorsT.setToolTipText("Number of investors to create ") final JTextField moneyT=new JTextField("0",3); moneyT.setToolTipText("Money"); final JTextField numberOfStocksT=new JTextField("0",3); numberOfStocksT.setToolTipText("Number of stocks"); final JTextField strategy=new JTextField("1"); String[] data2={"Strategy 1","Strategy 2","Strategy 3","Strategy 4"}; final JComboBox comboStrategy=new JComboBox(data2); comboStrategy.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String aux=(String) comboStrategy.getSelectedItem(); if (0==aux.compareTo("Strategy 1")) strategy.setText("1"); if (0==aux.compareTo("Strategy 2")) strategy.setText("2"); if (0==aux.compareTo("Strategy 3")) strategy.setText("3"); if (0==aux.compareTo("Strategy 4")) strategy.setText("4"); } }); final JTextArea readerT=new JTextArea(); readerT.setSize(250,150); readerT.setLineWrap(true); readerT.setEditable(false); readerT.setWrapStyleWord(true); readerT.setBorder(new LineBorder(Color.BLACK,1)); final DefaultListModel lItems=new DefaultListModel(); final JList list=new JList(lItems); list.setFixedCellWidth(80); class ListListener implements ListSelectionListener { public void valueChanged(ListSelectionEvent arg0) { if (list.getSelectedIndex() rel="nofollow">-1) { readerT.setText(""); arrayInUse.getInvestorAtIndex(list.getSelectedIndex()).showTagedInfoT(list.getSelectedIndex(),readerT); readerT.append(String.format("Gains: %1.3f",statisticsInUse.getGainsFromInvestor(arrayInUse, marketInUse.stockPrice, list.getSelectedIndex()))); } } } ListListener listener3=new ListListener(); list.addListSelectionListener(listener3); JScrollPane scrollPane2 = new JScrollPane(list); JButton button2=new JButton("Add investors"); class ButtonListener2 implements ActionListener { public void actionPerformed(ActionEvent e) { if (numberOfInvestorsT.getText().compareTo("0")!=0 && inputText.getText().compareTo(" ")!=0) { int number=new Integer(0).decode(numberOfInvestorsT.getText()); int i=0; while(i
41

panel.repaint(); } else {JOptionPane.showMessageDialog(null,"Please enter the number of investors to create ","Error",JOptionPane.ERROR_MESSAGE);} } } ButtonListener2 listener2=new ButtonListener2(); button2.addActionListener(listener2); JButton button3=new JButton("Delete investors"); class ButtonListener3 implements ActionListener { public void actionPerformed(ActionEvent e) { int[] values=list.getSelectedIndices(); int i=0; while(i
42

else Preferences.showTransactions=true; } }); JCheckBox checkBox2=new JCheckBox("Show transactor's info",false); checkBox2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (Preferences.showTransactorsInfo) Preferences.showTransactorsInfo=false; else Preferences.showTransactorsInfo=true; } }); JCheckBox checkBox3=new JCheckBox("Show if the market is going up/down",true); checkBox3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (Preferences.showDirection) Preferences.showDirection=false; else Preferences.showDirection=true; } }); JCheckBox checkBox4=new JCheckBox("Show if the number of transactions is going up/down",true); checkBox4.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (Preferences.showTransactionsDirection) Preferences.showTransactionsDirection=false; else Preferences.showTransactionsDirection=true; } }); displayWindow.add(checkBox1); displayWindow.add(checkBox2); displayWindow.add(checkBox3); displayWindow.add(checkBox4); //DISPLAY WINDOW //STRATEGIES WINDOW final JFrame strategiesWindow=new JFrame(); strategiesWindow.setTitle("Strategies"); strategiesWindow.setBounds(620,420,380,338); strategiesWindow.setBackground(Color.white); strategiesWindow.setLayout(new FlowLayout()); strategiesWindow.setResizable(false); final JTextArea strategyDisplayerT=new JTextArea(); strategyDisplayerT.setSize(350,150); strategyDisplayerT.setLineWrap(true); strategyDisplayerT.setEditable(false); strategyDisplayerT.setWrapStyleWord(true); strategyDisplayerT.setBorder(new LineBorder(Color.BLACK,1)); try { strategyDisplayerT.setText(BufferedInputFile.read("strategy1.txt")); } catch (IOException e1) { e1.printStackTrace(); } String[] data={"Strategy 1","Strategy 2","Strategy 3","Strategy 4"}; final JComboBox comboBox=new JComboBox(data); comboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String aux=(String) comboBox.getSelectedItem(); if (0==aux.compareTo("Strategy 1")) try { strategyDisplayerT.setText(BufferedInputFile.read("strategy1.txt")); } catch (IOException e1) { e1.printStackTrace(); } if (0==aux.compareTo("Strategy 2")) try { strategyDisplayerT.setText(BufferedInputFile.read("strategy2.txt")); } catch (IOException e1) { e1.printStackTrace(); } if (0==aux.compareTo("Strategy 3"))

43

try { strategyDisplayerT.setText(BufferedInputFile.read("strategy3.txt")); } catch (IOException e1) { e1.printStackTrace(); } if (0==aux.compareTo("Strategy 4")) try { strategyDisplayerT.setText(BufferedInputFile.read("strategy4.txt")); } catch (IOException e1) { e1.printStackTrace(); } } }); final JTextArea inputT=new JTextArea(); JButton button4=new JButton("See/Change parameters"); class ButtonListener4 implements ActionListener { public void actionPerformed(ActionEvent e) { String aux=(String) comboBox.getSelectedItem(); if (0==aux.compareTo("Strategy 1")) {JOptionPane optionPane=new JOptionPane(); String aux2=JOptionPane.showInputDialog("Enter 'exponential lambda'",Parameters.exponentialLambda); if (aux2!=null) Parameters.exponentialLambda=new Double(aux2); } if (0==aux.compareTo("Strategy 2")) {JOptionPane optionPane2=new JOptionPane(); String aux3=JOptionPane.showInputDialog("Enter 'variance'",Parameters.variance); if (aux3!=null) Parameters.variance=new Double(aux3); JOptionPane optionPane3=new JOptionPane(); String aux4=JOptionPane.showInputDialog("Enter 'chopping parameter'",Parameters.choppingParameter); if (aux4!=null) Parameters.choppingParameter=new Double(aux4); } if (0==aux.compareTo("Strategy 3")) {JOptionPane optionPane2=new JOptionPane(); String aux3=JOptionPane.showInputDialog("Enter 'variance'",Parameters.variance); if (aux3!=null) Parameters.variance=new Double(aux3); JOptionPane optionPane3=new JOptionPane(); String aux4=JOptionPane.showInputDialog("Enter 'chopping parameter'",Parameters.choppingParameter); if (aux4!=null) Parameters.choppingParameter=new Double(aux4);} if (0==aux.compareTo("Strategy 4")) {JOptionPane optionPane4=new JOptionPane(); String aux5=JOptionPane.showInputDialog("Enter 'variance'",Parameters.variance); if (aux5!=null) Parameters.variance=new Double(aux5); JOptionPane optionPane5=new JOptionPane(); String aux6=JOptionPane.showInputDialog("Enter 'chopping parameter'",Parameters.choppingParameter); if (aux6!=null) Parameters.choppingParameter=new Double(aux6);} } } ButtonListener4 listener5=new ButtonListener4(); button4.addActionListener(listener5); strategiesWindow.add(comboBox); strategiesWindow.add(button4); strategiesWindow.add(strategyDisplayerT); //STRATEGIES WINDOW //SETTING WINDOWS VISIBLE investorsWindow.setVisible(true); mainWindow.setVisible(true); displayWindow.setVisible(true); strategiesWindow.setVisible(true); mainWindow.toFront(); //SETTING WINDOWS VISIBLE } } package com.guilherme.main; public class StatisticsPrefs { public static int strategyToFollow=1; public static int strategyToFollow2=1; public static int scale=10; } package com.guilherme.marketRelated;

44

import javax.swing.JTextArea; import com.guilherme.historyRelated.StockHistoryArray; import com.guilherme.investorRelated.ArrayOfInvestors; import com.guilherme.investorRelated.Investor; import com.guilherme.main.Parameters; import com.guilherme.main.StatisticsPrefs; import com.guilherme.math.Calculator; public class Statistics { public ArrayOfInvestors initialArray; public int transactions; public int maxGoingUp; public int maxGoingUpTime; public int maxGoingDown; public int maxGoingDownTime; public double sharpestRise; public int riseTime; public double sharpestFall; public int fallTime; public Statistics() { transactions=0; maxGoingUp=0; maxGoingUpTime=0; maxGoingDown=0; maxGoingDownTime=0; sharpestRise=0; riseTime=0; sharpestFall=0; fallTime=0; } public void actualize(StockHistoryArray passedHistory,int passedTime) { if (passedHistory.goingUp && passedHistory.timeInThisDirection>maxGoingUp) {maxGoingUp=passedHistory.timeInThisDirection; maxGoingUpTime=passedTime;} if (!passedHistory.goingUp && passedHistory.timeInThisDirection>maxGoingDown) {maxGoingDown=passedHistory.timeInThisDirection; maxGoingDownTime=passedTime;} if (passedTime-StatisticsPrefs.scale>=0) { double aux=passedHistory.getValueAtTime(passedTime)-passedHistory.getValueAtTime(passedTimeStatisticsPrefs.scale); if (aux>sharpestRise) {sharpestRise=aux; riseTime=passedTime; } if (aux<sharpestFall) {sharpestFall=aux; fallTime=passedTime; } } } public void reset(ArrayOfInvestors passedArray) { initialArray=new ArrayOfInvestors(); int i=0; while(i<passedArray.getNumberOfInvestors()) { initialArray.addInvestor(passedArray.getInvestorAtIndex(i).copy()); i++; } transactions=0; maxGoingUp=0; maxGoingUpTime=0; maxGoingDown=0; maxGoingDownTime=0; sharpestRise=0; sharpestFall=0; } public double getGains(ArrayOfInvestors currentArray,double currentStockPrice,int passedStrategy) { double res=0; int i=0; int end=initialArray.getNumberOfInvestors(); Investor oldInvestor; Investor newInvestor; while (i<end) { oldInvestor=initialArray.getInvestorAtIndex(i); newInvestor=currentArray.getInvestorAtIndex(i); if (newInvestor.strategyQ(passedStrategy))

45

{res=res+((newInvestor.money-oldInvestor.money)(oldInvestor.numberOfStocks-newInvestor.numberOfStocks)*currentStockPrice);} i++; } return res; } public Double getGainsFromInvestor(ArrayOfInvestors currentArray,double currentStockPrice,int tag) { double res=0; Investor oldInvestor; Investor newInvestor; oldInvestor=initialArray.getInvestorAtIndex(tag); newInvestor=currentArray.getInvestorAtIndex(tag); res=res+((newInvestor.money-oldInvestor.money)-(oldInvestor.numberOfStocks-newInvestor.numberOfStocks) *currentStockPrice); return res; } public void showStatisticsT(ArrayOfInvestors currentArray,Double currentStockPrice,StockHistoryArray currentHistory, JTextArea passedText) { passedText.setText(""); passedText.append(String.format("'First strategy to follow' net gains: %1.3f\n",getGains (currentArray,currentStockPrice,StatisticsPrefs.strategyToFollow))); passedText.append(String.format("'Second strategy to follow' net gains: %1.3f\n\n",getGains (currentArray,currentStockPrice,StatisticsPrefs.strategyToFollow2))); passedText.append("Total transactions:"+transactions+"\n\n"); passedText.append(String.format("Highest price: %1.3f\n",currentHistory.highestPrice())); passedText.append(String.format("Lowest price: %1.3f\n\n",currentHistory.lowestPrice())); passedText.append(String.format("Maximum time going up: %d (end time:%d)\n",maxGoingUp,maxGoingUpTime)); passedText.append(String.format("Maximum time going down: %d (end time:%d)\n \n",maxGoingDown,maxGoingDownTime)); passedText.append(String.format("Sharpest rise in a %3d time ticks interval: %1.3f (end time: %d) \n",StatisticsPrefs.scale,sharpestRise,riseTime)); passedText.append(String.format("Average value (per time tick): %1.3f\n",sharpestRise/ StatisticsPrefs.scale,sharpestRise,riseTime)); passedText.append(String.format("Sharpest fall in a %3d time ticks interval: %1.3f (end time: %d) \n",StatisticsPrefs.scale,sharpestFall,fallTime)); passedText.append(String.format("Average value (per time tick): %1.3f\n\n",sharpestFall/ StatisticsPrefs.scale,sharpestRise,riseTime)); } } package com.guilherme.marketRelated; import com.guilherme.historyRelated.StockHistoryArray; import com.guilherme.historyRelated.TransactionsHistoryArray; import com.guilherme.investorRelated.ArrayOfInvestors; import com.guilherme.investorRelated.Investor; import java.util.Random; import javax.swing.JTextArea; import com.guilherme.main.Parameters; import com.guilherme.main.Preferences; import com.guilherme.math.Calculator; import com.guilherme.orderRelated.*; public class StockMarket { public int time; public double stockPrice; public int thisTickTransactions; public double totalPrice; public int pricesCount; public ArrayOfInvestors associatedArrayOfInvestors; public MapOfBuyingOrdersValues associatedMapOfBuyingOrdersValues; public MapOfSellingOrdersValues associatedMapOfSellingOrdersValues; public StockHistoryArray associatedStockHistoryArray; public TransactionsHistoryArray associatedTransactionsHistoryArray; public Statistics associatedStatistics; public StockMarket(ArrayOfInvestors passedArray,MapOfBuyingOrdersValues passedBMap,MapOfSellingOrdersValues passedSMap,StockHistoryArray passedSHArray,TransactionsHistoryArray passedTHArray,Statistics passedStatistics) { time=0; stockPrice=0; thisTickTransactions=0; associatedArrayOfInvestors=passedArray; associatedMapOfBuyingOrdersValues=passedBMap;

46

associatedMapOfSellingOrdersValues=passedSMap; associatedStockHistoryArray=passedSHArray; associatedTransactionsHistoryArray=passedTHArray; associatedStatistics=passedStatistics; } public void showMarketState() { System.out.println("\n Time:"+time+" Stock price: "+stockPrice+" Numer of transactions: "+thisTickTransactions); associatedStockHistoryArray.showInfo(); } public void showMarketStateW(JTextArea text) { text.append(String.format("Time: %d Stock price %1.3f Transactions:%d\n",time,stockPrice,thisTickTransactions)); if (Preferences.showDirection) {associatedStockHistoryArray.showInfoW(text);} else {text.append("\n");} if (Preferences.showTransactionsDirection) {associatedTransactionsHistoryArray.showInfoW(text);} else {text.append("\n");}; } public void passTime() { time=time+1; actualizeOrders(); matchAll(); associatedStockHistoryArray.addStockPrice(stockPrice); } public boolean matchOrders(){ if (associatedMapOfBuyingOrdersValues.checkForTransaction(associatedMapOfSellingOrdersValues)) { if (Preferences.showTransactorsInfo){associatedArrayOfInvestors.getInvestorAtIndex (associatedMapOfBuyingOrdersValues.bestBuyer()).showTagedInfo(associatedMapOfBuyingOrdersValues.bestBuyer()); associatedArrayOfInvestors.getInvestorAtIndex(associatedMapOfSellingOrdersValues.bestSeller ()).showTagedInfo(associatedMapOfSellingOrdersValues.bestSeller());} if (associatedArrayOfInvestors.getInvestorAtIndex(associatedMapOfBuyingOrdersValues.bestBuyer ()).currentBuyingOrder.negotiatesAtBestPrice && !associatedArrayOfInvestors.getInvestorAtIndex (associatedMapOfSellingOrdersValues.bestSeller()).currentSellingOrder.negotiatesAtBestPrice) {stockPrice=associatedMapOfSellingOrdersValues.bestPrice();} if (!associatedArrayOfInvestors.getInvestorAtIndex(associatedMapOfBuyingOrdersValues.bestBuyer ()).currentBuyingOrder.negotiatesAtBestPrice && associatedArrayOfInvestors.getInvestorAtIndex (associatedMapOfSellingOrdersValues.bestSeller()).currentSellingOrder.negotiatesAtBestPrice) {stockPrice=associatedMapOfBuyingOrdersValues.bestPrice(); } if (!associatedArrayOfInvestors.getInvestorAtIndex(associatedMapOfBuyingOrdersValues.bestBuyer ()).currentBuyingOrder.negotiatesAtBestPrice && !associatedArrayOfInvestors.getInvestorAtIndex (associatedMapOfSellingOrdersValues.bestSeller()).currentSellingOrder.negotiatesAtBestPrice) {stockPrice=(associatedMapOfSellingOrdersValues.bestPrice()+associatedMapOfBuyingOrdersValues.bestPrice ())/2;} associatedArrayOfInvestors.getInvestorAtIndex(associatedMapOfBuyingOrdersValues.bestBuyer()).takeMoney (stockPrice); associatedArrayOfInvestors.getInvestorAtIndex(associatedMapOfBuyingOrdersValues.bestBuyer()).addStocks (1); associatedArrayOfInvestors.getInvestorAtIndex(associatedMapOfSellingOrdersValues.bestSeller()).addMoney (stockPrice); associatedArrayOfInvestors.getInvestorAtIndex(associatedMapOfSellingOrdersValues.bestSeller()).takeStocks (1); associatedStatistics.transactions++; if (Preferences.showTransactions) {System.out.println(" Investor "+associatedMapOfBuyingOrdersValues.bestBuyer()+" bought a stock from investor "+associatedMapOfSellingOrdersValues.bestSeller()+ " for "+stockPrice);} if (Preferences.showTransactorsInfo){associatedArrayOfInvestors.getInvestorAtIndex (associatedMapOfBuyingOrdersValues.bestBuyer()).showTagedInfo(associatedMapOfBuyingOrdersValues.bestBuyer()); associatedArrayOfInvestors.getInvestorAtIndex(associatedMapOfSellingOrdersValues.bestSeller ()).showTagedInfo(associatedMapOfSellingOrdersValues.bestSeller()); System.out.println("\n");} associatedMapOfBuyingOrdersValues.removeOrderWithKey(associatedMapOfBuyingOrdersValues.bestPrice()); associatedMapOfSellingOrdersValues.removeOrderWithKey(associatedMapOfSellingOrdersValues.bestPrice()); return true; } else return false; } public void matchAll() { while(matchOrders()); } public void actualizeOrders() {

47

int j=0; while (j
48

associatedMapOfSellingOrdersValues.removeOrderWithKey(associatedMapOfSellingOrdersValues.bestPrice()); return true; } else return false; } } package com.guilherme.math; import java.util.ArrayList; import java.util.Random; public class Calculator { public static Double randomExponentialInteger(Double parameter) { Random gerador=new Random(); Double i=gerador.nextDouble(); return (-Math.log(i/parameter)/parameter); } public static Double randomNormal(double expectedValue, double variance) { Random gerador=new Random(); return expectedValue+variance*gerador.nextGaussian(); } public static Double randomChopedNormal(double expectedValue, double variance, double choppingParameter) { Double a=(1-choppingParameter)*expectedValue; Double b=(1+choppingParameter)*expectedValue; Double i=a-1; while(ib) { i=randomNormal(expectedValue, variance);} return i; } public static Boolean bernoulli() { Random gerador=new Random(); return gerador.nextBoolean(); } public static double getMaxFromArrayList(ArrayList passedArray) { double res=passedArray.get(0); int i=1; while (i<passedArray.size()) { if (passedArray.get(i)>res) res=passedArray.get(i); i++;} return res; } public static double getMinFromArrayList(ArrayList passedArray) { double res=passedArray.get(0); int i=1; while (i<passedArray.size()) { if (passedArray.get(i) passedArray) { Integer res=passedArray.get(0); int i=1; while (i<passedArray.size()) { if (passedArray.get(i)>res) res=passedArray.get(i); i++;} return res; } public static Integer getIntMinFromArrayList(ArrayList passedArray) { Integer res=passedArray.get(0); int i=1; while (i<passedArray.size()) { if (passedArray.get(i)
49

boolean startNegotiatesAtBestPrice, double startOrderPrice) { super(startDoesNothing, startNegotiatesAtBestPrice, startOrderPrice); } } package com.guilherme.orderRelated; public class MapOfBuyingOrdersValues extends MapOfOrdersValues { public int bestBuyer() { return theMap.get(theMap.lastKey()); } public Double bestPrice() { if (theMap.size()!=0) return theMap.lastKey(); else return (double) 0; } public boolean checkForTransaction(MapOfSellingOrdersValues sellingMap) { if (bestPrice()>sellingMap.bestPrice() && theMap.size()!=0&&sellingMap.getSize()!=0) {return true;} else {return false;} } public void placeOrderValue(int investorsPosition,Order passedOrder) { removeOrderOfInvestor(investorsPosition); if (!passedOrder.doesNothing && !passedOrder.negotiatesAtBestPrice) {theMap.put(passedOrder.orderPrice,investorsPosition);} if (!passedOrder.doesNothing && passedOrder.negotiatesAtBestPrice) {theMap.put(Double.MAX_VALUE,investorsPosition);} } } package com.guilherme.orderRelated; import java.util.*; import javax.swing.JTextArea; import com.guilherme.GUI.TextArea; public class MapOfOrdersValues { public TreeMap theMap; public MapOfOrdersValues() { theMap=new TreeMap(); } public void removeOrderOfInvestor(int investorsPosition) { if (theMap.size()!=0 && theMap.containsValue(investorsPosition)) {TreeMap aux=(TreeMap) theMap.clone(); while (aux.size()!=0) { if (aux.get(aux.lastKey())==investorsPosition) {theMap.remove(aux.lastKey()); aux.clear();} else {aux.remove (aux.lastKey());} } } } public void removeOrderWithKey(double passedKey) { theMap.remove(passedKey); } public int getSize() { return theMap.size(); } public void showInfo() { System.out.println("Number of orders: "+theMap.size()); } public void showInfoT(JTextArea passedText) { int i=0; Set aux=theMap.keySet(); Object[] aux2=aux.toArray(); while(i
50

public int bestSeller() { return theMap.get(theMap.firstKey()); } public Double bestPrice() { if (theMap.size()!=0) return theMap.firstKey(); else return (double) 0; } public void placeOrderValue(int investorsPosition,Order passedOrder) { removeOrderOfInvestor(investorsPosition); if (!passedOrder.doesNothing && !passedOrder.negotiatesAtBestPrice) {theMap.put(passedOrder.orderPrice,investorsPosition);} if (!passedOrder.doesNothing && passedOrder.negotiatesAtBestPrice) {theMap.put(Double.MIN_VALUE,investorsPosition);} } } package com.guilherme.orderRelated; import javax.swing.JTextArea; public class Order { public boolean doesNothing; public boolean negotiatesAtBestPrice; public double orderPrice; public Order(boolean startDoesNothing,boolean startNegotiatesAtBestPrice, double startOrderPrice) { doesNothing=startDoesNothing; negotiatesAtBestPrice=startNegotiatesAtBestPrice; orderPrice=startOrderPrice; }; public void change(boolean passsedDoesNothing,boolean passedNegotiatesAtBestPrice, double passedOrderPrice) { doesNothing=passsedDoesNothing; negotiatesAtBestPrice=passedNegotiatesAtBestPrice; orderPrice=passedOrderPrice; } public void showInfo() { System.out.println("Does nothing? "+doesNothing+" Negotiates at best price? "+negotiatesAtBestPrice+" Order price: "+orderPrice); } public void showTagedInfoT(int tag,JTextArea passedText) { passedText.append("Order from investor "+tag+": Does nothing? "+doesNothing+" Negotiates at best price? "+negotiatesAtBestPrice+" Order price: "+orderPrice); } } package com.guilherme.orderRelated; public class SellingOrder extends Order{ public SellingOrder(boolean startDoesNothing, boolean startNegotiatesAtBestPrice, double startOrderPrice) { super(startDoesNothing, startNegotiatesAtBestPrice, startOrderPrice); } } package com.guilherme.GUI; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import javax.swing.JPanel; public class Painter extends JPanel{ public int numberOfPoints; public double[] values={5,6}; int[] points; double maxValue; public static double getMax(double[] passedArray) { double res=passedArray[0]; int i=1; while(i<passedArray.length) {if (passedArray[i] rel="nofollow">res) res=passedArray[i]; i++;} return res; } public static double getMin(double[] passedArray) { double res=passedArray[0]; int i=1;

51

while(i<passedArray.length) {if (passedArray[i]
52

Related Documents

Final Report 2
October 2019 8
Final Report 2
April 2020 4
Final Report 2
May 2020 5
Final Report 2 --
November 2019 7
Final Mana Report 2
June 2020 5
Annual Report Final 2
April 2020 15