# Differential Evolution VQE for Crypto-currency Arbitrage. Quantum
Optimization with many local minima.

Gines Carrascal  Department of Informatic Systems and Computation, Faculty of
Informatics, Complutense University of Madrid, 28040 Madrid, Spain  IBM
Quantum, IBM Consulting España, 28830 Madrid, Spain
<EMAIL_ADDRESS>Beatriz Roman  Data Science, PwC España, 28830
Madrid, SPAIN  Guillermo Botella  Department of Computer Architecture and
Automation, Faculty of Informatics, Complutense University of Madrid, 28040
Madrid, Spain  Alberto del Barrio  Department of Computer Architecture and
Automation, Faculty of Informatics, Complutense University of Madrid, 28040
Madrid, Spain

###### Abstract

Crypto-currency markets are known to exhibit inefficiencies, which presents
opportunities for profitable cyclic transactions or arbitrage, where one
currency is traded for another in a way that results in a net gain without
incurring any risk. Quantum computing has shown promise in financial
applications, particularly in resolving optimization problems like arbitrage.
In this paper, we introduce a differential evolution (DE) optimization
algorithm for Variational Quantum Eigensolver (VQE) using Qiskit framework. We
elucidate the application of crypto-currency arbitrage using different VQE
optimizers. Our findings indicate that the proposed DE-based method
effectively converges to the optimal solution in scenarios where other
commonly used optimizers, such as COBYLA, struggle to find the global minimum.
We further test this procedure’s feasibility on IBM’s real quantum machines up
to 127 qubits. With a three-currency scenario, the algorithm converged in 417
steps over a 12-hour period on the "ibm_geneva" machine. These results suggest
the potential for achieving a quantum advantage in solving increasingly
complex problems.

Keywords: Quantum Computing, Optimization, Differential Evolution, VQE,
Arbitrage

##  1 Introduction

For millennia, commercial practice was based on a combination of barter and
other means of exchange and, it was not until the introduction of coinage in
the Greek regions at the late seventh century BC, that the first roots of
arbitrage were born. Ancient arbitration was related to the trading of coins
and ingots for profit, thus giving rise to the first desire to develop this
practice [16].

Arbitrage could be defined as a financial strategy in which the investor
obtains a profit from the difference in price of the same financial asset
between different markets, this being a risk-free operation. The basic idea of
this concept is to carry out complementary operations (buying and selling)
taking advantage of market irregularities [19]. The importance of simultaneity
of transactions in arbitrage is crucial to avoid exposure to market risk or
execution risk, the latter being the risk that prices change before the
purchase and sale of the asset has been completed. This pursues that the
arbitrage is opposite to the idea that the market is perfectly efficient and
all the assets converge to the same price [9].

Due to their properties, financial products that are digitally traded are
ideally suited for arbitrage. That is why, with the emergence of digital
assets, the crypto-currency market has burst with great force. In this case
and unlike traditional markets, they lack of a centralized exchange, so it is
an immature market where there are periods with great arbitrage opportunities
[9].

To acquire cryptocurrencies it is necessary to go to an exchange or
cryptobank. There are currently more than six hundred exchanges worldwide,
with Binance, FTX or Coinbase being the best-valued exchanges with the highest
trading volume to date [5]. Therefore, arbitrage opportunities emerge from the
price difference between the different exchanges as it is an unregulated
market. In this line, there are several types of cryptocurrency arbitrage
depending on the number of assets traded and the different exchanges involved.
If two cryptocurrencies are bought and sold between two different exchanges,
we would be talking about parallel arbitrage. If three cryptocurrencies and
two or even three different exchanges are involved, it would be a triangular
arbitrage. It is important to note that, in order to carry out these two types
of arbitrage, it is necessary to have the cryptocurrencies to be traded in all
the exchanges involved. The rebalancing technique, known as the action of
sending cryptocurrencies between different exchanges, is usually subject to
the payment of commissions. This is the reason why the arbritage intraexchange
is one of the most used and therefore the one that allows the most operations
to be made. The process consists in transferring the capital from one
cryptocurrency to another, always starting and ending in the same one thus
being able to avoid commissions [1]. Throughout this paper we will focus on
the latter type of arbitration.

This paper is organized as follows: Section 2 contextualizes the ccurrent
approaches to arbitrage throug quantum. Section 3 introduces the idea of
quantum optimization using VQE. Section 4 explains the implications of
arbitrage problem. Section 5 describes the possibilities of using quantum
computing for arbitrage. Section 6 introduces diferential evolution as well as
its benefits and drawbacks. Sections 7 introduces the model with 3 currencies,
Sections 8 expand the model to 4 currencies, and Section 9 describes the
quantum algorithms that can be applied to real data from 5 crypto-curencies,
and details the considerations we take with real quantum computers. Section 10
contains our conclusions.

