Skip to main content

Intraday renewable electricity trading: advanced modeling and numerical optimal control

Abstract

As an extension of (Progress in industrial mathematics at ECMI 2018, pp. 469–475, 2019), this paper is concerned with a new mathematical model for intraday electricity trading involving both renewable and conventional generation. The model allows to incorporate market data e.g. for half-spread and immediate price impact. The optimal trading and generation strategy of an agent is derived as the viscosity solution of a second-order Hamilton–Jacobi–Bellman (HJB) equation for which no closed-form solution can be given. We construct a numerical approximation allowing us to use continuous input data. Numerical results for a portfolio consisting of three conventional units and wind power are provided.

1 Introduction

To counter global climate change, renewable power sources substituted fossil fuel plants and provide now a substantial part of the electricity production. Due to the intermittency of renewable power, short-term electricity contracts have gained importance on electricity exchanges such as the European Power Exchange (EPEX SpotFootnote 1). In particular, continuous intraday trading, which allows trading of contracts until 30 minutes before delivery, is used to respond to short-term changes. The trading volume within the German intraday market (IDM) area increased from 26 TWh in 2014 to more than 50 TWh in 2018. A similar trend has been observed in other market areas or countries in which some markets or sub segments, e.g., continuous trading of hourly products in Belgium (since July 2018) or the 30-min continuous trading in Germany and France (since April 2017), have been developed. Another instrument for integrating renewable energy markets is the Xbid project, which aims at establishing a common pan-European continuous intraday market to strengthen liquidity. All these developments trigger a need for mathematical modeling of such trading as a basis for deeper understanding, optimization and control. Moreover, a mathematical model is the basis for numerical simulations.

However, in contrast to day-ahead market (DAM) modeling, literature dedicated to the continuous intraday electricity markets is scarce. In particular, appropriate mathematical models describing the main characteristics of these short-term markets have not been developed so far. Most important price drivers have been identified in [10] explaining about 75% of the price variance, [20]. Moreover, strong statistical evidence was found that information on the specific fundamental factors significantly affect the intraday prices, which appear as transaction prices within a trading period, [13, 14].

Concerning mathematical modeling early work in the field of integration of renewables into short-term markets using stochastic optimization can be found in [18]. The minimization of incurred intraday costs of wind producers while maintaining the balance of production forecast and sales is considered in [11]. This short-term trading model also considers the impact of the wind producer on prices without intraday price uncertainty, however. A discrete time decision model with intraday prices following a geometric Brownian model and wind production error forecast following an arithmetic Brownian motion has been introduced in [7, 8]. In that framework, the power producer is supposed to have no impact on intraday prices.

To overcome the aforementioned weaknesses, we have been inspired by [1] to model the continuous intraday market for electricity. In [1], a Hamilton–Jacobi–Bellman (HJB) equation was derived for determining an optimal trading strategy by modeling the dynamics of the electricity market by stochastic differential equations (SDEs) and formulating a corresponding value function to be optimized. The specific market model allows one to solve the arising HJB analytically, i.e., the authors derive a solution formula.

The starting point of this paper (which builds upon and extends [9]) is a statistical analysis of EPEX SPOT data, which shows that some of the model assumptions in [1] are in fact not satisfied under real market conditions. Thus, we introduce a more sophisticated model. The arising HJB equation can no longer be solved analytically; the value function is shown to be the unique viscosity solution of this HJB equation. Thus, we need an appropriate numerical scheme. From an economical point of view, the main new ingredients of our model are:

  1. 1.

    Portfolio of renewable and conventional energy represented by a cost function that reflects the stepwise merit order of a portfolio rather than a systemwide quadratic function;

  2. 2.

    Pricing model using time-varying half-spread and being capable of representing time-varying liquidity;

  3. 3.

    Approximation of market data for half-spread and instantaneous price impact;

  4. 4.

    Variable penalty depending on the state of the market at final time;

  5. 5.

    The model relies on data which are observable on the market (see Sect. 3).

The main focus of this paper is a novel application-related modeling of the intraday trading and the determination of a numerical approximation for this problem. We show an example of a real-world problem, compute the optimal trading strategy and investigate the impact of various involved parameters. The remainder of this paper is as follows: In Sect. 2, we introduce the new model and the arising HJB equation and Sect. 3 details the involved parameters, which we obtained from empirical analyses. In Sect. 4, we describe the numerical method for determining the viscosity solution of the arising HJB. Moreover, we present corresponding numerical experiments. We finish by conclusions and an outlook in Sect. 5.

2 A new mathematical model

In order to take both renewable and conventional generation into account, our model is based upon the consideration of an agent owning both kinds of power plants and aiming at selling a combination of renewableFootnote 2 and conventionally produced electricity. In detail, depending on the weather forecast and the expected price at the final time, such a combination of electricity is sold at the day-ahead market (DAM). With the result of this initial trading, the agent starts to act on the continuous intraday trading market (IDM) aiming at maximizing her profit by determining an optimal trading strategy as well as an optimal production strategy of conventional power.Footnote 3 All quantities entering the model are described below.

2.1 Day-ahead and intraday electricity trading

Consider a delivery hour h on day d. The day before, \(\mbox{d}-1\), the day-ahead auction takes place with gate closure at 12 noon. In this auction, each participant can offer (ask) or request (bid) a certain demand of electricity at a specific price. Then, a clearing price is set and power is exchanged accordingly. Next, the continuous intraday trading starts at 3 p.m. on day \(\mbox{d} -1\) and closes half an hour before the actual delivery hour h, see Fig. 1.

Figure 1
figure 1

Scheme of continuous intraday trading

2.2 Dynamics of the electricity market

The dynamics of the market includes the forecasted renewable power production and the price process. The latter one is influenced by the current trading activity of the agent. We use stochastic processes and derive stochastic differential equations (SDEs), see [19] for background.

2.2.1 Renewable production forecast

By \(D=(D_{t})_{0 \leq t \leq T}\) we denote the forecasted production of renewable produced electricity during the trading session. Following the idea of [15, 22], we assume that forecast updates are a consequence of new information and hence lead to random changes in t. Therefore, the uncertainty is modeled by means of the dynamics

$$ dD_{t} = \sigma_{D}\, dW_{t,D}, $$
(1)

