etrm: Energy Trading and Risk Management in R

This paper introduces etrm, an R package with tools for trading and financial risk management in energy markets. Contracts for electric power and natural gas differ from most other commodities due to the fact that physical delivery takes place over a time interval, and not at a specific point in time. There is typically strong seasonality, limited storage and transmission capacity and strong correlation between price and required volume. Such characteristics need to be taken into account when pricing contracts and managing financial risk related to energy procurement. Tools for these task are usually bundled into proprietary Energy Trading Risk Management (ETRM) systems delivered by specialized IT vendors. The etrm package offers a transparent solution for building a forward price curve for energy commodities which is consistent with methods widely used in the industry. The user’s fundamental market view may be combined with contract price quotes to form a forward curve that replicate current market prices, as described in Ollmar (2003) and Benth et al. (2007). etrm also provides implementations of five portfolio insurance trading strategies for energy price risk management. The forward market curve and the energy price hedging strategies are core elements in an ETRM system, which to the best of the author’s knowledge has not been previously available in the R ecosystem.

Anders D. Sleire (Department of Mathematics)

Supplementary materials

Supplementary materials are available in addition to this article. It can be downloaded at

F. E. Benth, S. Koekkebakker and F. Ollmar. Extracting and applying smooth forward curves from average-based commodity contracts with seasonal variation. The Journal of Derivatives, 15(1): 52–66, 2007. URL .
F. Ollmar. An analysis of derivative prices in the Nordic power market. 2003. URL



Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".


For attribution, please cite this work as

Sleire, "The R Journal: etrm: Energy Trading and Risk Management in R", The R Journal, 2022

BibTeX citation

  author = {Sleire, Anders D.},
  title = {The R Journal: etrm: Energy Trading and Risk Management in R},
  journal = {The R Journal},
  year = {2022},
  note = {},
  doi = {10.32614/RJ-2022-013},
  volume = {14},
  issue = {1},
  issn = {2073-4859},
  pages = {320-341}