##  2 State of the art

Given the multitude of opportunities offered by the cryptocurrency market
[12], trading algorithms have been developed to exploit short-term arbitrage
opportunities, thus making a profit from optimization algorithms [9]. This is
why quantum computing emerges as a complementary and more efficient
alternative in certain processes with a greater speed and versatility
unattainable by classical computing.

The auge of machine learning research has also reached finance. Consequently,
initial machine-learning-based statistical arbitrage strategies have emerged
[6]. Also there are authors that ptopose mechanism to autoregulate the
cryptocurrency market and compensate arbitrage opportunities [10, 22].

Especially in the banking sector, the importance of quantum computing in
solving optimization algorithms has been demonstrated. In this sector,
problems try to be simplified by reducing the number of possible solutions,
which is why quantum computers can become very useful when the number of
variables, and therefore the complexity of the problem, increases. Given the
computational intensity of financial problems, increasingly more institutions
are betting on the use of quantum technology to solve arbitrage problems as
well as portfolio optimization and price scoring. It is expected that the
limits of quantum computing will be progressively reduced in order to take
advantage of the full potential of this technology in the near future [2].

Many industries are trying to develop quantum algorithms to address financial
problems. In particular, companies such as IBM and McKinsey see optimization
as one of the most in-demand use cases in the financial industry [3]. This is
because most financial problems can be formulated as optimization problems,
which is a particularly challenging task for classical computers. This is
where the application of quantum algorithms makes it possible to easily solve
such problems [14].

In the case of financial arbitrage, the problem can be formulated as a graph
in which the different assets are the vertices. In 2007, Wanmei Soon and Heng-
Qing Ye proposed a binary optimization model based on binary integer
programming (BIP) by which the unboundedness problem of classical linear
programming (LP) solving was solved. In this model, the authors established
the existence of a feasible solution and a bounded objective function value
[20]. Later in 2016, Rosenberg introduced several key ideas in arbitrage
algorithms. First, the difference between detecting an arbitrage opportunity
and detecting the optimal arbitrage solution, thus creating an alternative
that not only finds the best solution, but those closest to it. To this end,
he introduced quantum resolution by transforming the Wanmei Soon and Heng-Qing
problem into a quadratic binary unconstrained binary optimization (QUBO)
problem by rewriting the constraints as penalty terms. In addition, Rosenberg
developed an alternative model that included backward arbitrage strategies,
that is, the same asset (vertex) could be revisited [14].

To the best of our knowledge, these work is the firs aplying quantum
optimization with a differential evolution approach to the arbitrage problem.
There is a work from Zhuang et al. that proposes quantum algorithms for high-
frequency statistical arbitrage trading, which is not exactly the same problem
and in a different approach [23].

In March 2017 Qiskit was launched, a software designed to create quantum
algorithms, connect them to a back-end device and run them on simulators and
real hardware [18]. In it, quadratic optimization models can be created using
DocPLEX. IBM Decision Optimization CPLEX for python, known as DocPLEX, is an
optimization software that solves quadratic models (QP), i.e. models with
linear constraints and objective function with one or more quadratic terms.
CPLEX can also solve convex problems efficiently [7]. Once the quadratic
problem is modeled, it is converted to QUBO to be solved applying quantum
computing.

To date, there is still a large gap between the resources available on current
hardware and those demanded by some of the most relevant quantum applications.
However, quantum research is advancing rapidly and increasingly more companies
are betting on the research and use of quantum software. Big companies or new
startups specialized in quantum computing in finance and economics, are
working on the creation of new combinatorial optimization algorithms
applicable to arbitrage with main banking institutions [11].

##  3 Variational Quantum Eigensolver (VQE)

Despite the evolution of quantum software, many quantum optimization
algorithms have hardware requirements that exceed the capacity of current
quantum computers and may even fail to run.

Figure 1: Hybrid quantum-classical algorithm.

That is why, in 2014 Peruzzo and McClean et al. [15] developed VQE
(Variational Quantum Eigensolver) a hybrid quantum-classical algorithm capable
of finding variational solutions to problems that are not supportable by
classical computers. Fig. 1 shows the processing cycle between a quantum and a
classical processor. VQE has an advantage over classical algorithms in that a
quantum processing unit can represent and store the exact wave function of the
problem, which is extremely difficult for a classical computer [13].