where \(\sigma_{D}\) is the volatility and \((W_{t,D})_{0 \leq t \leq T}\) is a standard Brownian motion. For the sake of simplicity, this variable is unbounded, whereas in the real world, there are restrictions by zero (no wind) and the maximum capacity of the wind farm. We denote by \(D^{t,d}\) the solution of the SDE starting from d (the current capacity) at t.

2.2.2 Agent’s position

The financial position resulting from the agent’s trading activity is denoted by \(X=(X_{t})_{0 \leq t \leq T}\). The agent participates in the intraday market (IDM) with continuous trading at rate \(q_{t} \in\mathcal{Q}:=(q_{\min}, q_{\max}) \subset\mathbb {R}\), where \(q_{t}>0\) implies actively buying and \(q_{t}<0\) implies actively selling.Footnote 4 The dynamics of her financial position are then

$$ dX_{t} = {q_{t}}\, dt $$
(2)

and we denote by \(X^{q; t,x}\) the solution of the SDE starting from x at t depending on the current trading rate \(q_{t}\). For \(t=0\), \(x_{0}\) is the amount of electricity sold on the day-ahead market.

2.2.3 Permanently impacted mid price

First, we denote by \(Y=(Y_{t})_{0 \leq t \leq T}\) the permanently impacted mid price, i.e., the sum of the mid price of energy and the permanent impact of the agent’s trading, the latter one modeled by some function \(\psi: \mathbb{R}\to\mathbb{R}\). The dynamics of Y is modeled by the SDE

$$ dY_{t}=\bigl(\mu_{{Y}}+\psi(q_{t}) \bigr) dt+\sigma_{Y}\, dW_{t,Y}, $$
(3)

where \(\mu_{Y}\) is the drift, \(\sigma_{Y}\) is the volatility and \((W_{t,Y})_{0 \leq t \leq T}\) is a standard Brownian motion. We denote by \(Y^{q;t,y}\) the solution of the SDE starting from y at time t depending on \(q_{t}\).

2.2.4 Transaction costs

When actively buying (selling) on the IDM, there are costs in addition to the permanent impact. Those are referred to as transaction costs and will be incorporated in our model.

2.2.5 Execution price

The execution price is the price the agent pays (receives) when actively buying (selling). We require a more advanced approach of the pricing model as in [1], where the half-spread (see below) and its time variability as well as the time variability of the execution costs are ignored. Incorporating these effects, the execution price depends on several quantities to be introduced now.

The half-spread is defined as the half of difference of the best ask and the best bid price. This data is observable on the market. While in reality the bid-ask spread and hence also the half-spread is stochastic, we model it in terms of a deterministic function \(h: [0,T]\to\mathbb{R}^{+}\), which reflects the typical shape over the trading period.

The other component of our model for the execution price is the execution cost reflecting the costs that are incurred due do executing limit orders with prices worse than the best price when buying (selling) actively. While they are also stochastic in reality, they will be described in terms of a deterministic function \(\varphi: [0,T] \times (q_{\min}, q_{\max}) \rightarrow \mathbb{R}\) which reflects the typical shape over the trading period.

With all these quantities at hand, the execution price \(P^{q; t,y}=(P^{q; t,y}_{s})_{0\le s\le T}\) is modeled as

$$ P_{s}^{q; t,y} :=Y^{q; t,y}_{s}+ \operatorname {sign}(q_{s}) h(s)+{\varphi(t,q_{s})}, $$
(4)

where (as usual)

$$\operatorname {sign}(q_{s}):=\textstyle\begin{cases} \frac{ \vert q_{s} \vert }{q_{s}},& \text{if } q_{s} \neq0, \\ 0,& \text{otherwise.} \end{cases} $$

Hence, (4) means that the execution price is the permanently impacted mid price plus (minus) the time-varying half-spread and plus the time-varying execution costs, which extends the model in [1].

2.3 The profit: the objective function for optimization

It is the aim of the agent to maximize her profit consisting of the running and the terminal profit explained next. This will later serve as the objective function for the arising optimization problem.

2.3.1 Running profit

The total running profit from the continuous trading in the intraday market is given by

$$ f^{q}(s; t,y) := - q_{s} P_{s}^{q; t,y} $$
(5)

with the trading rate \(q=(q_{t})_{0\le t\le T}\).

2.3.2 Terminal profit

The profit gained at the end of the trading period consists of scheduling conventional power production which incurs costs and placing a final market order.

Conventionally produced energy

At the end of the trading session, the agent chooses how much electricity \(\xi\in\mathbb{R}_{0}^{+}\) she will produce during the delivery period. For doing so, she has n conventional units available with each being able to operate between their specific minimum \(\kappa^{\min}_{i}\) and maximum generation capacity \(\kappa^{\max}_{i}\), \(i=1,\ldots,n\). The marginal costs \(c_{i}\) of unit i, i.e., the costs for producing 1 MWh of electricity, are assumed to be time-independent (constant). The chosen strategy of the agent thus consists of deciding to activate or deactivate unit i (modeled by a binary variable \(a_{i}\in\{ 0,1\}\)) and choosing the respective amount \(\xi_{i} \in[\kappa_{i}^{\min },\kappa_{i}^{\max}]\) for each unit. Thus, the resulting amount of produced electricity is

$$ \xi= \sum_{i=1}^{n} a_{i} \xi_{i}. $$
(6)

A straightforward strategy would be that the agent will activate her units in ascending order of marginal costs, starting with the ‘cheapest’ one. The arising total cost of power production then reads

$$ C:\mathbb{R}^{+}_{0}\rightarrow \mathbb{R}^{+}_{0}, \quad C(\xi) = \sum _{i=1}^{n} a_{i} c_{i} \xi_{i}, $$
(7)

which is a piecewise linear but discontinuous function, the derivative of which is a sum of piecewise constants and a number of Delta distributions.

Final market order

Furthermore, the agent also has the option to place a final buy or sell market order. In fact, obtaining values for \(D_{T}\), \(X_{T}\) and \(Y_{T}\), the agent optimally tries to reach her desired demand for power by buying/selling the amount \(\xi+X_{T}+D_{T} \in\mathbb{R}\), i.e., what has been traded already minus conventional and renewable production, by a final market order. The costs associated with the final market order are the costs due to crossing the half-spread \(h(T)\) and the costs due to potentially executing limit orders with prices worse than the best bid/ask price. The latter costs are modeled by the function \(\alpha:\mathbb{R} \rightarrow\mathbb{R}\).

