A Reinforcement Learning Algorithm for Trading Commodities

25 Pages Posted: 21 Feb 2023 Last revised: 27 Nov 2023

See all articles by Federico Giorgi

Federico Giorgi

University of Rome Tor Vergata - Department of Economics and Finance

Stefano Herzel

University of Rome Tor Vergata - Faculty of Economics

Paolo Pigato

University of Rome Tor Vergata - Department of Economics and Finance

Date Written: February 18, 2023

Abstract

We propose a Reinforcement Learning (RL) algorithm for generating a trading strategy in a realistic setting, that includes transaction costs and factors driving the asset dynamics. We benchmark our algorithm against the analytical optimal solution, available when factors are linear and transaction costs are quadratic, showing that RL is able to mimic the optimal strategy. Then we consider a more realistic setting, including non-linear dynamics, that better describes the WTI spot prices time series. For these more general dynamics, an optimal strategy is not known and RL becomes a viable alternative. We show that on synthetic data generated from WTI spot prices, the RL agent outperforms a trader that linearizes the model to apply the theoretical optimal strategy.

Keywords: Portfolio Optimization, Reinforcement Learning, SARSA, Commodities, Threshold Models

Suggested Citation

Giorgi, Federico and Herzel, Stefano and Pigato, Paolo, A Reinforcement Learning Algorithm for Trading Commodities (February 18, 2023). CEIS Working Paper No. 552, Available at SSRN: https://ssrn.com/abstract=4363174 or http://dx.doi.org/10.2139/ssrn.4363174

Federico Giorgi

University of Rome Tor Vergata - Department of Economics and Finance ( email )

Via columbia 2
Rome, Rome 00123
Italy

Stefano Herzel

University of Rome Tor Vergata - Faculty of Economics ( email )

Via Columbia n.2
Rome, rome 00100
Italy

Paolo Pigato (Contact Author)

University of Rome Tor Vergata - Department of Economics and Finance

Via Columbia 2
Rome, Rome 00123
Italy

Do you have a job opening that you would like to promote on SSRN?

Paper statistics

Downloads
247
Abstract Views
660
Rank
239,363
PlumX Metrics