The VQE algorithm starts with a parameterized quantum circuit called ansatz
and searches for the optimal parameter for this circuit using a classical
optimizer. The ansatz is varied, via its set of parameters, by the optimizer,
such that it works towards a state, as determined by the parameters applied to
the ansatz, that will result in the minimum expectation value being measured
of the input operator which is a Hamiltonian as (1). The Ising Hamiltoninan,
$H$, can be decomposed as a sum of Pauli terms and with its ground state
(minimal energy state) corresponding to the optimal solution of original
optimization problem.

Given $H$, with an unknown minimum eigenvalue $\lambda_{min}$, associated with
an eigenstate $|\psi_{min}\rangle$, VQE provides an estimate
$\lambda_{\theta}$ bounding $\lambda_{min}$ where $|\psi(\theta)\rangle$ is
the eigenstate associated with $\lambda_{\theta}$. By applied the ansatz,
$U(\theta)$, to some arbitrary starting state $|\psi\rangle$, VQE obtains an
estimate $U(\theta)|\psi\rangle\equiv|\psi(\theta)\rangle$ on
$|\psi_{min}\rangle$. This estimate is iteratively optimized by the classical
optimizer changing the parameter $\theta$ minimizing the expectation value of
$\langle\psi(\theta)|H|\psi(\theta)\rangle$ [13].

$\lambda_{min}\leq\lambda_{\theta}\equiv\langle\psi(\theta)|H|\psi(\theta)\rangle\leavevmode\nobreak\
.$ (1)

Using Qiskit, the Ising Hamiltonian can be obtained from a QUBO type problem
created with DocPLEX. That is, a quadratic, binary and unconstrained problem.
This aspect will be detailed in future sections.

In addition, it is possible to define the quantum circuit of the ansatz. There
are several ways to create the ansatz, one of the most used is to create a
heuristic circuit called Real Amplitudes. This type of circuit consists on
alterning layers of gates Y rotations (purple gates in Fig. 2) and CNOT
entanglements (blue gates in Fig. 2). Depending on the type of entanglement
between the qubits we can create different ansatz as shown in Fig. 2.

Figure 2: Types of entanglement on the Ansatz.

It is also possible to set the number of repetitions, in this case, Fig. 2 has
two repetitions and they can be distinguished by the barriers of the circuit.
Different ansatz can lead to different solutions in the optimization
algorithm, so it is interesting to adjust these two hyper-parameters.

##  4 Arbitrage as an optimization problem

As mentioned, there are several types of crypto-currency arbitrage and, in
this case, we will illustrate the problem of intra-exchange arbitrage in which
$n$ currencies are involved and the exchange rate between these $n$ currencies
is calculated. As we recall, in this type of arbitrage only a single exchange
is involved.

To illustrate the problem, the exchange prices of three crypto-assets will be
simulated. This is because to solve the problem quantumly, it is necessary to
connect to a quantum simulator in the cloud and therefore, the execution time
is much higher than if we execute the problem on a real quantum computer,
which would take milliseconds. That is why, first we will pose a small-scale
problem with simulated data to test which optimizers work better and later, we
will increase the number of crypto-assets and simulate a problem with real
data.

Originally, and in order to set up the model, the problem can be presented as
a graph as shown in the Fig. 3. In this case we have three crypto-assets with
a clear arbitrage opportunity.

Figure 3: Exchange rates between three crypto-currencies and the transit price
matrix.

###  4.1 Initial formulation of the problem

The first step in solving the arbitrage problem is to set up the optimization
model. In this case, in (2) an objective function is posed where the profit is
maximized based on the exchange rates. We take logarithms of the elements of
the transit matrix, $\Sigma\in\mathbb{R}^{nxn}$, and two constraints are
established. The first establishes a closed arbitrage circle, i.e., it must
start and end in the same currency, while the second establishes that each
currency can only be traded once. Notice that $x\in\\{0,1\\}^{n\times n}$
denotes the matrix of binary decision variables, which indicate which edge to
pick ($x[i]=1$) and which not to pick ($x[i]=0$). In this problem we will
assume that the commissions are included in the transit matrix. Remember that
the model will be computationally created with DocPLEX for easy conversion to
quantum mode.

$\displaystyle\quad\max_{x\in\\{0,1\\}^{nxn}}x\Sigma\leavevmode\nobreak\ ,$
(2) s.t:
$\displaystyle\quad\sum_{i=1}^{n}x_{ij}=\sum_{j=1}^{n}x_{ij}\leavevmode\nobreak\
,$ $\displaystyle\quad\sum_{i=1}^{n}x_{ij}\leq 1\leavevmode\nobreak\ .$