Terminal payoff

It turns out to be convenient to introduce the variable \(Z_{t}:=X_{t} + D_{t}\), i.e., the sum of the forecasted production from renewables and what has been sold by the agent so far. This, in particular reduces the dimension of the optimization problem to be solved numerically, which is crucial for efficiency. The terminal payoff/profit then reads

$$ g(\xi, Y_{T},Z_{T}) := -C (\xi) + (\xi+ Z_{T} ) \bigl(Y_{T} - \operatorname {sign}(\xi+ Z_{T}) h(T)+\alpha(\xi+Z_{T}) \bigr). $$
(8)

2.4 The resulting optimization problem

Now, we have all ingredients at hand to formulate the optimization problem in terms of a HJB equation.

2.4.1 Value function

The value function corresponds to the agent’s cash, so that an optimal strategy yields maximal cash. Denoting by \(Z^{q; t,z}\) the solution of the SDE \(dZ_{t}=dD_{t}+dX_{t}= q_{t}\, dt+\sigma_{D}\, dW_{t,D}\) starting from z at t, the resulting value function \(V:[0,T]\times\mathcal{U}\to \mathbb{R}\) reads for \(\mathcal{Q}:=(q_{\min}, q_{\max})\), see, e.g. [24, Ch. 4],

$$ V(t, y,z):= \sup_{(q,\xi) \in\mathcal{Q}\times\mathbb{R}} \mathbb{E} \biggl[ \int_{t}^{T} f^{q}(s; t,y) \, ds + g \bigl(\xi, Y^{q;t,y}_{T}, Z_{T}^{q; t,z}\bigr) \biggr], $$
(9)

where \(\mathcal{U}:=\mathcal{Y}\times\mathcal{Z} \subset\mathbb {R}^{2}\) is a closed convex set (usually a rectangle, in order to ensure well-posedness of the optimization in (9), [6]). In fact, from our above modeling, we would obtain \(\mathcal{Y} = \mathcal{Z} = \mathbb{R}\) (range of values for the execution price and energy production). However, without additional conditions, the optimization problem is not well-posed on such unbounded domains. Moreover, the numerical solution using standard discretization techniques is—at least—not straightforward on unbounded domains and would require sophisticated schemes, see e.g. [12].

In order to overcome these difficulties, we define \(\mathcal{U}\) in terms of closed sets (intervals) \(\mathcal{Y}\) and \(\mathcal{Z}\) and cut-off the problem on their boundaries. This requires to set boundary conditions to ensure well-posedness to be explained below.

2.4.2 The Hamilton–Jacobi–Bellman (HJB) equation

Following the well-known dynamic programming principle (e.g. [24, Ch. 4]), we derive the HJB equation: Find \(V: [0,T] \times\mathcal{U}\to\mathbb{R}\), \(V=V(t,y,z)\), such that

$$ \begin{aligned}[b]&\partial_{t} V + {\mu_{Y}} \partial_{y} V + \frac{1}{2} \sigma_{Y}^{2} \partial_{yy}V + \frac{1}{2} \sigma_{D}^{2} \partial_{zz} V \\ &\qquad+\sup_{q(t) \in\mathcal{Q}} \bigl\{ - \bigl(y + \operatorname {sign}\bigl(q (t)\bigr) h(t) + {\varphi\bigl(t,q(t)\bigr)} \bigr)q(t) +q(t) \partial_{z} V + { \psi\bigl(q(t)\bigr)} \partial_{y}V \bigr\} \\ &\quad=0 , \end{aligned} $$
(10)

for \((t,y,z) \in[0,T) \times\mathcal{U}\) with terminal condition \(V(T,y,z)=g(T,y,z)\) for all \((y,z)\in\mathcal {U}\). Note, that in (10) we used the notation \(q(t)\) instead of the previously used \(q_{t}\) for the following reason: In the numerical realization, we treat q as a function \(q(t)\) and not as stochastic process \(q_{t}\).

One can show that (10) with terminal and Dirichlet boundary conditions is well-posed and that the unique viscosity solution is the value function in (9) , [5]. Due to the form of (10), we cannot expect a first-order condition for the control q and we have to resort to numerical solvers.

2.4.3 Boundary conditions

As already mentioned above, we need to truncate the HJB to a bounded domain \(\mathcal{U}\), which requires to prescribe appropriate boundary conditions on \(\partial\mathcal{U}\). Such an approach is well-known also from numerical option pricing when solving the Black–Scholes (BS) equation. In that case, the definition of corresponding Dirichlet boundary conditions is canonical since small errors in the boundary values cause only small errors in the solution on all of \(\mathcal{U}\) (i.e., the BS equation is stable w.r.t. boundary values). The situation for the HJB equation is fundamentally different as small changes in the Dirichlet data immediately severely change the solution on the whole domain. Hence, the definition of appropriate boundary conditions is a delicate task.

We are going to describe our approach to prescribe appropriate boundary conditions. Our point of departure is the before-mentioned IDM-model in [1], which uses a much simpler HJB as the one derived above. This causes the fact that the HJB in [1] allows for a closed formula for the solution. We consider such a somehow simpler HJB, solve it explicitly and use the boundary values of that HJB as Dirichlet data for our more sophisticated HJB. Of course, one could also use other simplified models as long as the resulting boundary conditions turn out to be meaningful. To be specific, we consider a simpler HJB model consisting of the following ingredients and simplifications:

  1. 1.

    By omitting the sign-part in (10) and replacing it by the positive sign, the function within the supremum is differentiable.

  2. 2.

    We replace \(h(t)\) by \({\bar {h}}:=h(T)\), i.e., the half-spread at the terminal time.

  3. 3.

    The next simplification concerns the temporary price impact φ. The most simple situation would be a linear approximation, e.g., \(\varphi(t,q):= kq\), i.e., stationary and linear in q. Here, \(k\in\mathbb{R}^{+}\) is a constant, which has been derived by approximating our mid price data with a second order polynomial p and then setting \(k:=p(T)\).

  4. 4.

    The permanent price impact vanishes, i.e., \(\psi\equiv0\).

