 Research
 Open access
 Published:
Intraday renewable electricity trading: advanced modeling and numerical optimal control
Journal of Mathematics in Industry volume 10, Article number: 3 (2020)
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 halfspread and immediate price impact. The optimal trading and generation strategy of an agent is derived as the viscosity solution of a secondorder Hamilton–Jacobi–Bellman (HJB) equation for which no closedform 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, shortterm electricity contracts have gained importance on electricity exchanges such as the European Power Exchange (EPEX Spot^{Footnote 1}). In particular, continuous intraday trading, which allows trading of contracts until 30 minutes before delivery, is used to respond to shortterm 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 30min 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 panEuropean 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 dayahead market (DAM) modeling, literature dedicated to the continuous intraday electricity markets is scarce. In particular, appropriate mathematical models describing the main characteristics of these shortterm 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 shortterm 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 shortterm 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.
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.
Pricing model using timevarying halfspread and being capable of representing timevarying liquidity;
 3.
Approximation of market data for halfspread and instantaneous price impact;
 4.
Variable penalty depending on the state of the market at final time;
 5.
The model relies on data which are observable on the market (see Sect. 3).
The main focus of this paper is a novel applicationrelated modeling of the intraday trading and the determination of a numerical approximation for this problem. We show an example of a realworld 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 renewable^{Footnote 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 dayahead 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 Dayahead and intraday electricity trading
Consider a delivery hour h on day d. The day before, \(\mbox{d}1\), the dayahead 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.
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
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
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 dayahead 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
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 halfspread (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 halfspread 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 bidask spread and hence also the halfspread 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
where (as usual)
Hence, (4) means that the execution price is the permanently impacted mid price plus (minus) the timevarying halfspread and plus the timevarying 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
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 timeindependent (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
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
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 halfspread \(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
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],
where \(\mathcal{U}:=\mathcal{Y}\times\mathcal{Z} \subset\mathbb {R}^{2}\) is a closed convex set (usually a rectangle, in order to ensure wellposedness 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 wellposed 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 cutoff the problem on their boundaries. This requires to set boundary conditions to ensure wellposedness to be explained below.
2.4.2 The Hamilton–Jacobi–Bellman (HJB) equation
Following the wellknown 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
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 wellposed and that the unique viscosity solution is the value function in (9) , [5]. Due to the form of (10), we cannot expect a firstorder 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 wellknown 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 beforementioned IDMmodel 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.
By omitting the signpart in (10) and replacing it by the positive sign, the function within the supremum is differentiable.
 2.
We replace \(h(t)\) by \({\bar {h}}:=h(T)\), i.e., the halfspread at the terminal time.
 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.
The permanent price impact vanishes, i.e., \(\psi\equiv0\).
Thus, the simplified HJB now takes the form
In (11), we can explicitly determine the supremum by finding the root of the firstorder derivative w.r.t. q of the term in \(\{\cdots\}\). The corresponding firstorder necessary conditions yield the optimal control as follows (recall from 3. that \(k>0\))
Inserting this optimal control into (11) yields the following PDE for the unknown v as a function of \((t,y,z)\)
To solve (12), we make the following polynomial ansatz
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.,
In order to solve this system of ordinary differential equations, we need initial conditions for the functions \(a_{i}\). Due to the arguments \((Tt)\) 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 initialvalue 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.
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 sitespecific 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 socalled deadband between zero and production at minimal capacity \(\kappa^{\min}_{i}\)—reduces the efficiency of the unit. Moreover, we assume that the startup decision \(a_{i}\in\{0,1\}\) of a unit does not require a lead time.
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 dayahead market (DAM) prices and volumeweighted average IDM prices^{Footnote 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 volumeweighted 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}\).
We obtain estimates for b and \(\mu_{Y}\) from least squares fits to the data. For b, we get 0.0017€/MWh^{2} 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 halfspread h, see (4).
3.3.1 Data
We use order book data from the EPEX SPOToperated market for hourly delivery contracts with Germany/Austria^{Footnote 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 Halfspread
In identifying typical halfspread functions h entering the optimization problem, we build on research on bidask spreads (BAS) on the NYSE^{Footnote 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 oneminute intervals and compute for each interval and stock what they refer to as the timeweighted BAS to be explained next. Consider some time interval \(I_{i}:= (T_{i1},T_{i} ]\subset[0,T]\) and assume that the BAS changes \(N_{i}\) times at \(T_{i1} < 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_{i1}\) and \(t^{(i)}_{N_{i}+1}:=T_{i}\). Then, the timeweighted BAS on that interval \(I_{i}\), denoted by \(\overline{\text{BAS}}_{i}\), is defined as
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 5minute 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 twodimensional 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.
We observe a significant decrease of the mean timeweighted 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 timeweighted 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 halfspread 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 halfspread 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 halfspread, we start by determining timeweighted prices and volumes over 5minute intervals on the different order book levels.^{Footnote 9} Given some timeweighted price on an order book level, it may occur that the timeweighted 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,
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 twodimensional histograms as well as means per time interval (blue line).
Similar to the average halfspread, the average execution costs exhibit a decline after market opening to 0.025–0.05€/MWh^{2}. After a rather stable ≈10 hours period, they further decline to ≈0.01€/MWh^{2}. 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 halfspread. 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.
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 bestprice 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
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 firstorder terms with additional artificial diffusion, which results in a stable, consistent and monotone scheme converging to the viscosity solution, [23]. We use the wellknown policy iteration [3] in every timestep and the control is maximized over a discrete set (as no firstorder conditions are available). Finally, the optimal conventional generation is computed as the maximum value of (8) w.r.t. ξ using Matlab’s^{Footnote 10}intlinprog 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 leastsquares 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(x20)\chi_{20 < x \le45} + ((x45)+ 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 100400 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.
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}\equiv499.4\mbox{ MWh}\) (the noninteger numbers arise from the discretization w.r.t. y and z). For the mid price, we choose {Y}_{t}\equiv 59.25\text{\u20ac/MWh} (left) and {Y}_{t}\equiv 13.98\text{\u20ac/MWh} (right). In the left plot, the trading rate is negative (selling), which is reasonable since \(Z_{t}\equiv499.4\mbox{ MWh}\) means that the agent has only marketed the cheapest power plant and {Y}_{t}\equiv 59.25\text{\u20ac/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 halfspread 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.
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
In our numerical experiments, we consider wind energy.
Note, that we do not simultaneously optimize dayahead and intraday trading.
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.
Note, that the hourly value given above may be adapted to timewise granularity other than 60 minutes by the use of the squarerootoftime rule.
These are transaction prices multiplied with transaction volumes divided by the overall transaction volume.
Splitting into two separate market areas took effect only in October 2018.
New York Stock Exchange
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.
MathWorks™, mathworks.com
This is done for visualization purposes; we could of course also have used market data.
Abbreviations
 AIC:

Akaike information criterion
 BAS:

bidask spreads
 BS:

Black–Scholes (equation)
 CCGT:

combined cycle gas turbine (unit)
 DAM:

dayahead 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
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/s1157901501508.
Akaike H. Statistical predictor identification. Ann Inst Stat Math. 1970;22:203–17.
Bellman R. Dynamic programming. Princeton: Princeton University Press; 1957.
Cartea Á, Jaimungal S. Incorporating orderflow into optimal execution. Math Financ Econ. 2016;10(3):339–64. https://doi.org/10.1007/s115790160162z.
Crandall MG, Lions PL. On existence and uniqueness of solutions of Hamilton–Jacobi equations. Nonlinear Anal. 1986;10(4):353–70.
Fleming WH, Soner HM. Controlled Markov processes and viscosity solutions. 2nd ed. Berlin: Springer; 2006. (Stochastic modelling and applied probability; vol. 25). ISBN 0387260455.
Garnier E, Madlener R. Balancing forecast errors in continuoustrade intraday markets. Energy Syst. 2015;6(3):361–88.
Garnier E, Madlener R. Dayahead versus intraday valuation of demandside flexibility for photovoltaic and wind power systems. FCN working paper 17/2014. 2014. https://doi.org/10.2139/ssrn.2556210.
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).
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.
Henriot A. Market design with centralized wind power management: handling lowpredictability in intraday markets. Energy J. 2014;35(1):99–117.
Kestler S, Urban K. Adaptive wavelet methods on unbounded domains. J Sci Comput. 2012;53(2):342–76.
Kiesel R, Kremer M, Paraschiv F. A fundamental model for intraday electricity trading. LEF working paper. 2020. https://ssrn.com/abstract=3489214.
Kiesel R, Paraschiv F. Econometric analysis of 15minute intraday electricity prices. Energy Econ. 2017;64:77–90.
Kolkmann S, Ostmeier L, Weber C. Modelling multivariate intraday forecast update processes for wind power. Unpublished working paper, University of DuisburgEssen. 2019.
McInish TH, Wood RA. An analysis of intraday patterns in bid/ask spreads for NYSE stocks. J Finance. 1992;47(2):753–64.
Miettinen JJ, Holttinen H. Characteristics of dayahead 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.
Morales JM, Conejo AJ, PérezRuiz JA. Economic valuation of reserves in power systems with high penetration of wind power. IEEE Trans Power Syst. 2009;24(2):900–10.
Øksendal B. Stochastic differential equations: an introduction with applications. 6th ed. Berlin: Springer; 2003. (Universitext). ISBN 3540047581. https://doi.org/10.1007/9783642143946.
Pape C, Weber C, Hagemann S. Are fundamentals enough? Explaining price variations in the German dayahead and intraday power market. Energy Econ. 2016;2016(54):376–87.
Le reseau de transporte d’electricite (RTE). Portail Clients: Prévisions de production éolienne en France. 2019. https://clients.rtefrance.com/lang/fr/visiteurs/vie/previsions_eoliennes.jsp.
Samuelson PA. Proof that properly anticipated prices fluctuate randomly. Ind Manage Rev. 1965;6(2):41–9.
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).
Yong J, Zhou XY. Stochastic controls: Hamiltonian systems and HJB equations. Berlin: Springer; 1999. (Applications of mathematics (New York); vol. 43). ISBN 0387987231. https://doi.org/10.1007/9781461214663.
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
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
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/.
About this article
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/s133620200071x
Received:
Accepted:
Published:
DOI: https://doi.org/10.1186/s133620200071x