Fig. 4 shows the result of running the optimization algorithm classically.

Figure 4: Solution of the arbitrage optimization problem: best arbitrage path.

In this case, the profit rate was 23, that is the difference between the
initial value, and the value obtained after the loop. The disadvantage of
using only the classical method is that the arbitrage problem scales, that is,
the classical algorithm calculates the result by "brute force" by trying all
possible combinations, which is why if we add more crypto-assets to the
problem and, therefore, to the graph, the problem would grow exponentially.
For this reason, a quantum-classical method is necessary.

###  4.2 QUBO transformation

To apply the quantum method it is necessary to have the problem in QUBO form.
If we remember, it is a binary, unconstrained and quadratic problem. The first
step is to convert the inequality constraints into equality using slack
variables, the signs of these variables depend on the inequality symbol.
Successively, our model was originally a binary model, but when introducing
the slack variables, it is necessary to convert these to binary as well. The
last step is to convert the model to an unconstrained model. Up to this point,
the model had equality constraints, so to remove them, they will be converted
into additional quadratic penalty terms of the objective function. All in all,
we would have a quadratic, binary, unconstrained problem just as we needed.
These four steps are reflected in Fig. 5 where the evolution of the model
until the QUBO format is achieved can be seen. To solve this problem we will
need 9 qubits as we have 9 variables.

Figure 5: QUBO steps.

##  5 Quantum computing for arbitrage

As seen in the previous section, quantum computing makes use of a hybrid
quantum-classical algorithm, VQE, to solve optimization problems. If we
recall, three elements are needed to apply VQE: the Ising Hamiltonian, a
classical optimizer and the ansatz.

First, we need to calculate the Ising Hamiltonian, for this, the QUBO model is
used. As we already know, the Hamiltonian is expressed as the Pauli gate
decomposition, (3) shows a part of the Hamiltonian of the problem. As we can
see, it uses I and Z gates.

$\displaystyle-1.395\cdot IIIIIIIIZ$ (3) $\displaystyle-1.539\cdot IIIIIZIII$
$\displaystyle-1.742\cdot IIIIZIIII$ $\displaystyle-2.089\cdot IIIIIIIZI$
$\displaystyle...$

One of the most used classical optimizers in quantum computing due to their
good results is the Constrained Optimization by Linear Approximation, COBYLA.
This optimizer is suitable when noise is not present in the cost function
evaluation and it also performs only one evaluation of the objective function
per optimization iteration (the number of evaluations is independent of the
cardinality of the parameter set) [17].

To solve the arbitrage problem using VQE in conjunction with COBYLA, the
ansatz quantum circuit must be established. As we saw in the previous section,
the ansatz has two hyper-parameters, entanglement and repetitions. Therefore,
different combinations of these hyper-parameters have been tested in search of
relevant conclusions.

As we can see in Table 1 the configuration of the ansatz entanglement that has
managed to reach the optimal solution regardless of the number of repetitions
has been SCA. However, using three repetitions, the optimal solution is also
achieved in all the entanglements.

Table 1: Hyper parameters that reached the optimal solution. | Entanglement
---|---
Reps | Full | Linear | Circular | SCA
1 | $\times$ | $\checkmark$ | $\times$ | $\checkmark$
2 | $\times$ | $\times$ | $\times$ | $\checkmark$
3 | $\checkmark$ | $\checkmark$ | $\checkmark$ | $\checkmark$

In the entanglements where the optimal solution has not been reached, the
algorithm has found a solution that does not correspond to the global maximum
of the problem. Fig. 6 shows a comparison of a local arbitrage solution with a
1.99 profit rate achieved by an ansatz using two repetitions and full
entanglement versus the optimal solution where a gain of 23 is achieved. The
main difference is that, although the local solution is feasible, it involves
only two currencies.

Figure 6: Comparation of a local and a global solution.

During the rest of this study, we will use SCA ansatz with only one repetition
to maintain the depth of the circuits at the minumum for best performance on
real devices. Under this circunstances, as you can see in 2, the SCA and the
Circular are the same.

##  6 Differential Evolution Global Optimization

Although finding local solutions is feasible, when it comes to arbitrage we
want to find the global solution that brings us the greatest benefit. As the
number of crypto-currencies increases and, therefore, the complexity of the
problem, a multitude of local solutions can arise and in the case of COBYLA we
will not always find the optimal solution, but given the multitude of
possibilities it can be halfway.

Fig. 7 shows a possible inverse scenario of this type of problem. As can be
seen, there are a multitude of local minimums, increasing the likelihood that
the algorithm will stay with one of them. We want to achieve the global one
and for this reason, a new algorithm is proposed to try to find it.