Thus, the simplified HJB now takes the form

$$ \partial_{t} v+ \mu_{Y} \partial_{y} v + \frac{\sigma_{Y}^{2}}{2} \partial_{yy}v + \frac{\sigma_{D}^{2}}{2} \partial_{zz}v +\sup_{q \in\mathcal{Q}} \bigl\{ - (y + {\bar {h}}+ kq)q + q\partial _{z}v \bigr\} = 0. $$
(11)

In (11), we can explicitly determine the supremum by finding the root of the first-order derivative w.r.t. q of the term in \(\{\cdots\}\). The corresponding first-order necessary conditions yield the optimal control as follows (recall from 3. that \(k>0\))

$$\begin{aligned} q^{*} = \frac{-y-{\bar {h}}+\partial_{z}v }{2k}. \end{aligned}$$

Inserting this optimal control into (11) yields the following PDE for the unknown v as a function of \((t,y,z)\)

$$ \partial_{t} v+ \mu_{Y} \partial_{y} v + \frac{\sigma_{Y}^{2}}{2} \partial_{yy}v + \frac{\sigma_{D}^{2}}{2} \partial_{zz}v + \frac{1}{4k} ( y + {\bar {h}}- \partial_{z}v )^{2}=0. $$
(12)

To solve (12), we make the following polynomial ansatz

$$\begin{aligned} v(t,y,z) &= \sum_{ \vert i \vert \le2} a_{i}(T-t) y^{i_{1}} z^{i_{2}}, \quad i=(i_{1},i_{2}), i_{1}, i_{2}\in\mathbb{N}_{0}, \vert i \vert :=i_{1}+i_{2}, \end{aligned}$$

i.e., a polynomial of degree 2 with the coefficient functions \(a_{i}: [0,T]\to\mathbb{R}\) to be determined. Plugging this form of v into (12) yields a system of six Riccati equations for the unknown functions \(a_{i}\), i.e.,

$$\begin{aligned}& \dot{a}_{02}(T-t) - {\frac{1}{4k}} \bigl( -2a_{02}(T-t) \bigr)^{2} = 0, \\& \dot{a}_{20}(T-t) - {\frac{1}{4k}} \bigl( -a_{11}(T-t) +1 \bigr)^{2} = 0, \\& \dot{a}_{11}(T-t) + {\frac{1}{k}} a_{02}(T-t) \bigl(-a_{11}(T-t)+1 \bigr) =0, \\& \dot{a}_{01}(T-t) +\mu_{Y} a_{11}(T-t) - { \frac{1}{k}} a_{02}(T-t) \bigl(h-a_{01}(T-t) \bigr) =0, \\& \dot{a}_{10}(T-t) + \mu_{Y} a_{20}(T-t) - { \frac{1}{2k}} \bigl(-a_{11}(T-t)+1 \bigr) \bigl(h-a_{01}(T-t) \bigr) =0, \\& \dot{a}_{00}(T-t) + \mu_{Y} a_{10}(T-t) + \sigma^{2}_{Y} a_{20}(T-t) +\sigma^{2}_{Z} a_{02}(T-t) - {\frac{1}{4k}} \bigl(h-a_{01}(T-t) \bigr)^{2} =0. \end{aligned}$$

In order to solve this system of ordinary differential equations, we need initial conditions for the functions \(a_{i}\). Due to the arguments \((T-t)\) in all those functions, the desired initial conditions boil down to terminal conditions of v, i.e., the function g in (8). Recall, that g in particular contains the function C in (7), which is piecewise polynomial but discontinuous (see, e.g. Fig. 6 for an example of such a function—clearly exhibiting jumps), which prohibits a closed form solution of the Riccati system. Thus, we use a least squares approximation of g in terms of the above polynomial \(v(T,y,z)\). Doing so, we obtain initial values for the above mentioned functions, say \(a_{i}(0)=a_{i,0}\). With these values at hand, we solve the initial-value problem of the Riccati system by Maple™ and obtain v. The boundary values of v w.r.t. the variables y and z are then used as Dirichlet conditions for (10).

3 Data

Our model described above relies on several parameters, which we summarize in Table 1. In this section, we describe how this data can be obtained from market observations and empirical data analysis.

Table 1 Parameters involved in our model

3.1 Generation portfolio

As mentioned before, the agent’s portfolio consists of renewable and conventional generation capacity. We describe how to retrieve realistic market data.

3.1.1 Renewable electricity standard (RES) portfolio

We equip the sample agent’s portfolio with 500 MW of aggregated renewable generation capacity. As mentioned before, for the sake of simplicity and due to limited availability of historical data, we restrict the aggregated capacity to arise solely from wind farms. Furthermore, following [17], we assume that the wind farms in the portfolio are dissimilarly located within the considered hypothetical market area. This last assumption allows us to estimate the parameter \(\sigma_{D}\) for \(D_{t}\) in (1) using aggregated forecast data, which is, in contrast to site-specific data, publicly available.

Specifically, we choose hourly wind power forecasts for the French market area provided by [21]. To be able to transfer the characteristics of the historical data set to our current application, we first normalize all forecasts on the average installed capacity per month. We then determine all updates between two adjacent forecasts of the same forecast path. Finally, we observe a volatility of approximately 0.01 per installed MW and hour (2016: 0.008, 2017: 0.008, 2018: 0.010) in the data. With respect to the renewable generation capacity of 500 MW, we therefore set \(\sigma_{D} = 5\) MW.Footnote 5 Finally, we choose \(D_{0}\) also from publicly available data.

3.1.2 Conventional generation

For the agent’s conventional portfolio, we consider \(n=3\) units, namely a hard coal fired plant, a combined cycle gas turbine (CCGT) and an open cycle gas turbine (OCGT), with the parameters shown in Table 2. The marginal costs \(c_{i}\) of each unit represent idealized values for the respective technology class. They also consider that an increase in flexibility—here the reduction of the so-called deadband between zero and production at minimal capacity \(\kappa^{\min}_{i}\)—reduces the efficiency of the unit. Moreover, we assume that the start-up decision \(a_{i}\in\{0,1\}\) of a unit does not require a lead time.

