# Analyzing the Market – Part 2

This is part 2 of my series of posts on the statistics of financial markets. Part 1 is here.

I have established that a double exponential distribution fits price movements when they are converted to log prices, at least for bitcoin, Apple, and Dell. (Actually I have checked it on a few other NASDAQ stocks too.)

Once we have a statistical model, we can generate some data to see if it produces results that look like the actual price graph. Below you can see the real 2 month bitcoin price graph, together with two graphs that were obtained by using a model based on the double exponential distribution of log prices. The graphs were obtained by generating random fluctuations using the double exponential distribution and then integrating them to get a log price curve. This was then converted back to linear prices, and gave the following results:

The two model runs are for different choices of random numbers. Both were started at a price of \$400 on the left and had a slight bias that made it likely that their prices would rise with time. From this you can see that, superficially, the exponential probability distribution does a good job of capturing the kind of variations that are found in the bitcoin price over this two month period.

If this model accounted for all the statistics of the bitcoin price, then it is certain that it would be impossible to predict what will happen next. This is because it is generated by a purely random walk where each new fluctuation is independent of all the ones that came before.

In fact the double exponential distribution suggests a simple trading behavior. If the distribution of traders’ wealth is exponential, then some traders will trade large amounts, and others small amounts. Therefore in each interval we could simply pick a trader, randomly assign them to place a buy or sell order, and then they would move the price by an amount that is proportional to their exponentially distributed wealth. This would give the right statistics.

One reason why its important to understand this statistical model is that it accounts for noise in the price data that we fundamentally cannot predict. The approach could be to find a way to pull out all the lower order statistics like this to see what remains in terms of longer term price change structure.

The important question is, are there other correlations over time which are not captured by the exponential model? The answer is yes, and it is easy to demonstrate.

The pair of graphs above show the model’s price movements in red, and the real bitcoin data in green (offset so that you can compare them). It can be seen from this, that the model has a very even structure because its exponential distribution stays constant with time. Even though the overall distribution of the bitcoin graph has the same overall statistic, in actual fact, it varies a lot with time. In particular, there are periods where the price fluctuations are large, and other times when fluctuations are small. These bunched regions show that something else is going on. It can only really be seen on this time derivative graph and is not so obvious on the normal price graph.

What causes these variations in the size of the price fluctuations? Well one thing is that highly variable prices correspond to periods of high interest from people buying and selling. Take a look at the following graph:

In red you see the log of the trading volume for bitcoin, and below it you can see the same time derivative of log price as we had before, but here I have taken the absolute value of it so that it is always positive. It’s clear that large volumes correspond often to large values of the price changes. The correspondence looks very good, to the point where you might imagine that you could predict the size of the fluctuations from the volume graph.

Also interestingly, taking the absolute value shows that for the periods of time where the fluctuations are large, there are actually very few derivative values that are close to zero (hence the gaps underneath the green curve). In other words, there are only large positive or negative changes in the price, and small changes become rare.

During periods of high interest in a security, more people trade it, and it seems that the same exponential distribution of fluctuations is present, only the traders are making bigger bets.

It would be interesting to use the MtGox API to determine the distribution of trade sizes in dollars for set intervals, and see if this is exponential and remains the same over the long term.

Looking at the graph below, which shows a scatter plot of log price changes versus volume, it can be seen that large price changes often are correlated with large volumes, and small price changes are often associated with low volumes, although clearly there is a lot of variability. This is for a two month period, but a similar plot is obtained when looking at data over a whole year.

In the next post, I’ll look into the time correlation of price movements.

Analyzing The Market – Part 3