Figure 7: Global solution scenario.

Differential evolution is an evolutionary global optimization algorithm, quite
related with the genetic algorithm, that does not use gradient information and
is therefore well suited to nonlinear non-differential objective functions. It
is an algorithm whose operation is based on maintaining a population of
candidate solutions represented as real-valued vectors. New candidate
solutions are created by making modified versions of existing solutions that
then replace a large part of the population each time the algorithm makes a
new interaction, i.e., the base solutions are replaced by their children if
the children have a better evaluation of the objective function.

This algorithm has a number of hyper-parameters such as _strategy_ , which
controls the type of differential evolution search that is performed. We will
set a _best1bin_ search which involves creating new candidate solutions by
selecting random solutions from the population, subtracting one from the other
and adding a scaled version of the difference to the best candidate solution
in the population. There are also other important parameters such as _popsize_
, which controls the size or number of candidate solutions that are kept in
the population. The _tolerance_ can also be adjusted, so the lower this value,
the less permissive the algorithm will be [21].

Algorithm 1 Differential Evolution Minimum Eigensolver.

1:An operator representing the problem, an ansatz (parametrized circuit) to
represent each individual, a number of individuals n, a Qiskit Runtime
Session.

2:An eigenstate of the operator.

3:Create a initial generation of n ansattzs (random parameters).

4:Use Qiskit Runtime Estimator to calculate the expectation values of the
operator for all individuals in the generation within a Session.

5:apply scipy.optimize.differential_evolution to calculate the next generation
and iterate.

6:Once reached convergence, use Qiskit Runtime Sampler to evaluate the ansatz
with the selected parameters.

7:Return the eigenstate.

We will use differential evolution as an optimizer to apply VQE to the
arbitrage problem. However, Qiskit does not have a default function for
applying differential evolution. Therefore, as described in Algorithm 1, a
function has been created from scratch to be able to apply this method. The
optimal solution with this optimizer was reached with a tolerance of 0.001,
population size 15 and using 5 interactions at most. Likewise, an ansatz with
1 repetition and SCA type entanglement was used.

Figure 8: Expected value for individual circuit evaluations during the
optimization. COBYLA (left), Differential Evolution(right).

Both COBYLA and the differential evolution optimizer managed to reach the
global optimum, however there is a substantial difference between them. Both
seek to minimize the expected value of the Hamiltonian since both are
optimizers that are used in conjunction with VQE. However, as can be seen in
Fig. 8, COBYLA has a behavior similar to gradient descent, when the algorithm
finds a minimum it tries to look for solutions around that minimum. On the
other hand, the differential evolution tries different candidate solutions by
modifying the population through the popsize parameter, that is why the
expected value does not have such a marked decrease but fluctuates when
calculated with new candidates.

##  7 Arbitrage with three crypto-currencies

As shown in 5, we have used the 3 currency scenario in simulators to make the
hyperparameter search for the most interesting combination to test on real
hardware.

For execution on real hardware we have selected 1 repetition circular
entangled ansatz due to its best fit on the topology of the IBM real quantum
computers [4].

The main result was a 3 currency scenario that required an ansatz of 9 qubits,
executed on "ibm_geneva", a Falcon r4 QPU with 27 qubits, and quantum volume
of 32:

  * •

Basis gates: CX, ID, RZ, SX, X

  * •

Largest Pauli Error: 9.966e-4

  * •

Largest CNOT Error: 7.725e-3

  * •

Median T1: 353.86 $\mu s$

  * •

Median T2: 197.83 $\mu s$

Diferential evolution algorithm executes batches of 64 circuits with 4000
shots each in an average of 104 seconds for each generation. Convergence to
the global minimum was reached in 417 steps with a total time of 12 hours.

In Table 2 there is a summary of the results obtained with 27 qubit machines
on 3 asset problem.

Table 2: Three currencies on 27 qubit machine. name | QPU | circuits/batch | time(sec)/ batch
---|---|---|---
ibm_geneva | Falcon r4 | 64 | 104

##  8 Arbitrage with four crypto-currencies

Analogous to the arbitrage problem with three crypto-assets, a problem
involving four crypto-assets is proposed to test its scalability. In this
case, Fig. 9 shows the exchange rate graph and the price transition matrix
with a clear arbitrage opportunity. The classical solution of this problem
yielded a result with a profit rate of 118.99, which is quite an optimistic
result which involved all four crypt-ocurrencies.

Figure 9: Exchange rates between four crypto-currencies and the transit price
matrix.