Table 2 Unit Parameters for the conventional units \(i=1,2,3\), \(n=3\)

3.2 Mid price drift

We assume that the drift of the mid price on the IDM consists of two parts as implied by (3), namely mid price changes due to time evolution on one hand and mid price changes due to agent’s trading (causing irreversible price impacts) on the other. Building upon [4], we perform an empirical analysis of these two parts. In particular, we study price changes over longer periods of time as well as their relation to net order flow (i.e., buy minus sell). While in that study mid price changes and net order flow are considered over periods of five minutes, we consider the differences between the day-ahead market (DAM) prices and volume-weighted average IDM pricesFootnote 6 as well as the net order flow over the entire trading window. While we conjecture the DAM prices to be close to the mid prices after market opening, the volume-weighted average IDM prices are usually different from the mid price before end of trading. Nevertheless, we prefer mid prices as we reckon that they better reveal the evolution of the price over a longer period of time and also mirror the relation of this evolution to net order flow.

Of course, the observed price changes appear between the beginning and the end of the IDM trading. As a consequence, the data does not show whether either of the components typically changes over the trading window. Concerning the (deterministic) dependence of the price on time, we simply choose a linear dependence, i.e., constant drift as \(\mu_{Y} (t) \equiv\mu_{Y}\).

Next, we assume a linear relation of order flow and price change, which is at least not contradicted by the scatter plot in Fig. 2. Thus, we assume \(\psi(q_{t}) = b q_{t}\) for the permanent price impact with a constant \(b\in\mathbb{R}\).

Figure 2
figure 2

Scattering of net order flow (buying minus selling) versus difference between volume-weighted average price on the IDM and price on DAM for all contracts with delivery start at 12 noon in Q2/2016

We obtain estimates for b and \(\mu_{Y}\) from least squares fits to the data. For b, we get 0.0017€/MWh2 and significance at a 0.1% level, indicating that the net order flow has a positive impact on the price change. The drift \(\mu_{Y}\) is obtained as 0.0433€/MWh per hour and to be significant at a 1% level, indicating that the price slightly tends to increase over time. Concerning the sign of the drift, we find mixed evidence in the literature, [10, 14].

3.3 Transaction costs

As we pointed out earlier, it is a major difference between our model and previous research that we also include transaction costs. The data analysis on which their modeling is based is presented below. We recall that transaction costs include execution costs modeled by the function φ and the half-spread h, see (4).

3.3.1 Data

We use order book data from the EPEX SPOT-operated market for hourly delivery contracts with Germany/AustriaFootnote 7 as delivery area from the second quarter of 2016 (referred to as Q2/2016 in the following) to empirically analyze the transaction costs mentioned in Sect. 2.2. The dataset comprises (i) all orders with Germany or Austria as delivery area which entered into the order book, (ii) all orders with Germany or Austria as delivery area which caused execution of an order resting in the order book with delivery area other than Germany or Austria and (iii) all orders with delivery area other than Germany or Austria which caused execution of an order in the order book with Germany or Austria as delivery area.

Hence, not all orders in the order book for the German/Austrian delivery area which were visible for market participants are contained in the dataset. Based upon these data, we are now going to describe how we obtained values for the quantities entering the transaction costs.

3.3.2 Half-spread

In identifying typical half-spread functions h entering the optimization problem, we build on research on bid-ask spreads (BAS) on the NYSEFootnote 8 stock market. In [16], the pattern of BAS of NYSE stocks over a trading day is analyzed. To this end, the authors divide each trading day in their sample into one-minute intervals and compute for each interval and stock what they refer to as the time-weighted BAS to be explained next. Consider some time interval \(I_{i}:= (T_{i-1},T_{i} ]\subset[0,T]\) and assume that the BAS changes \(N_{i}\) times at \(T_{i-1} < t^{(i)}_{1}<\cdots<t^{(i)}_{N_{i}}\leq T_{i}\), where we denote the BAS on \((t^{(i)}_{j},t^{(i)}_{j+1})\) by \(\text{BAS}_{j}\), \(j=0,\ldots,N_{i}\) setting \(t^{(i)}_{0}:=T_{i-1}\) and \(t^{(i)}_{N_{i}+1}:=T_{i}\). Then, the time-weighted BAS on that interval \(I_{i}\), denoted by \(\overline{\text{BAS}}_{i}\), is defined as

$$ \overline{\text{BAS}}_{i} := \frac{1}{T_{i}-T_{i-1}}\sum _{j=0}^{N_{i}} \text{BAS}_{j} \bigl(\min \bigl(t^{(i)}_{j+1},T_{i} \bigr) - \max \bigl(t^{(i)}_{j},T_{i-1} \bigr) \bigr). $$

Then, [16] suggests to determine \(\overline{\text{BAS}}_{i}\) for each interval of the trading day and for all stocks in their sample. In this paper, we adopt the approach in [16] and divide the trading period into intervals of 5-minute length. Furthermore, we only consider the hourly delivery contracts with delivery starting at 12 noon in Q2/2016. The resulting data is visualized in Fig. 3 as a two-dimensional histogram of all the \(\overline{\text{BAS}}_{i}\) in the sample for the last 17.5 hours of trading. The blue line reflects the means of the \(\overline{\text{BAS}}_{i}\) in each interval.

Figure 3
figure 3

Two-dimensional histogram of 5-minute time-weighted bid-ask spreads over the last 17.5 hours of the trading period, means per interval (blue) and degree-7 polynomial fit (red line) to the data for all contracts with delivery start at 12 noon in Q2/2016

We observe a significant decrease of the mean time-weighted BAS from ≈8€ to ≈5€/MWh at the beginning of the time window and a subsequent nearly constant behavior for about ten hours. Given a tick size of 0.1€/MWh (Q2/2016), it is remarkable that this plateau is fifty times higher than the tick size. Five hours before the end of the trading, the mean time-weighted BAS decreases to ≈1€/MWh followed by a sharp increase to reach the final ≈2€/MWh. The pattern over the last five trading hours is quite similar to the crude reverse J shape reported in [16] for NYSE stocks.

