Energy-Preserving Hamiltonian Neural Networks for Stock Price Forecasting
George Tzagkarakis  1, 2@  , Frantz Maurer  3  
1 : Research Institute of Organizations Management, University of Bordeaux, France
Foundation for Research and Technology - Hellas
2 : Foundation for Research and Technology Hellas
3 : KEDGE Business School
Kedge Business School [Talence]

The stock market is known for being volatile, dynamic, and nonlinear. Accurate stock price prediction is extremely challenging because of multiple (macro and micro) factors, such as politics, global economic conditions, unexpected events, a company's financial performance, and so on. Despite the volatility, stock prices are not just randomly generated numbers. So, they can be analyzed as a sequence of discrete-time data, or, in other words, as time series observations taken at successive points in time, usually on a daily basis.

In a recent work~\cite{Tzagk20}, we were the first to elaborate on the interrelation between the concept of risk, as perceived by the financial experts, and the energy distribution of continuously compounded returns (defined as the logarithm of the ratio of consecutive stock prices). To this end, we borrowed the physical definition of kinetic energy, $E_k$, of an object, which is defined as the energy that the object possesses due to its motion, and depends on the object's mass, $m$, and its speed, $v$. Furthermore, the equation $E_k=q^2/(2m)$ relates the kinetic energy and the momentum, $q$, of an object, which is a vector quantity with both magnitude and direction, thus it can be used to predict the resulting direction and speed of motion of the object. Then, by relying on the analogue of mass for stock prices that can be thought of as the value of a stock, and the analogue of speed which is related precisely to the price variation per time unit, or, in other words, to the stock returns, we can express the energy and momentum of a stock in financial terms.

In Hamiltonian mechanics, Hamiltonian systems are physical models whose state is characterized by a set of coordinate vectors, $S=({\bf p}, {\bf q})\in\mathbb{R}^{2N}$, where ${\bf p}\in\mathbb{R}^{N}$ represents the position and ${\bf q}\in\mathbb{R}^{N}$ the momentum of the system in time. The behaviour
of Hamiltonian systems can be completely described by a single function $H({\bf p}, {\bf q})$. Solving the system of Hamilton's equations, $\{\dot{\bf q}=-\nabla_{\bf p}H({\bf p}, {\bf q}),\ \dot{\bf p}=\nabla_{\bf q}H({\bf p}, {\bf q})\}$, one can obtain the trajectories $S(t)$ in physical space. The main property of these
trajectories is that their total energy represented by the Hamiltonian function $H(S(t))$ is constant over time.

In the framework of Machine Learning, a physics-informed neural network, the Hamiltonian Neural Network (HNN), was proposed in~\cite{Grey19}. The HNN is capable of generating a single scalar value corresponding to the energy of the physical system, whilst predicting the state of the system (i.e., position and momentum) in time.

Motivated by the above concepts, in this work we propose a predictive model for stock prices, in the form of an HNN architecture. In particular, assuming an unleveraged investment strategy operating with the initial capital without using any borrowed money, we train an HNN by adding an additional constraint, namely, the total energy preservation of the Hamiltonian function of the physical system, or equivalently, in financial terms, of the overall capital invested on a given stock. The input of the HNN consists of the current stock's position (i.e., its price) and stock's momentum (i.e., its value multiplied by its current return), while the output is the predicted position and momentum in the next time instant (next day in our case). To the best of our knowledge, this is the first time to bridge the fields of Hamiltonian systems and financial stocks forecasting.

Experimental evaluation with real stocks reveals the promising performance of the proposed framework, when compared against well-established approaches, such as ARIMA-based models and benchmark neural network architectures, which are not capable of exploiting the energy preservation constraint.

Personnes connectées : 2 Vie privée