  In this paper we tackle the problem of dynamic portfolio optimization, i.e.,
determining the optimal trading trajectory for an investment portfolio of
assets over a period of time, taking into account transaction costs and other
possible constraints. This problem is central to quantitative finance. After a
detailed introduction to the problem, we implement a number of quantum and
quantum-inspired algorithms on different hardware platforms to solve its
discrete formulation using real data from daily prices over 8 years of 52
assets, and do a detailed comparison of the obtained Sharpe ratios, profits and
computing times. In particular, we implement classical solvers (Gekko,
exhaustive), D-Wave Hybrid quantum annealing, two different approaches based on
Variational Quantum Eigensolvers on IBM-Q (one of them brand-new and tailored
to the problem), and for the first time in this context also a quantum-inspired
optimizer based on Tensor Networks. In order to fit the data into each specific
hardware platform, we also consider doing a preprocessing based on clustering
of assets. From our comparison, we conclude that D-Wave Hybrid and Tensor
Networks are able to handle the largest systems, where we do calculations up to
1272 fully-connected qubits for demonstrative purposes. Finally, we also
discuss how to mathematically implement other possible real-life constraints,
as well as several ideas to further improve the performance of the studied
methods.
