How quick could you get rich if you had the perfect trading algorithm that predicted future market moves with perfect accuracy? It is rather simple to estimate on historical data, and the results are rather shocking. At the time of writing, you could have made 62% in the last 24 hours by trading eight of the largest market cap crypto currencies. Hover over the line to see the optimal transactions (fees are taken into account, thus the small dip at each transaction):

A daily updated version of this graph is available here

The upper bound mostly exploit opposing moves between currencies. Even on a mediocre day a lot of opportunities abound:

### Method

One approach to calculating the upper bound of maximum returns in a given market is to make use of the Bellman Ford shortest path search algorithm commonly used in arbitrage. The only difference between trading and arbitrage is that the former has the added dimension of time.

In this demonstration, we assume that there was always enough liquidity available at any point in time to perform the desired trades. Instead of incorporating the price move of every single transaction, I use values sampled at 5-minute intervals to add the time dimension to our arbitrage problem. I will use a trading and selling fee of 0.25% per transaction.

Graph construction is as simple as connecting all nodes at one point in time to all nodes at the next with edge weights equal to the logarithm of the ratios of values, adjusted for fees, taxes and optional penalties as a tuning parameter. Calculating the returns involves multiplying all the exchange rates that occur along a particular path. Since the sum of logarithms of a set of numbers is equal to the logarithm of the product of those figures, assigning edge weights as logarithms of value ratios allows for the shortest path search algorithm to find the best route according to a summation rule. The Bellman Ford algorithm allows negative edge weights, which you would invariably encounter whenever a future value is less than a current value, resulting in a ratio lower than unity.

### Stability

It is interesting to note that the historical chain of transactions is not stable; a single additional data point can drastically change the shortest path. I will explore this instability in a future post.