To solve the problem in quantum form it is necessary to follow the steps
detailed in the previous section, i.e., convert the problem to QUBO, create
the Hamiltonian and configure the ansatz. However, in this case we will use
VQE with the differential evolution optimizer due to the good results obtained
in the model with three assets and to try to find the global maximum.

Figure 10: Differential evolution solution with four crypto-currencies.

Fig. 10 shows the optimal solution and the expected value plot of the
differential evolution optimizer. It can be seen that the algorithm takes more
iterations and thus, more time to get the minimal expected value.

To reach this solution, the ansatz configuration was set to one iteration with
SCA interleaving. This gives us the idea of the importance of choosing both
the hyper-parameters of the ansatz and of the optimizer itself. To get the
best suitale parameters we have performed an extensive hyperparameter search
and validations.

##  9 Real-data application with five crypto-currencies

In this section we will present a case of real intra-exchange crypto-currency
arbitrage with five assets. One of the main complications of using real data
is that, given the variety of crypto-currencies and the great inequality in
price and quote of them, the optimization problem presents a transition matrix
with exchange rates very close to zero, which makes it difficult to find a
solution.

For this reason, in order to tackle this problem it is necessary to normalize
the transition matrix. Starting from the idea that from each crypto-currency
we can buy even cents, a vector with the normalization coefficients of each
asset is established.

In this way, we get the transition matrix of Fig. 11.

Figure 11: Transition matrix and graph of the crypto-currency of five assets.

The procedure to solve this problem is analogous to the previous cases, i.e.,
the problem needs to be transformed to QUBO to apply VQE with the differential
evolution optimizer.

Due to the multitude of variables, more qubits are needed to solve the
problem, specifically 25.

###  9.1 Qiskit Runtime on IBM cloud "simulator_mps"

We run a simulation using Qiskit Runtime on the IBM cloud "simulator_mps".
Using the differential evolution optimizer, we send batches of 256 parametric
circuits to the Qiskit runtime, with an average time of execution of 6
minutes. It converges after 469 steps of differential evolution (Fig. 12),
taking 47 hours overall.

Figure 12: Simulator convergence in 5 real currencies.

The solution obtained is shown in Fig. 13

Figure 13: Transition matrix and graph of the crypto-currency of five assets.

###  9.2 "ibm_hanoi", a Falcon r5.11

To compare the performance with the 27 qubit real machines, we have executed
the 5 currency scenario on "ibm_hanoi", a Falcon r5.11 QPU with 27 qubits, a
quantum volume of 64 and 2.3K CLOPS:

  * •

Basis gates: CX, ID, RZ, SX, X

  * •

Median CX Error: 9.232e-3

  * •

Median SX Error: 1.977e-4

  * •

Median Readout Error: 1.250e-2

  * •

Median T1: 157.54 $\mu s$

  * •

Median T2: 158.15 $\mu s$

This machine executed 256 circuits with 4000 shots each in 525 seconds. A
limited number of steps was made to be able to measure times. This experiment
was stopped before reaching convergence in less then 24 hours.

###  9.3 "ibm_washington" Eagle r1

To evaluate the applicability of the methodology, we have executed diferential
evolution on real 127 qubit machines. Executing in a bigger machine enables to
find a best suitable path in the chip to map the circuit in an efficient way,
avoiding swap gates and obtaining a shorter circuits, and thus less acumulated
noise. On the other hand, bigger machines possess less CLOPS, so the execution
time is longer.

We have tested the 5 real currencies scenario in two different generations of
the IBM Eagle processor. In Fig. 14 we can see the 25 qubit ansatz used for
this experiments.

Figure 14: Ansatz for the 5 currencies scenario (25 qubits, circular
entanglement).

The "ibm_washington" ia a first generation Eagle, with Quantum Volume of 64
and CLOPS of 850:

  * •

Basis gates: CX, ID, RZ, SX, X

  * •

Median CX Error: 1.258e-2

  * •

Median SX Error: 2.870e-4

  * •

Median Readout Error: 1.260e-2

  * •

Median T1: 96.7 $\mu s$

  * •

Median T2: 82.25 $\mu s$

For each step, it ran 256 circuits with 4000 shots each run in 1147 seconds.
The experiment was stopped before reaching convergence in less then 24 hours.

###  9.4 "ibm_brisbane" Eagle r3

TThird generation Eagle. The novelty in this machine is the change in the
basis gates, implementing the less noisy two qubit gate ECR instead of CX.

  * •

Basis gates: ECR, ID, RZ, SX, X

  * •

Median ECR Error: 7.601e-3

  * •

Median SX Error: 2.184e-4

  * •