In order to model the temporal behavior of the \(\overline{\text{BAS}}_{i}\), we employ a polynomial of degree seven according to the Akaike information criterion (AIC) [2], which is depicted by the red line in Fig. 3. This polynomial is the half-spread function h mentioned in the previous section. Clearly, this has a significant smoothing effect and could e.g. be replaced by other approximations as well.

3.3.3 Execution costs

The execution price in (4) depends on the typical half-spread and the typical execution costs, which reflect the negative impact on the price realized by a market participant when buying or selling with market orders. For the empirical analysis of the execution costs we need to consider the order book. Similar to the analysis for the half-spread, we start by determining time-weighted prices and volumes over 5-minute intervals on the different order book levels.Footnote 9 Given some time-weighted price on an order book level, it may occur that the time-weighted price on a lower level is better. Therefore, we sort prices and volumes in descending/ascending order on the buy/sell side. This approach requires the availability of the entire order book over the trading period. Otherwise, missing data techniques could possibly be used.

We assume a linear relationship between trading rate and execution costs,

$$ \varphi(t,q_{t}) = k(t) q_{t}, $$
(13)

with the parameter (function) \(k(t)\). For estimating \(k(t)\), we build upon [4] and analyze how the order books absorb market orders of different sizes. To this end, we consider market orders with volume \(1,\ldots,200\text{ MWh}\) for each interval and market side. Then, we collect those order book levels required to cover the volume of the market order. We multiply the order book level prices in that collection by their volumes, sum them up and divide by the volume of the market order. From the resulting price we subtract the best price on the same market side to obtain the respective market order’s execution costs. Then, we fit a linear model by least squares to obtain \(k(t)\). Considering again hourly delivery contracts with delivery start at 12 noon in Q2/2016, Fig. 4 shows the obtained values for \(k(t)\) in the form of two-dimensional histograms as well as means per time interval (blue line).

Figure 4
figure 4

Histogram of the relation between market order volume and execution costs applying a linear model, dividing the time into 15-minute intervals and the coefficients into intervals of 0.002€/MWh2

Similar to the average half-spread, the average execution costs exhibit a decline after market opening to 0.025–0.05€/MWh2. After a rather stable ≈10 hours period, they further decline to ≈0.01€/MWh2. We observe a slight increase just before the end of trading. Hence, the shape of the average execution costs is rather similar to that of the average half-spread. We model the typical temporal behavior of the execution costs with a polynomial of degree six for the buy side and degree eleven for the sell side (according to the AIC).

Remark 1

Note that the above approach is not compatible with the model in (13). For determining a model for the execution costs, we compared market orders and the order book. However, the agent’s action in our model is trading at some rate. Of course, in reality, market participants will not act by trading at some rate, but merely actively place market orders by some strategy. This means, we cannot observe how different rates enter the order book. On the other hand, the above approach is mainly used to calibrate parameters for our model.

A possible strategy to remedy this shortcoming could be to determine a relation between execution costs in some time interval and a constant trading rate (instead of the volume itself). For example, for execution costs evolving from a 1 MWh market order, a trading rate of 1/5 MWh per minute would be required to yield that volume after 5 minutes of trading.

3.3.4 Terminal order book

At the end of the trading period, we assume that the agent liquidates remaining inventory by means of a final market order (instead of letting the volume run into the balancing market as is done in [1]). This means that we need a typical order book at the end of trading for calibrating our model.

To this end, we consider the buy and sell side separately and determine for each contract the difference between the prices on the different order book levels and the best price. Then, we average all these price differences and volumes on the same order book level. The results are shown in Fig. 5.

Figure 5
figure 5

Cumulative volume on the different levels of the buy (left) and sell (right) order book and difference between price on an order book level and best price for all contracts in the sample. The thick red line reflects the mean cumulative volume and price difference on the different order book levels. Plots are cut off at cumulative volume of 100 MWh

Given that the average volumes associated with the best bid and ask are around 16 MWh, typically there is still some volume at the end of trading which can be sold/bought at zero execution costs. The volumes associated with the order book levels beyond the best-price level slightly increase. While the average price differences associated with the best bid and ask are obviously 0€/MWh, in absolute terms they are ≈1€/MWh for the first level, ≈5€/MWh on the fifth level and 20–30€/MWh on the tenth level. Hence, prices beyond the best level obviously worsen quite substantially.

We consider both the typical order book on the buy and sell side at the end of trading to specify the penalty function α. Recall, that \(\delta\xi:=\xi+X_{T}+D_{T}\) denotes the ‘untraded’ amount (for which a penalty needs to be paid) with ξ being defined by (6). Furthermore, we only consider the first L levels of both the buy and sell order book and truncate the volume on the last level (L) such that the overall volume is 100 MWh on both market sides. Let \(\delta p_{\ell}^{\text{buy}}\leq0\) (\(\delta p_{\ell}^{\text{sell}}\geq 0\)) denote the difference between the price on the -th buy (sell) order book level and the price on level zero, \(\ell=1,\ldots,L\). Furthermore, let \(\lambda_{\ell}^{\text{buy}}\), \(\lambda_{\ell}^{\text{sell}}\) be the maximum volume available on respective side of the -th order book level. Then, α is defined as

$$ \alpha(\delta\xi) = \textstyle\begin{cases} -\frac{ \sum_{\ell=1}^{L} \delta p_{\ell}^{\text{buy}} \max \{0, \min\{\lambda_{\ell}^{\text{buy}},\delta\xi -\sum_{\nu=1}^{\ell-1}\lambda_{\nu}^{\text{buy}} \} \} }{\delta\xi}, & \text{if } \delta\xi> 0, \\ \frac{ \sum_{\ell=1}^{L} \delta p_{\ell}^{\text{sell}} \max \{0, \min\{\lambda_{\ell}^{\text{sell}},\delta\xi -\sum_{\nu=1}^{\ell-1}\lambda_{\nu}^{\text{sell}} \} \} }{1}{\delta\xi}, & \text{if } \delta\xi< 0, \\0, & \text{else}. \end{cases} $$
(14)

It is easily seen that α is continuous at \(\delta\xi=0\). The sign in (14) results from (8) and the motivation that the penalty α should lower the agent’s profit. This implies that α should be positive if the agent needs to buy and negative if she needs to sell at the end of the trading period.

4 Numerical solution of the HJB equation

