Currently exchanges are ranked based on their volume. It's not a bad idea, but there are some problems with it. There's a big difference between volume on exchanges with or without fees. Even on exchange with fees, some big players with low fees can influence it heavily. It's also very hard to verify.
Apart from volume there's another useful information available - order book. The deeper the better. Being able to execute a big order without moving the price too much seems to be a good indicator that the exchange should be ranking high.
Unlike reported volume, order book can be (at least partially) verified. Somebody can try to execute an order against it.
Ranking must not be easy to manipulate. Having some big wall at $0.1 does not make you a great exchange. Clearly, open orders that are closer to the current price are more imporant.
But how close? When Bitcoin price is changing 10% per day, then surely those orders 10% away from the price are important. But if it stabilizes and only changes 0.1% for weeks, then some wall 10% away from the price is not very relevant. It shouldn't influnce the ranking.
To solve this problem we weight open orders based on how long ago given price was achieved.
Let's first take a look at an example orderbook with plotted amount of days since given price was present:
And now, jumping ahead, this is how weights assigned to these orders will look like (weigths are assigned to single orders, even though you see cumulative order book here for clarity):
As you can see, more weight is given to orders at prices that were present lately.
For given order, If we assume that d is number of days ago since we've last seen given price, the weight is:
Where g is a param that shapes how quickly should weight decay with days. I assumed g = 1⁄5, which makes orders at the price that was present 5 days ago two times less important than those at the price that was present today. This param is sucked out of my thumb and its value is open for discussion.
To be super clear, here's the chart how weight depends of number of days since given price was present.
When testing different values of g, it did not change ranking much. Higher values make rank more prone to manipulation with orders that are unlikely to get executed. Lower values make rank more noisy for shorter timespans.
Every rank calculation is based on a single order book. When you see e.g. 24h rank, it's an average rank of all order books collected during that time (for popular exchanges full order books are fetched every few minutes).
The general idea is that we're measuring money stored in the orderbook, giving more attention to the fresh one, to make manipulation of rank more difficult.
We can put it as:
Let's focus on asks first. Asks are associated with bitcoins stored on the exchange.
We just want to sum that, assigning weight to each order:
In case of bids it's the fiat that is stored, not bitcoins. Amount of fiat can be calculated as: . We want to add bids and asks rank at the end, so they need to have the same unit. To get amount in bitcoins we divide this amount of fiat by current bitcoin price:
To be consistent current price is also based on the orderbook and not trades:
And that's it. The results can be seen on data.bitcoinity.org
Thanks for getting through it. I'm open to ideas and suggestions. If you think something could be made more clear in the explanation or you found some errors, please let me know. This thing is new and the discussion is currently happening here ( previous one )