Median Readout Error: 1.360e-2

  * •

Median T1: 242.56 $\mu s$

  * •

Median T2: 133.59 $\mu s$

It was able to ran 256 circuits with 4000 shots each run in 926 seconds. As
the previous ones, this experiment was also stopped before reaching
convergence in less then 24 hours.

Table 3: Executions for five currencies on real quantum machines. name | QPU | circuits/batch | entanglement | time(sec)/batch
---|---|---|---|---
ibm_hanoi | Falcon r5.11 | 256 | linear | 525
ibm_brisbane | Eagle r3 | 256 | circular | 926
ibm_washington | Eagle r1 | 256 | circular | 1147

In Table 3 there is a summary of the results regarding the time needed per
differential evolution generation (batch) obtained with the real quantum
machines.

It is important to notice that we have achieved convergence and found the
global minimun using a simulator. In real machines we have made some test to
validate the viability of the methodology, but based on the number of
generations in the simulator and the time taken on real computers, in these
current machines the algoritmn will probably need several days of computation,
which is too time consuming for this use case. These experiments show the
importance of parallelization on the future of quantum computing.

The only related study we have found about applying quantum computing to
arbitrage is the study from Wang et al [22]. Proposes quantum algorithms for
high-frequency statistical arbitrage trading, which is a quantitative trading
strategy that exploits price differences between correlated assets. The
quantum algorithms use variable time condition number estimation and quantum
linear regression to reduce the complexity of finding cointegrated pairs of
stocks. That is a complete different approach to the arbitrage problem. In our
work we study the overall landscape of posible exchange paths to find
arbitrage opportunities in long chains of exchanged assets instead of instant
diferences between two assets.

##  10 Conclusion

Quantum computing emerges as a new technology complementary to classical
computing to address complex problems, with a special focus on financial
problems such as arbitrage. In a world where digital assets represent the
future, crypto-currency arbitrage arises as an optimization problem.

In the present work, we have tried to address crypto-currency arbitrage by
proposing a quantum-classical approach by means of hybrid algorithms such as
VQE. For this purpose, the scalability of the problem has been tested starting
initially with three assets and finally including up to five crypto-
currencies. The proposed model has been converted to QUBO format to make use
of VQE and, several optimizers such as COBYLA and Differential Evolution
together with a suitable configuration of the ansatz quantum circuit, have
been tested in search of the global maximum of the problem.

Differential evolution has pros and cons. We have demonstrated that it has the
ability to reach to the global minima, but to do so it has to pay the increase
in the number of executions of quantum circuits. A interesting property of
this algorithm is that all the circuits for a generation can be run in
parallel. This could be a futute advantage when multiple parallel quantum
systems will be available [8].

It is precisely the scalability of the problem that means that adding more
assets, increases the complexity of the problem. Despite the good results for
three assets, for the rest of the cases the importance of the hyper-parameters
adjustment is highlighted in order to reach the global solution. Moreover, due
to the inequalities of exchange rates in the crypto-currency field, solving a
problem with real data requires normalization of the exchange rate transition
matrix to obtain accurate results.

As quantum computing evolves and begins to tackle practical problems, we must
pay greater attention to how much work quantum computing systems can do in a
given unit of time. Increased quantum processor speed is critical to support
near-term algorithms based on the variational method, which requires thousands
of iterations.

Nevertheless, it is a growing technology and especially in the field of
crypto-currency arbitrage there is still a lot of research to be done. As
future lines of research we are working in novel ways of encoding the problem
to the Hamiltonian in order to be able to represent more QUBO variables using
less qubits. Also a fine tuning in the multiple hyperparameters of the
differential evolution has to be done to enhance the convergence and reduce
the number of generations needed to achieve it.

## Acknowledgment

This work was supported by grant PID2021-123041OB-I00 funded by MCIN/AEI/
10.13039/501100011033 and by “ERDF A way of making Europe” and by the CM under
grant S2018/TCS-4423.

We acknowledge the use of IBM Quantum services for this work. The views
expressed are those of the authors and do not reflect the official policy or
position of IBM or the IBM Quantum team.