In this section, we describe our numerical method for (approximately) solving the arising HJB. Moreover, we report on results of a sample numerical experiment concerning (10) using the following data: \(\mathcal{U} := [-50,250]\times [-1645,145]\subset\mathbb{R}^{2}\) and \(T=17.5\mbox{ h}\) arising from reasonable market data. We have of course validated and tested our implementation on various other scenarios. Dirichlet boundary conditions are prescribed as described in Sect. 2.4.

We use a finite difference discretization from [23] with \(56\times301\) points in space and 100 points in time. In particular, central differences are used for the approximation of the first-order terms with additional artificial diffusion, which results in a stable, consistent and monotone scheme converging to the viscosity solution, [23]. We use the well-known policy iteration [3] in every time-step and the control is maximized over a discrete set (as no first-order conditions are available). Finally, the optimal conventional generation is computed as the maximum value of (8) w.r.t. ξ using Matlab’sFootnote 10intlinprog with the interior point method.

4.1 Data

We use the artificial data \(\mu_{Y} := 0.0\), \(\sigma_{D} :=\sigma _{Y} := 0.1\).Footnote 11 The functions \(\varphi(\cdot,\cdot)\) and \(h(\cdot)\) are least-squares 5th order polynomial approximations of market data from Q2/2015 (\(\psi(t)=0\)). The penalty is chosen as market data as \(\alpha(x):= 0.5\cdot(|x|-20)\chi_{20 <| x| \le45} + ((|x|-45)+ 12.5)\chi_{45 <| x| \le145}\).

Our results for the optimal conventional generationξ are displayed in Fig. 6. Let us comment on the case where \(Z_{T}=-500\mbox{ MWh}\). As long as the final mid price is below 25€/MWh, the agents buys the maximal amount of 145 MWh (recall, that \(y\in[-1645,145]\)) and uses the power plant with the lowest marginal costs (hard coal) accordingly, i.e., the remaining 355 MWh. Once the final mid price is 25 to 35€/MWh (i.e., above the marginal cost of hard coal, but below the marginal cost of CCGT) it is optimal to produce at maximum capacity with the cheapest conventional power plant (i.e., 500 MWh by hard coal) and no final market order is required. If the final mid price exceeds 35€/MWh, the agent sells as much electricity as possible (145 MWh) and produces exactly that amount with the CCGT plant at 35€/MWh, which is possible because its capacity is 100-400 MW. Finally, no matter how high the final mid price is, the OCGT unit with the highest marginal cost is not used, since there is not enough sell volume on the market. These results are clearly reasonable.

Figure 6
figure 6

Optimal conventional generation ξ as a function of \(Y_{T}\) and \(Z_{T}\) (left) as well as for some values of \(Z_{T}\) (right; the lines correspond to those on the left graph)

4.2 Trading rate

Figure 7 shows the optimal trading rate over the trading window \(t\in[0\text{ h},17.5\text{ h}]\). In both cases, we fix \(Z_{t}\equiv-499.4\mbox{ MWh}\) (the non-integer numbers arise from the discretization w.r.t. y and z). For the mid price, we choose Yt59.25€/MWh (left) and Yt13.98€/MWh (right). In the left plot, the trading rate is negative (selling), which is reasonable since \(Z_{t}\equiv-499.4\mbox{ MWh}\) means that the agent has only marketed the cheapest power plant and Yt59.25€/MWh means that the execution price is above the marginal costs of the second cheapest power plant. Note, that the absolute value of the trading rate substantially increases around 15 h, since half-spread and immediate price impact are minimal there. In the right plot, the execution price is below the marginal costs of the cheapest power plant, the agent buys electricity and reduces the production of the marketed power plant.

Figure 7
figure 7

Optimal trading rate over the trading window \(t\in[0,17.5]\) for \(Z_{t}\equiv-499.4\mbox{ MWh}\) and Yt59.25€/MWh (left) as well as Yt13.98€/MWh (right)

5 Conclusion and outlook

We have introduced an extended model for the intraday market of renewable electricity. As opposed to earlier research, our more sophisticated approach does not allow for a closed solution formula for the desired optimal trading strategy as a function of time. We thus used a numerical scheme for approximately solving the arising Hamilton–Jacobi–Bellman (HJB) equation. The parameters within the HJB equation are market data which we showed to be available by an empirical analysis.

The availability of a numerical approximation scheme allows us now to extend our model to all market participants, so that regulatory constraints can be determined e.g. for reaching desired environmental goals. Moreover, we will use our scheme to further investigate optimal strategies within economically particular relevant market scenarios.

Notes

  1. www.epexspot.com

  2. In our numerical experiments, we consider wind energy.

  3. Note, that we do not simultaneously optimize day-ahead and intraday trading.

  4. By actively buying or selling we mean trading with market orders instead of limit orders. A limit order is a type of order to buy or sell an item at a specified price or better.

  5. Note, that the hourly value given above may be adapted to time-wise granularity other than 60 minutes by the use of the square-root-of-time rule.

  6. These are transaction prices multiplied with transaction volumes divided by the overall transaction volume.

  7. Splitting into two separate market areas took effect only in October 2018.

  8. New York Stock Exchange

  9. Limit orders contain both price and volume. An order book level is made up by all limit orders on one side of the market with the same price. The price of a level is the price of the included limit orders and the volume of the level is the sum over the volumes of corresponding limit orders.

  10. MathWorks™, mathworks.com

  11. This is done for visualization purposes; we could of course also have used market data.

Abbreviations

AIC:

Akaike information criterion

BAS:

bid-ask spreads

BS:

Black–Scholes (equation)

CCGT:

combined cycle gas turbine (unit)

DAM:

day-ahead market

EPEX:

European Power Exchange

HJB:

Hamilton–Jacobi–Bellman (equation)

IDM:

intraday market

NYSE:

New York Stock Exchange

OCGT:

open cycle gas turbine (unit)

PDE:

partial differential equation

RES:

renewable electricity standard

SDE:

stochastic differential equations

