Providing profitable commodity trading in a volatile market

The Energy Trading Company is a predominant player in the local energy system, assuming an eminent role in implementing the country’s energy strategic targets through it’s successful and competitive activities. The Energy Trading company’s expanding portfolio covers the entire Hungarian energy sector. Through its supplementary services (e.g. IT, telecommunication, financial and security services) the company is prepared to provide full-range services for the increasingly complex consumer’s demands in a one-stop way.

The Energy Trading Company has a dedicated trader team that deals with different commodities in the energy market. One of their main focuses is CO2 commodity trading, which involves buying and selling carbon emission quotas on the EU Emissions Trading System. This aspect of their trading would become the focus of the recommendation system.

The Energy Trading Company tasked Zenitech with building a recommendation system which would utilise machine learning models and trading strategies to create buy/sell signals for traders. The system would not trade on its own – only provide decision support. The project’s long-term goal is to maximise profit made via the trades recommended by the new system.

Getting to grips with the data

Zenitech’s project team of three data scientists and a project manager maintained active and open communication with the trader team throughout the project.

The first step was for the team to familiarise themselves with the business of trading, understanding the technical indicators, trading strategies, different order types and so on. This helped scope what the recommendation system needed to achieve. The goal was to predict short- term price changes and react with buy/sell signals.

From there, the team explored available data sets. We looked at the trading history of different commodities and created several exploratory data analysis sets (including uni- and multivariate analysis) to gather as much meaningful information about the data as possible.

The next step was to aggregate the data into sets of one-hour intervals. The team then created feature sets using different technical indicators and statistics of the data and then prepared the datasets for modelling, splitting them into training, validation and test sets.

Light bulb with red and green light shooting out

Developing and Testing Trading Models

Zenitech then started to experiment with different modelling techniques creating baseline models using simple linear methods. The team then experimented with different, more complex models, like random forests, XGBoost and neural networks. Based on different metrics, we found that deep neural networks performed the best. The team used a convolutional neural network to predict the direction of the price movement in the next period, making it a binary classification problem.

From here, Zenitech created different trading strategies. The team tested strategies which used various technical indicators to make buy and sell signals. The trained models were used in a model-based strategy with many different parameters, e.g., stoploss/takeprofit parameters, timestop, sizers etc.

The last step was to evaluate the different models and strategies to find the optimal parameter set for the best performance according to other metrics, like successful trade percentage and overall profitability. The team created different pipelines for model training and parameter optimisation to facilitate future retraining and re- parameterisation using new data.

Finally came the user interface. This was designed to be relatively simple and featured elements including:

The final architecture had storage capacity for trading data, metrics and logs, data ingestion for fetching real-time data, model inference to prepare the data for machine learning, the trading strategy and the user interface the traders would use.

Entering the testing phase

The team concluded several backtests on past data, showing promising results that surpassed initial expectations.

A small group of traders are actively testing the system and providing feedback. The Zenitech team is retraining and re-parametrising the models/strategies with new data from 2022 so that the system adapts to market changes.

Trading graph