## References

  * [1] Daniel Aldeano Moreno.  Estrategias de arbitraje con criptomonedas.  Universidad Carlos III de Madrid, Madrid, 2020.
  * [2] Francesco Bova, Avi Goldfarb, and Roger G. Melko.  Commercial applications of quantum computing.  EPJ Quantum Technology, 8(1):1–13, December 2021.  Number: 1 Publisher: SpringerOpen.
  * [3] Joseph Byrum.  Quantum Computing In Finance – Where We Stand And Where We Could Go | Science 2.0, May 2021.
  * [4] Ginés Carrascal de las Heras, Paula Hernamperez Manso, Guillermo Botella, and Alberto Antonio del Barrio.  Backtesting quantum computing algorithms for portfolio optimization, April 2023.
  * [5] CoinMarketCap.  Top Cryptocurrency Exchanges Ranked By Volume, 2023.
  * [6] Thomas Günter Fischer, Christopher Krauss, and Alexander Deinert.  Statistical Arbitrage in Cryptocurrency Markets.  Journal of Risk and Financial Management, 12(1):31, March 2019.  Number: 1 Publisher: Multidisciplinary Digital Publishing Institute.
  * [7] IBM.  Solving quadratic programming problems (QPs) with CPLEX., November 2021.
  * [8] IBM.  IBM Launches $100 Million Partnership with Global Universities to Develop Novel Technologies Towards a 100,000-Qubit Quantum-Centric Supercomputer, 2023.
  * [9] Audrius Kabašinskas and Kristina Šutienė.  Key Roles of Crypto-Exchanges in Generating Arbitrage Opportunities.  Entropy, 23(4):455, April 2021.  Number: 4 Publisher: Multidisciplinary Digital Publishing Institute.
  * [10] Bhaskar Krishnamachari, Qi Feng, and Eugenio Grippo.  Dynamic Automated Market Makers for Decentralized Cryptocurrency Exchange.  In 2021 IEEE International Conference on Blockchain and Cryptocurrency (ICBC), pages 1–2, May 2021.
  * [11] Raymond S. T. Lee.  Quantum Finance: Intelligent Forecast and Trading Systems.  Springer Nature, November 2019.
  * [12] Igor Makarov and Antoinette Schoar.  Trading and arbitrage in cryptocurrency markets.  SSRN, February 2020.  Accepted: 2021-04-21T21:16:54Z Publisher: Elsevier BV.
  * [13] Jarrod R. McClean, Jonathan Romero, Ryan Babbush, and Alán Aspuru-Guzik.  The theory of variational hybrid quantum-classical algorithms.  New Journal of Physics, 18(2):023023, February 2016.  Publisher: IOP Publishing.
  * [14] Román Orús, Samuel Mugel, and Enrique Lizaso.  Quantum computing for finance: Overview and prospects.  Reviews in Physics, 4:100028, November 2019.
  * [15] Alberto Peruzzo, Jarrod McClean, Peter Shadbolt, Man-Hong Yung, Xiao-Qi Zhou, Peter J. Love, Alán Aspuru-Guzik, and Jeremy L. O’Brien.  A variational eigenvalue solver on a photonic quantum processor.  Nature Communications, 5(1):4213, July 2014.  Number: 1 Publisher: Nature Publishing Group.
  * [16] Geoffrey Poitras.  Origins of arbitrage.  Financial History Review, 28(1):96–123, April 2021.  Publisher: Cambridge University Press.
  * [17] M. J. D. Powell.  A Direct Search Optimization Method That Models the Objective and Constraint Functions by Linear Interpolation.  In Susana Gomez and Jean-Pierre Hennart, editors, Advances in Optimization and Numerical Analysis, Mathematics and Its Applications, pages 51–67. Springer Netherlands, Dordrecht, 1994.
  * [18] Qiskit contributors.  Qiskit: An Open-source Framework for Quantum Computing, 2023\.
  * [19] Stephen A Ross and others.  Return, risk and arbitrage.  Rodney L. White Center for Financial Research, The Wharton School …, 1973.
  * [20] Wanmei Soon and Heng-Qing Ye.  Currency arbitrage detection using a binary integer programming model.  In 2007 IEEE International Conference on Industrial Engineering and Engineering Management, pages 867–870, December 2007.  ISSN: 2157-362X.
  * [21] Rainer Storn and Kenneth Price.  Differential Evolution – A Simple and Efficient Heuristic for global Optimization over Continuous Spaces.  Journal of Global Optimization, 11(4):341–359, December 1997.
  * [22] Shuangge Wang and Bhaskar Krishnamachari.  Optimal Trading on a Dynamic Curve Automated Market Maker.  In 2022 IEEE International Conference on Blockchain and Cryptocurrency (ICBC), pages 1–5, May 2022.
  * [23] Xi-Ning Zhuang, Zhao-Yun Chen, Yu-Chun Wu, and Guo-Ping Guo.  Quantum Quantitative Trading: High-Frequency Statistical Arbitrage Algorithm.  New Journal of Physics, 24(7):073036, July 2022.  arXiv:2104.14214 [quant-ph, q-fin].