References

  1. Aïd R, Gruet P, Pham H. An optimal trading problem in intraday electricity markets. Math Financ Econ. 2016;10(1):49–85. https://doi.org/10.1007/s11579-015-0150-8.

    Article  MathSciNet  MATH  Google Scholar 

  2. Akaike H. Statistical predictor identification. Ann Inst Stat Math. 1970;22:203–17.

    Article  MathSciNet  Google Scholar 

  3. Bellman R. Dynamic programming. Princeton: Princeton University Press; 1957.

    MATH  Google Scholar 

  4. Cartea Á, Jaimungal S. Incorporating order-flow into optimal execution. Math Financ Econ. 2016;10(3):339–64. https://doi.org/10.1007/s11579-016-0162-z.

    Article  MathSciNet  MATH  Google Scholar 

  5. Crandall MG, Lions P-L. On existence and uniqueness of solutions of Hamilton–Jacobi equations. Nonlinear Anal. 1986;10(4):353–70.

    Article  MathSciNet  Google Scholar 

  6. Fleming WH, Soner HM. Controlled Markov processes and viscosity solutions. 2nd ed. Berlin: Springer; 2006. (Stochastic modelling and applied probability; vol. 25). ISBN 0-387-26045-5.

    MATH  Google Scholar 

  7. Garnier E, Madlener R. Balancing forecast errors in continuous-trade intraday markets. Energy Syst. 2015;6(3):361–88.

    Article  Google Scholar 

  8. Garnier E, Madlener R. Day-ahead versus intraday valuation of demand-side flexibility for photovoltaic and wind power systems. FCN working paper 17/2014. 2014. https://doi.org/10.2139/ssrn.2556210.

  9. Glas S, Kiesel R, Kolkmann S, Kremer M, Graf von Luckner N, Ostmeier L, Urban K, Weber C. Intraday renewable electricity trading: advanced modeling and optimal control. In: Faragnó I et al., editors. Progress in industrial mathematics at ECMI 2018. Berlin: Springer; 2019. p. 469–75. (Mathematics in industry; vol. 30).

    Chapter  Google Scholar 

  10. Hagemann S. Price determinants in the German intraday market for electricity: an empirical analysis. EWL working paper 18/2013. 2015. https://doi.org/10.2139/ssrn.2352854.

  11. Henriot A. Market design with centralized wind power management: handling low-predictability in intraday markets. Energy J. 2014;35(1):99–117.

    Article  Google Scholar 

  12. Kestler S, Urban K. Adaptive wavelet methods on unbounded domains. J Sci Comput. 2012;53(2):342–76.

    Article  MathSciNet  Google Scholar 

  13. Kiesel R, Kremer M, Paraschiv F. A fundamental model for intraday electricity trading. LEF working paper. 2020. https://ssrn.com/abstract=3489214.

  14. Kiesel R, Paraschiv F. Econometric analysis of 15-minute intraday electricity prices. Energy Econ. 2017;64:77–90.

    Article  Google Scholar 

  15. Kolkmann S, Ostmeier L, Weber C. Modelling multivariate intraday forecast update processes for wind power. Unpublished working paper, University of Duisburg-Essen. 2019.

  16. McInish TH, Wood RA. An analysis of intraday patterns in bid/ask spreads for NYSE stocks. J Finance. 1992;47(2):753–64.

    Article  Google Scholar 

  17. Miettinen JJ, Holttinen H. Characteristics of day-ahead wind power forecast errors in Nordic countries and benefits of aggregation. Wind Energy. 2017;20(6):959–72. https://doi.org/10.1002/we.2073.

    Article  Google Scholar 

  18. Morales JM, Conejo AJ, Pérez-Ruiz JA. Economic valuation of reserves in power systems with high penetration of wind power. IEEE Trans Power Syst. 2009;24(2):900–10.

    Article  Google Scholar 

  19. Øksendal B. Stochastic differential equations: an introduction with applications. 6th ed. Berlin: Springer; 2003. (Universitext). ISBN 3-540-04758-1. https://doi.org/10.1007/978-3-642-14394-6.

    Book  MATH  Google Scholar 

  20. Pape C, Weber C, Hagemann S. Are fundamentals enough? Explaining price variations in the German day-ahead and intraday power market. Energy Econ. 2016;2016(54):376–87.

    Article  Google Scholar 

  21. Le reseau de transporte d’electricite (RTE). Portail Clients: Prévisions de production éolienne en France. 2019. https://clients.rte-france.com/lang/fr/visiteurs/vie/previsions_eoliennes.jsp.

  22. Samuelson PA. Proof that properly anticipated prices fluctuate randomly. Ind Manage Rev. 1965;6(2):41–9.

    Google Scholar 

  23. Steck S, Urban K. A reduced basis method for the Hamilton–Jacobi–Bellman equation within the European Union Emission Trading Scheme. In: Hamilton–Jacobi–Bellman equations. Berlin: de Gruyter; 2018. p. 175–96. (Radon ser. comput. appl. math.; vol. 21).

    Chapter  Google Scholar 

  24. Yong J, Zhou XY. Stochastic controls: Hamiltonian systems and HJB equations. Berlin: Springer; 1999. (Applications of mathematics (New York); vol. 43). ISBN 0-387-98723-1. https://doi.org/10.1007/978-1-4612-1466-3.

    Book  MATH  Google Scholar 

Download references

Acknowledgements

We are grateful to Constantin Greif (Ulm) for cooperation within AEIT, in particular concerning the numerical simulation.

Availability of data and materials

The datasets used and/or analyzed during the current study are available from the corresponding author on reasonable request.

Funding

This work was funded by the German Federal Ministry for Economic Affairs and Energy within the project Analytics and Empirics of Intraday Trading of Electricity (AEIT).

Author information

Authors and Affiliations

Authors

Contributions

The empirical analysis for the mathematical model was mainly performed by RK, MK and NL. The construction of the numerical scheme was done by SG and KU; the coding is due to SG. Economical interpretation was due to NL, SK, LO and CW. All authors read and approved the final manuscript.

Corresponding author

Correspondence to Karsten Urban.

Ethics declarations

Competing interests

The authors declare that they have no competing interests.

Additional information

Publisher’s Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Glas, S., Kiesel, R., Kolkmann, S. et al. Intraday renewable electricity trading: advanced modeling and numerical optimal control. J.Math.Industry 10, 3 (2020). https://doi.org/10.1186/s13362-020-0071-x

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1186/s13362-020-0071-x

MSC

Keywords