1 Introduction and modeling

Trading electricity in the intraday market comes with a lot of features such as the possibility to satisfy an additional short-term demand for electricity, to offer a surplus amount of electricity from solar and/or wind energy that is the result of better weather conditions than predicted, and – on the other side of the scale – to compensate shortages in electricity production due to weather conditions that are worse than predicted (see e.g. Coskun and Korn 2021 for details of the different electricity market segments in Germany). Further, the possibility of direct trades between customer and provider also results in price dynamics that can differ from the auction type price determination in the day-ahead market and comparable markets (see Kiesel and Paraschiv 2017 for the econometrics of prices). This might attract various players to trade in the intraday market such as

  • speculators who believe that they are better informed with regard to additional demand or weather conditions and might enter positions in the day-ahead market that they have to close in the intraday market,

  • price sensitive customers (smart grids) that might have price predictions for the intraday market that are favourable compared to the prices announced in the day-ahead market,

  • electricity providers that hope for better earnings for some part of their productions that they decide to reserve for trading in the intraday market,

  • electricity providers that use renewable resources (e.g. solar and wind power) for production and use the intraday market for (at least partly) hedging their uncertainties in the production.

Therefore, in this article, we develop a simple one-period mean-field games setting for optimal behaviour of a set of electricity providers that trade at both the day-ahead and in the intraday market (see e.g. Lasry and Lions 2007 and Carmona and Delarue 2013 for introductions in the theory of (continuous-time) mean-field games and also Guéant et al. 2011 for a similar one-period model for optimal asset management). The providers are connected by a ranking criterion according to which each one wants to perform as good as possible measured in terms of return.

The concept of performing better among others, i.e. the relative performance concerns of the agents/players, have been investigated in context of optimal investment by Lacker and Zariphopoulou (2019), Espinosa and Touzi (2015) in continuous-time markets. In a setting, where relative performance concerns of the players are present, an agent does not solely take his absolute wealth into consideration but also the average wealth of his peers. Mathematically, this can be achieved in different ways. In Lacker and Zariphopoulou (2019) the ranking criterion is embedded in the utility functions of homogeneous agents both in additive and multiplicative manners for an N-player game and the limiting case, i.e. a mean-field-game. On the other hand, in Espinosa and Touzi (2015) initially heterogeneous agents, i.e. with different utility functions and different constraints sets, and subsequently homogeneous agents with relative performance concerns for an N-player game are considered.

The recent literature regarding the use of the mean-field game theory in electricity markets is centered around the problem of price formation in different settings (Gomes and Sáude 2021; Féron et al. 2021, 2020).

We consider a one-period decision problem of an electricity trader who has to decide about the fraction \(\pi \) of his production that he reserves for trading at the intraday market while trading the remaining fraction \(1-\pi \) at the day-ahead market. His corresponding objective function is a sum of a mean-variance criterion and a weighted ranking criterion among the remaining market participants. While leaving this second component away would lead to a simple Markowitz mean-variance problem of portfolio optimization (see Markowitz 1952), including it will lead to a discrete-time mean-field setting. We do not look at the consequences for the price formation.

Besides the formulation and the solution of the mean-field game problem, we will also highlight some explicit features of the optimal solution that makes the obtained strategies attractive for practical use and give insight of the potential of trading in the intraday market. In particular, we will show that

  • in the situation of an (at least partly) uncertain height of the electricity production, it will be optimal for an electricity provider to trade parts of her production in the intraday market, even in the case when the provider does not believe in a positive risk premium for trading in the intraday market,

  • without a positive risk premium (i.e. the belief that the average electricity price at the intraday market exceeds the price at the day-ahead market), electricity providers will not trade positive amounts in the intraday market if consumption is (at least partly) uncertain and the electricity production is deterministic,

  • traders with slightly positive or slightly negative beliefs on the risk premium for intraday trading will generally increase/decrease their optimal positions in the intraday market over proportionally compared to the situation when there is no interrelation between the traders which in our model is expressed by a ranking criterion.

In the next section, we will first solve an idealized mean-variance optimization problem with a ranking criterion. After a numerical analysis of this idealized problem, we will then take it as a building block for developing a more realistic approach by including uncertainty of both electricity production and electricity demand in the intraday market in the following section.

While our approach is mainly intended to model the situation of electricity providers it can also be used by speculators or price sensitive consumers where then the roles of demand and production have to be changed or suitably interpreted.

2 A first simple optimal trading problem in a mean-variance setting

We will start with a simplistic situation where the electricity producers have a fixed production capacity for the next day. We assume that this full production capacity can be sold in the day-ahead and in the intraday market. Further, a producer can decide about which proportion \(\pi \) of the production capacity shall be reserved for trading in the intraday market, while the remaining proportion \(1-\pi \) is already sold in the day-ahead market.

For this, we assume:

  • The price in the day-ahead market is already fixed after having sold the intended amount of electricity. Thus, it can be considered as a riskless investment with no additional return at delivery, i.e. tomorrow.

  • The return \(\Lambda \) (above or below the one in the day-ahead market) by trading the remaining amount of produced electricity in the intraday market is assumed to be normally distributed with \(\Lambda \sim {\mathcal {N}}(\lambda , \sigma ^2)\).

  • Different producers differ by their view on the mean \(\lambda \).

Further, all producers want to maximize the mean of the total return minus a fixed, non-negative multiple \(\gamma \) of the variance of the total return by choosing the fraction \(\pi \) of their production that is reserved for trading in the intraday market. Of course, this strategy will depend on their personal view with regard to the size of \(\lambda \).

On top of that, the producers want to perform good when compared among themselves, i.e. they want to achieve a ranking as close as possible to one with regard to the return generated from trading in the intraday market. This is expressed by

$$\begin{aligned} {\tilde{C}}(\pi ):= 1_{\Lambda >0}M(\pi ) + 1_{\Lambda \le 0}(1-M(\pi )), \end{aligned}$$

where M(.) is the distribution function of the strategies \(\pi \) chosen by the different traders (see e.g. Guéant et al. 2011 for this criterion). Note in particular that for a positive realization of \(\Lambda \) the trader using the highest value of \(\pi \) is ranked first, while for a negative \(\Lambda \) the one with the lowest value of \(\pi \) is ranked first. \({\tilde{C}}(\pi )\) takes these conflictive situations into account.

Finally, the producers’ distribution of the view on the mean return \(\lambda \) of the producers is described by the density function f(.) where we additionally assume that f(.) is continuously differentiable on its support and satisfies \(f(0)>0\)

We thus consider the optimization problem that each producer has to face as

$$\begin{aligned}&\max _{\pi } \left\{ \pi {\mathbb {E}}( \Lambda ) - \frac{1}{2}\gamma \pi ^2 Var(\Lambda ) + \beta {\mathbb {E}}({\tilde{C}}(\pi )) \right\} \nonumber \\&\quad =\max _{\pi } \left\{ \pi \lambda - \frac{1}{2}\gamma \pi ^2\sigma ^2 + \beta \{ M(\pi )\left( 2\Phi \left( \frac{\lambda }{\sigma }\right) -1\right) +\Phi \left( \frac{\lambda }{\sigma }\right) \} \right\} \end{aligned}$$
(1)

where \(\Phi \) denotes the distribution function of the standard normal distribution. By taking the first order derivative with respect to \(\pi \) we get the first order condition

$$\begin{aligned} \lambda - \gamma \sigma ^2\pi + \beta m(\pi )\left( 2\Phi \left( \frac{\lambda }{\sigma }\right) -1\right) = 0 \ \end{aligned}$$
(2)

where \(m(\pi ) = M'(\pi )\). By assuming that the optimal solution of the maximization problem (1) is an increasing function \( \lambda \rightarrow \pi (\lambda )\), the density transformation theorem yields the following relation between the view of the different traders about the mean excess return \(\lambda \) achievable in the intraday market as expressed by the density function \(f(\lambda )\) and the density function \(m(\pi (\lambda ))\) of their subjectively optimal strategies

$$\begin{aligned} m(\pi (\lambda )) \pi '(\lambda ) = f(\lambda ), \end{aligned}$$
(3)

a relation that is called consistency condition in Guéant et al. (2011). As we here have a one-off decision, the density transformation formula suffices to derive this probability transport relation. The use of the Kolmogorov partial differential equation for the transition density can be avoided. Using relation (3) and multiplying the first order condition (2) with \(\pi '(\lambda )\) yields the following differential equation for \(\pi (\lambda )\)

$$\begin{aligned} \left( \lambda - \gamma \sigma ^2\pi (\lambda ) \right) \pi '(\lambda ) + \beta \left( 2\Phi \left( \frac{\lambda }{\sigma }\right) -1\right) f(\lambda )&= 0 , \end{aligned}$$
(4)
$$\begin{aligned} \pi (0)&= 0. \end{aligned}$$
(5)

Note that we get the boundary condition from solving the optimization problem (1) for the choice of \(\lambda =0\).

The solution of Eq. (4) without the ranking effect, i.e. \(\beta = 0 \) is given by \(\lambda \mapsto \pi _0 (\lambda ) = \frac{\lambda }{\gamma \sigma ^2}\). Thus, in our case, where \(\beta >0\), we rewrite the problem as follows:

$$\begin{aligned} \pi '(\lambda )&= \dfrac{\beta }{\gamma \sigma ^2} \left( 2\Phi \left( \frac{\lambda }{\sigma }\right) -1 \right) \frac{f(\lambda )}{\pi (\lambda )- \pi _0(\lambda )} \ , \lambda \ne 0, \end{aligned}$$
(6)
$$\begin{aligned} \pi (0)&= 0\ . \end{aligned}$$
(7)

This problem is not trivial, since the initial boundary cannot be defined for \(\lambda = 0\), which leads to a singularity in the domain of the ODE. Hence, any solution should be on a subset of either \((-\infty , 0)\) or \((0,\infty )\). For this reason, the initial boundary condition is only given in the limit as \(\lim _{\lambda \rightarrow 0} \pi (\lambda ) = 0 \). Moreover, the right hand side of the ODE is positive for \(\lambda >0\) if and only if we have

$$\begin{aligned} \pi (\lambda )> \pi _0(\lambda ), \ \ \lambda >0. \end{aligned}$$
(8)

Thus, the assumption that \(\pi (\lambda )\) has to be increasing yields \(\pi (\lambda ) > \pi _0(\lambda )\) for \(\lambda >0\) and similarly \(\pi (\lambda ) < \pi _0(\lambda )\) for \(\lambda <0\).

We have thus obtained two requirements on the solution \(\pi (\lambda )\) of (4). The following proposition will show that these requirements indeed uniquely determine the solution of the corresponding ODE.

Proposition 1

(Existence and uniqueness) There exists a unique increasing solution \(\pi (\lambda )\) of the initial value problem (IVP) given in Eq. (4) under the following constraints:

\({{\textit{\textbf{Case I}}}}\):

\(\lambda >0 \):

  1. (i)

    \(\pi (\lambda ) > \pi _0(\lambda ) = \frac{\lambda }{\gamma \sigma ^2}\),

  2. (ii)

    \(\lim _{\lambda \rightarrow 0^+} \pi (\lambda ) = 0\).

\({{\varvec{Case II}}}\):

\(\lambda <0 \):

  1. (i)

    \(\pi (\lambda ) < \pi _0(\lambda ) = \frac{\lambda }{\gamma \sigma ^2}\),

  2. (ii)

    \(\lim _{\lambda \rightarrow 0^-} \pi (\lambda ) = 0\).

See Appendix A for the proof.

So far, we have indeed only derived our candidate for the optimal solution from a first order condition. We still need to verify that we have indeed found the optimal solution when we have solved the above IVP. As in Guéant et al. (2011) we show this via verifying the second order condition.

Proposition 2

(Second order condition) The solution \(\pi (\lambda )\) of IVP that satisfies the conditions of Proposition 1 solves the optimization problem (1).

See Appendix B for the proof.

Remark 1

(No variance constraint) One could also try to consider the problem without the quadratic term in \(\lambda \) by setting \(\gamma =0\) and still use the initial condition \(\pi (0) = 0\). However, this time we have a totally degenerated situation as the optimal choice \(\pi _0(\lambda )\) would be \(\pi _0(\lambda )=+\infty \) for a positive surplus and \(\pi _0(\lambda )=-\infty \) for a negative surplus due to the linear utility function. Thus, we cannot derive an ODE. Even, if we bound the optimal values by \(\pm 1\), we would still have a discontinuity in \(\lambda =0\). Thus, the influence of the quadratic term in the utility criterion is essential for a reasonable solution of the problem.

3 Numerical analysis of the basic problem

We illustrate the behaviour of the optimal strategy for different choices of \(\beta , \sigma ^2\) and \(\gamma \). Due to the special nonlinear form of the ODE, we use an implicit Euler method to avoid instabilities when solving it. Our choices of the parameters is motivated by the behavior of the case of \(\beta =0\). For reasonable choices of the surplus return \(\lambda \) the individually optimal strategies should not exceed 1, or at least should not exceed it by too much.

3.1 Normally distributed views

We start with the case of a normally distributed view on the mean excess return \(\lambda \) by the traders, i.e. f(.) is the density of the normal distribution with parameters \(\mu , \theta ^2\). To understand the significance of the choices of \(\mu ,\theta ^2\), we should not consider traders with a view outside the interval \(\mu \pm 3 \theta ^2\).

We start with a value of \(\beta =0.5\), i.e. we give the ranking effect quite a high weight (note that the ranking effect varies between 0 and 1). Further, we use \(\gamma = 1\) and \(\sigma ^2=0.04\). With \((\mu , \theta ^2)=(0, 0.0001)\), i.e. a symmetric view on the surplus return, we obtain Fig. 1.

Note the particular effect that outside the interval \([-0.04, 0.04]\) it is not necessary to take additional risk to perform well in the ranking condition as there are virtually no traders with a lower or higher view. Thus, if a trader takes on such an extreme view, it is already enough to have the best performance if her view is correct. Inside the interval, however, an excess position of \(\pi (\lambda )-\pi _0(\lambda )\) is required to perform better in the ranking position.

If we reduce the weight of the ranking criterion to \(\beta =0.1\) then the mean-variance criterion receives a higher weight which results in a reduction of the excess position \(\pi (\lambda )-\pi _0(\lambda )\) as can be seen in Fig. 2.

Fig. 1
figure 1

Choices of \(\pi (\lambda )\), normal view with \((\mu , \theta ^2)=(0, 0.0001)\), \(\beta =0.5, \ \sigma ^2=0.04, \ \gamma =1\)

An asymmetric view of the traders – expressed by choosing \(\mu =0.01\) – leads to an expected asymmetric behaviour of the trader in taking more excess risk for the performance criterion mostly for positive values of \(\lambda \) as can be seen in Fig. 3.

Fig. 2
figure 2

Choices of \(\pi (\lambda )\), normal view with \((\mu , \theta ^2)=(0, 0.0001)\), \(\beta =0.1, \ \sigma ^2=0.04, \ \gamma =1\)

Fig. 3
figure 3

Choices of \(\pi (\lambda )\), normal view with \((\mu , \theta ^2)=(0.01, 0.0001)\), \(\beta =0.1, \ \sigma ^2=0.04, \ \gamma =1\)

4 The optimization problem with uncertainty in the electricity production and the electricity demand

So far, we have solved a basic mean field problem in Sect. 2 and (implicitly) assumed that

  • there is no uncertainty about the amount of electricity actually produced by the different providers on the next day,

  • each provider can certainly sell the desired amounts in the day-ahead and in the intraday market.

As, however, these modeling assumptions are unrealistic, we will now show how to deal with them in the framework that we have set up so far. The main idea is to use this solved problem as a fundamental building block and try to repair the weaknesses of the basic model. For this, we have to come up with versions of optimization problems that address the above generalizations and still fall in the scope of our building block problem.

4.1 Uncertain volume of the electricity production

Assume that we have a predicted production volume of electricity of \(\nu \) and

  1. 1.

    choose to sell \((1-\pi )\nu \) in the day-ahead market,

  2. 2.

    then are actually able to produce an amount of V of electricity which – for simplicity – is revealed at the beginning of the delievery period,

  3. 3.

    and sell the part in the intraday market that has not already been sold in the day-ahead market or buy the part in the intraday market by which the amount sold in the day-ahead market exceeds the production of today.

This has the consequence that indeed the fraction

$$\begin{aligned} {\tilde{\pi }}=\frac{V-(1-\pi )\nu }{V} \end{aligned}$$

of the produced electricity is sold in the intraday market if we have \(V > (1-\pi )\nu \) or has to be bought in the intraday market in case of \(V < (1-\pi )\nu \). Note that to include the risk that the actual amount of production is below or above the amount, which is already sold in the day-ahead market, we consider the value V as follows:

$$\begin{aligned} V = \nu (1 + \varepsilon ) \end{aligned}$$

where \(\varepsilon \) is a random variable accounting for the production uncertainty. Hence, we rewrite the fraction that can be traded in the intraday market as

$$\begin{aligned} {\tilde{\pi }}= \frac{\nu (1 + \varepsilon ) - (1-\pi ) \nu }{\nu (1 + \varepsilon )} = 1 - \dfrac{1-\pi }{1 + \varepsilon }. \end{aligned}$$
(9)

As we should ensure a non-zero denominator in this expression as well as an expectation of zero for \(\varepsilon \), a particularly suitable choice is

$$\begin{aligned} 1+\varepsilon = e^{\alpha Z -\frac{1}{2}\alpha ^2} \end{aligned}$$

with \(Z\sim {\mathcal {N}}(0,1)\) and \(\alpha \in {\mathbb {R}}\). This results in

$$\begin{aligned} {\mathbb {E}}(1+\varepsilon ) = 1, \ \ {\mathbb {E}}({\tilde{\pi }}) = 1-(1-\pi )e^{\alpha ^2} . \end{aligned}$$

Then, this formally leads to the new utility criterion of

$$\begin{aligned}&{\tilde{\pi }} {\mathbb {E}}( \Lambda ) - \frac{1}{2}\gamma {\tilde{\pi }}^2 Var(\Lambda ) + \beta {\mathbb {E}}({\tilde{C}}(\pi )) \nonumber \\&\quad =\left[ 1 - \dfrac{1-\pi }{1+ \varepsilon } \right] \lambda - \frac{1}{2}\gamma \sigma ^2 \left[ 1 - \dfrac{1-\pi }{1 + \varepsilon }\right] ^2 + \beta \left\{ M(\pi )\left( 2\Phi \left( \frac{\lambda }{\sigma }\right) -1\right) +\Phi \left( \frac{\lambda }{\sigma }\right) \right\} . \end{aligned}$$
(10)

If we assume that the ranking effect remains the same as it was defined for the fraction \(\pi \), i.e. we keep the definition of \({\tilde{C}}(\pi )\), then we obtain the following extended maximization problem:

$$\begin{aligned}&\max _{\pi } \left\{ E({\tilde{\pi }}) {\mathbb {E}}( \Lambda ) - \frac{1}{2}\gamma E({\tilde{\pi }}^2) Var(\Lambda ) + \beta {\mathbb {E}}({\tilde{C}}(\pi )) \right\} \nonumber \\&\quad =\max _{\pi } \left\{ a_1(\pi )\lambda - \frac{1}{2}\gamma b_1(\pi )\sigma ^2 + \beta \{ M(\pi )\left( 2\Phi \left( \frac{\lambda }{\sigma }\right) -1\right) +\Phi \left( \frac{\lambda }{\sigma }\right) \} \right\} \ . \end{aligned}$$
(11)

with

$$\begin{aligned} a_1(\pi )&= E({\tilde{\pi }}) = 1 - (1-\pi ) E\left( \dfrac{1}{1 + \varepsilon } \right) \nonumber \\&=: 1 - (1-\pi ) e^{\alpha ^2} , \end{aligned}$$
(12)
$$\begin{aligned} b_1(\pi )&= E({\tilde{\pi }}^2) = E\left[ \left( 1 - \dfrac{1-\pi }{1 + \varepsilon } \right) ^2\right] \nonumber \\&= (1-\pi )^2 E\left[ \left( \dfrac{1}{1 + \varepsilon } \right) ^2\right] - 2 (1-\pi ) E\left( \dfrac{1}{1 + \varepsilon } \right) + 1 \nonumber \\&=: (1-\pi )^2 e^{3\alpha ^2} - 2 (1-\pi )e^{\alpha ^2} + 1 . \end{aligned}$$
(13)

We can finally rewrite the problem as

$$\begin{aligned} \max _{\pi } \left\{ \left( (\lambda -\gamma \sigma ^2) e^{\alpha ^2} + \gamma \sigma ^2 e^{3\alpha ^2} \right) \pi - \frac{1}{2}\gamma \sigma ^2 e^{3\alpha ^2} \pi ^2 + \right. \nonumber \\ \left. \beta \{ M(\pi )\left( 2\Phi \left( \frac{\lambda }{\sigma }\right) -1\right) +\Phi \left( \frac{\lambda }{\sigma }\right) \}\right\} + \Gamma _1 \ \end{aligned}$$
(14)

where the constant \(\Gamma _1\) is given by

$$\begin{aligned} \Gamma _1 = \lambda -\frac{1}{2}\left( 1 - 2 e^{\alpha ^2} +e^{3\alpha ^2 }\right) \end{aligned}$$
(15)

but is not important for solving the problem. As the actual fraction \({\tilde{\pi }}\) is only known a posteriori, we are still choosing \(\pi \) and call this the intended portfolio. Note that with this we have the same optimization problem as in the case of a fixed deterministic production, but the coefficients of \(\pi \) and \(\pi ^2\) have changed. This change is then reflected in the determination of the boundary condition for the corresponding ODE. Using the abbreviations \(E_1=e^{\alpha ^2}\) and \(E_2=e^{3\alpha ^2}\), we obtain the relevant first order condition as follows

$$\begin{aligned} \left( (\lambda -\gamma \sigma ^2) E_1 + \gamma \sigma ^2 E_2 \right) - \gamma \sigma ^2 E_2 \pi + \beta m(\pi )\left( 2\Phi \left( \frac{\lambda }{\sigma }\right) -1\right) =0 \end{aligned}$$
(16)

Setting \(\lambda =0\) yields the required boundary condition. Consequently, we obtain the following ODE for this extended case

$$\begin{aligned} \pi '(\lambda )&= \dfrac{\beta }{\gamma \sigma ^2 E_2} \left( 2\Phi \left( \frac{\lambda }{\sigma }\right) -1 \right) \dfrac{f(\lambda )}{\pi (\lambda ) - \pi _\nu (\lambda )} \ , \lambda \ne 0, \end{aligned}$$
(17)
$$\begin{aligned} \pi (0)&= 1 - \dfrac{E_1}{E_2}\ \end{aligned}$$
(18)

where

$$\begin{aligned} \pi _\nu (\lambda ) = 1+ \dfrac{(\lambda - \gamma \sigma ^2)E_1}{\gamma \sigma ^2 E_2}. \end{aligned}$$

The ODE is quite similar to the one in the simple case. Hence, a numerical solution of the problem can be obtained in a similar way. For two values of \(\alpha \), we present the optimal portfolios as a function of \(\lambda \) in the Fig. 4. Note in particular that it follows from the explicit form of the boundary condition (18) that even if in the case of no risk premium, i.e. \(\lambda =0\), the electricity provider now chooses a positive intended portfolio value \(\pi (0)>0\). This is of course reasonable as the fraction now reserved for the intraday market can be used to reduce the risk of a possible shortage in the production. In Fig. 4, we can see the particular effect of the parameter \(\alpha \) that determines the size of the shortage risk. For \(\alpha \) being close to zero, \(\pi (0)\) will also be small while for large values of \(\alpha \), the intended portfolio \(\pi (0)\) will approximate one.

Fig. 4
figure 4

Optimal choices of \(\pi (\lambda )\) in the case of uncertain production: Setting normal view on \(\lambda \) with \((\mu , \theta ^2)=(0, 0.0001)\), \(\beta =0.5, \ \sigma ^2=0.04, \ \gamma =1\)

Remark 2

(Possible penalties for shortage in production) So far we have considered the additional uncertainty in the production in the following implicit way:

Electricity already sold in the day-ahead market that has not been produced by the provider can be bought in the intraday market. However, by using the modified basic optimization problem we have assumed that it has to be bought with a risk premium of \(\lambda \) that now the other market participants can realize. Under this assumption, we only consider the shortage in production via a negative value of \({\tilde{\pi }}\).

If however there are higher costs for a negative position \({\tilde{\pi }}\) then we will model this by using a risk premium \(\kappa \) which is different and typically higher than \(\lambda \). This will then lead to a new formulation of the considered optimization problem below.

We could introduce the just mentioned penalty in the form of

$$\begin{aligned} p({\tilde{\pi }})=(\kappa - \lambda ){\mathbb {E}}({\tilde{\pi }}^-) \end{aligned}$$
(19)

In the case of the above introduced multiplicative model we can even calculate the penalty explicitly as

$$\begin{aligned} p({\tilde{\pi }})=(\kappa -\lambda )\left\{ 1-(1-\pi )e^{\alpha ^2}\Phi \left( \frac{1}{\alpha }\left( \ln (1-\pi )+\frac{3}{2}\alpha ^2\right) \right) \right\} \end{aligned}$$
(20)

and can include this form in the modified optimization problem

$$\begin{aligned} \max _{\pi } \{ E({\tilde{\pi }}) {\mathbb {E}}( \Lambda ) - \frac{1}{2}\gamma E({\tilde{\pi }}^2) Var(\Lambda ) - p({\tilde{\pi }}) + \beta {\mathbb {E}}({\tilde{C}}(\pi ))\} \end{aligned}$$
(21)

Unfortunately, the non-linearity in \(\pi \) appearing in Eq. (21) results in an additional term in the optimization problem and the first order condition that does not allow to easily transform it into our standard form.

4.2 Uncertain electricity demand in the intraday market

We now look at the other typical source of uncertainty in the intraday market, the case where the producers have to face uncertain electricity demand in the intraday market. Assume that we have a certain production \(\nu \) and our trading strategy is driven by the uncertain demand D in the intraday market. In this case, we can determine the proportion, which we aim to trade in the intraday market, as follows:

$$\begin{aligned} {\hat{\pi }} = \dfrac{D - (1-\pi ) \nu }{\nu }. \end{aligned}$$

As now the production is fixed, we can only have an additional demand in the intraday market that is non-negative and at most equals that part of the produced energy that is not already sold in the day-ahead market. Thus, we have the relation

$$\begin{aligned} D = \nu (1-\pi ) + \nu {\hat{\pi }} \end{aligned}$$

with

$$\begin{aligned} 0 \le {\hat{\pi }} \le \pi \end{aligned}$$

as the producer is of course not forced to satisfy excess demand above the production. A possible modeling of the randomness can be \({\hat{\pi }}=Z \pi \) with

$$\begin{aligned} Z=\min \{{\tilde{Z}},1\}, \ \ {\tilde{Z}}=e^{\eta w -\frac{1}{2}\eta ^2}, \ \ w\sim {\mathcal {N}}(0,1) \end{aligned}$$
(22)

for some \(\eta \ge 0\). From this, we obtain:

$$\begin{aligned} E({\hat{\pi }})= 2\Phi \left( -\frac{1}{2}\eta \right) \pi ,\ \ E({\hat{\pi }}^2)=\left( \Phi \left( -\frac{1}{2}\eta \right) + e^{\eta ^2}\Phi \left( -\frac{3}{2}\eta \right) \right) \pi ^2. \end{aligned}$$

Again, we obtain explicit formulas in terms of \(\pi \) and obtain an optimization problem in our standard form as

$$\begin{aligned}&\max _{\pi } \left\{ E({\hat{\pi }}) {\mathbb {E}}( \Lambda ) - \frac{1}{2}\gamma E({\hat{\pi }}^2) Var(\Lambda ) + \beta {\mathbb {E}}({\tilde{C}}(\pi )) \right\} \nonumber \\&\quad =\max _{\pi } \left\{ a_2 \pi \lambda - \frac{1}{2}\gamma b_2 \pi ^2\sigma ^2 + \beta \left\{ M(\pi )\left( 2\Phi \left( \frac{\lambda }{\sigma }\right) -1\right) +\Phi \left( \frac{\lambda }{\sigma }\right) \right\} \right\} . \end{aligned}$$
(23)

with \(a_2\) and \(b_2\) given as in Eq. (22), i.e.

$$\begin{aligned} a_2 = 2 \Phi \left( -\frac{1}{2}\eta \right) , \ \ b_2 =\Phi \left( -\frac{1}{2}\eta \right) +e^{\eta ^2}\Phi \left( -\frac{3}{2}\eta \right) \end{aligned}$$

From this, we directly obtain the first order condition

$$\begin{aligned} a_2 \lambda - \gamma \sigma ^2 b_2 \pi + \beta m(\pi )\left( 2\Phi \left( \frac{\lambda }{\sigma }\right) -1\right) = 0 \end{aligned}$$
(24)

which together with the usual consistency condition (3) leads to the following ODE

$$\begin{aligned} \pi '(\lambda )&= \dfrac{\beta }{\gamma \sigma ^2 b_2} \left( 2\Phi \left( \frac{\lambda }{\sigma }\right) -1 \right) \dfrac{f(\lambda )}{\pi (\lambda ) - \pi _d(\lambda )} \ , \lambda \ne 0, \end{aligned}$$
(25)
$$\begin{aligned} \pi (0)&= 0\ \end{aligned}$$
(26)

where

$$\begin{aligned} \pi _d(\lambda ) = \dfrac{a_2\lambda }{b_2\gamma \sigma ^2} \end{aligned}$$
(27)

denotes the solution of the optimization problem with \(\beta =0\) and where the boundary condition directly follows from the first order condition.

Remark 3

(Interpretation of the ODE) Note that with the notation of

$$\begin{aligned} {\tilde{\gamma }}=\frac{b_2}{a_2}\gamma , \ \ {\tilde{\beta }}= \frac{1}{a_2} \beta \end{aligned}$$

we obtain the standard ODE (6) by replacing \(\beta \) by \({\tilde{\beta }}\) and \(\gamma \) by \({\tilde{\gamma }}\), i.e. the uncertainty in the demand leads to a change in the weights for the variance of the return \(\Lambda \) and for the ranking criterion. Obviously, for \(\eta =0\) (i.e. no demand uncertainty and thus full demand for the production), the weights are both equal to 1 while for \(\eta =1\) we obtain \(a_2=0.617, b_2=0.49\). This means that the weight of the variance of the return is only \(80\%\) of its original influence while the weight of the ranking criterion increases by \(62.5\%\). Note that in contrast to the situation of uncertain production, the final condition \(\pi (0)=0\) implies that if there is no positive view here on the risk premium in the intraday market then the optimal intended fraction will not be positive.

To illustrate the effect of the uncertainty in the demand we present Fig. 5 where we plotted the optimal strategies \(\pi _{\eta }\) for \(\eta =0\) and \(\eta =1\). Note that for an increasing value of \(\eta \) the relation between the mean and the variance of \(\Lambda \) is getting more favourable for the mean. Thus, we see that the traders go for a higher deviation from the solution of the case without taking into account the ranking criterion, i.e. the case of \(\beta =0\).

Fig. 5
figure 5

Optimal choices of \(\pi (\lambda )\) in the case of uncertain consumption: Setting normal view on \(\lambda \) with \((\mu , \theta ^2)=(0, 0.0001)\), \(\beta =0.5,\ \sigma ^2=0.04, \ \gamma =1\)

4.3 Uncertainty in both electricity production and demand in the intraday market

As a final extension, we consider the case where we face uncertainty in both electricity production and demand in the intraday market. For this case, let again V be the actual amount of produced electricity with \(E(V)=\nu \) and let D be the actual electricity demand. Now consider the following simple equation

$$\begin{aligned} V = (D - (1-\pi )\nu ) + (V-(D-(1-\pi )\nu )) =: {\bar{\pi }}V + (1-{\bar{\pi }})V. \end{aligned}$$
(28)

Case 1: \(V \ge (1-\pi )\nu \)

As we do not have to saturate excess demand above V as long as we have \(V\ge (1-\pi )\nu \), we can already assume that we have

$$\begin{aligned} {\bar{\pi }} = \dfrac{D-(1-\pi )\nu }{V} \end{aligned}$$

where we have in this case also implicitly assumed

$$\begin{aligned} D \le V, \end{aligned}$$

and where in general (also in Case 2 below) we also have

$$\begin{aligned} D \ge (1-\pi )\nu \end{aligned}$$
(29)

as the right hand side of this inequality is already sold in the day-ahead market (as we assume for the moment that we have \(\pi \le 1\)). If we rewrite Eq. (28) as

$$\begin{aligned} V = (D - (1-\pi )\nu ) + (V-D) +(1-\pi )\nu =: A+B+C \end{aligned}$$
(30)

then we see that A is responsible for the surplus return in the intraday market, B shows the imbalance between demand and production and can lead to losses in the intraday market while C has already been sold in the day-ahead market and is fully determined.

Case 2: \(V<(1-\pi )\nu \)

In this case we have

$$\begin{aligned} D=(1-\pi )\nu \end{aligned}$$

and Eq. (28) can be rewritten as

$$\begin{aligned} V= (V-(1-\pi )\nu ) + ((1-\pi )\nu ) =: A + C \end{aligned}$$
(31)

which leads to the value of \({\bar{\pi }}\) given by

$$\begin{aligned} {\bar{\pi }}= 1-\frac{(1-\pi )\nu }{V}. \end{aligned}$$
(32)

Summing up, we obtain the following proposition:

Proposition 3

  1. (a)

    In the case of both random production V and (conditionally) random consumption D, the choice to sell an amount of \((1-\pi )\nu \) in the day-ahead market leads to the fraction of actually produced electricity V of

    $$\begin{aligned} {\bar{\pi }}= {\left\{ \begin{array}{ll} 1-\dfrac{(1-\pi )\nu }{V} &{} \text {if } \ V \le (1-\pi )\nu , \\ \dfrac{D-(1-\pi )\nu }{V} &{} \text {if } \ V > (1-\pi )\nu \end{array}\right. } \end{aligned}$$
    (33)

    that is sold in the intraday market. Here, we assume that the demand D always is at least equal to the amount of electricity sold in the day-ahead market and never exceeds V.

  2. (b)

    Under the assumptions of part a) we have:

    $$\begin{aligned} E({\bar{\pi }})&= 1-(1-\pi )E\left( \frac{\nu }{V}\right) + E\left( \frac{D-V}{V} 1_{\{V>(1-\pi )\nu \}}\right) \nonumber \\&= 1-(1-\pi )E\left( \frac{\nu }{V}\right) + (1-\pi )\nu E\left( \frac{1}{V} 1_{\{V>(1-\pi )\nu \}}\right) \nonumber \\&\quad - E\left( (1-{\bar{\pi }}) 1_{\{V>(1-\pi )\nu \}}\right) \end{aligned}$$
    (34)
    $$\begin{aligned} E({\bar{\pi }}^2)&= 1-2(1-\pi )E\left( \frac{\nu }{V}\right) + (1-\pi )^2 E\left( \frac{\nu ^2}{V^2}\right) \nonumber \\&\quad + E\left( \frac{D^2-V^2}{V^2}1_{\{V>(1-\pi )\nu \}}\right) \nonumber \\&\quad - 2(1-\pi )\nu E\left( \frac{D-V}{V^2}1_{\{V>(1-\pi )\nu \}}\right) . \end{aligned}$$
    (35)

See Appendix 1 for the proof.

Remark 4

(Total elimination of the risk of a too small production) Note that in the particular case of \(\pi \ge 1\), i.e. the electricity provider does not take on a long position in the day-ahead market, the condition \(V > (1-\pi )\nu \) is automatically satisfied. Further, as this way, no delivery obligation exists, there will not be the possibility for the need to buy electricity in the intraday market. However, the risk of not selling all the produced (and possibly bought!) electricity in the day-ahead market due to too few demand is emphasized. We will in the following always require

$$\begin{aligned} \pi \le 1. \end{aligned}$$
(36)

A particular model specification for uncertain demand and uncertain electricity production: The main task that we have to overcome to be able to reduce the new setting to our basic one with deterministic production and demand is to specify the distribution of 1/V and the conditional distribution of D/V. For this, we try be close to the two preceding sections.

First, we again consider a log-normally distributed production of the form

$$\begin{aligned} V=\nu e^{\alpha Z - \frac{1}{2} \alpha ^2} \end{aligned}$$
(37)

with \(Z \sim {\mathcal {N}}(0,1)\). We further assume that there is a demand D with \(D\ge (1-\pi )\nu \). It is thus natural to suppose that the surplus demand exceeding the amount of electricity already sold in the intraday market is proportional to the remaining amount of produced electricity. More precisely, we model the random demand by the equation

$$\begin{aligned} D-(1-\pi )\nu = \delta (V-(1-\pi )\nu ) =: \pi ^* V \end{aligned}$$
(38)

where for simplicity we assume \(\delta \) to be a constant in [0, 1].Footnote 1 This leads to the representation of

$$\begin{aligned} {\bar{\pi }}= {\left\{ \begin{array}{ll} 1-\dfrac{(1-\pi )\nu }{V} &{} \text {if } \ V \le (1-\pi )\nu , \\ \delta \left( 1-\dfrac{(1-\pi )\nu }{V}\right) &{} \text {if } \ V > (1-\pi )\nu \end{array}\right. } \end{aligned}$$
(39)

In addition, for technical simplicity we now assume

$$\begin{aligned} \pi < 1, \end{aligned}$$
(40)

i.e. we do not allow for short positions in the day-ahead market.Footnote 2

Under all these assumptions, we obtain

$$\begin{aligned} E({\bar{\pi }})&= E\left( \left( 1-\dfrac{(1-\pi )\nu }{V} \right) 1_{V\le (1-\pi )\nu }\right) \nonumber \\&\quad + \delta E\left( \left( 1-\dfrac{(1-\pi )\nu }{V} \right) 1_{V> (1-\pi )\nu }\right) \nonumber \\&= 1-(1-\pi )e^{\alpha ^2}-E\left( (1-\delta )\left( 1-\frac{(1-\pi )\nu }{V}\right) 1_{V> (1-\pi )\nu }\right) \nonumber \\&= 1-(1-\pi )e^{\alpha ^2}-(1-\delta )\Phi \left( -\frac{1}{\alpha }(\ln (1-\pi )+\frac{1}{2}\alpha ^2)\right) \nonumber \\&\quad + (1-\pi )e^{\alpha ^2}(1-\delta )\Phi \left( -\frac{1}{\alpha }(\ln (1-\pi )+\frac{3}{2}\alpha ^2)\right) \end{aligned}$$
(41)

Similarly, we arrive at

$$\begin{aligned} E({\bar{\pi }}^2)&= 1- 2(1-\pi )e^{\alpha ^2} +(1-\pi )^2 e^{3\alpha ^2} \nonumber \\&\quad + (\delta ^2 -1)\left\{ \Phi \left( -\frac{1}{\alpha }(\ln (1-\pi )+\frac{1}{2}\alpha ^2)\right) \right. \nonumber \\&\quad \left. - 2(1-\pi )e^{\alpha ^2}\Phi \left( -\frac{1}{\alpha }(\ln (1-\pi )+\frac{3}{2}\alpha ^2)\right) \right. \nonumber \\&\quad \left. +(1-\pi )^2 e^{3\alpha ^2}\Phi \left( -\frac{1}{\alpha }(\ln (1-\pi )+\frac{5}{2}\alpha ^2)\right) \right\} \end{aligned}$$
(42)

What will help us in deriving the needed differential equation for the optimal fraction \(\pi (\lambda )\) is the following proposition (which follows by simply calculating the derivative in Eq. (43) for general j and relating it to the one of \(j=1\))

Proposition 4

For \(j\in \{1,2,3,\ldots \}\) we have

$$\begin{aligned}&\dfrac{d}{d\pi } \Phi \left( -\frac{1}{\alpha }(\ln (1-\pi )+\frac{j}{2}\alpha ^2)\right) \nonumber \\&\qquad = e^{-\frac{j-1}{2}\ln (1-\pi )} e^{-\frac{j^2-1}{8}\alpha ^2} \frac{d}{d\pi } \Phi \left( -\frac{1}{\alpha }(\ln (1-\pi )+\frac{1}{2}\alpha ^2)\right) \end{aligned}$$
(43)

Remark 5

The proposition in particular yields the following relations that simplify the derivation of the ODE for the full optimization problem

$$\begin{aligned}&\frac{d}{d\pi } \Phi \left( -\frac{1}{\alpha }(\ln (1-\pi )+\frac{5}{2}\alpha ^2)\right) = \frac{1}{(1-\pi )^2} e^{-3\alpha ^2} \frac{d}{d\pi } \Phi \left( -\frac{1}{\alpha }(\ln (1-\pi )+\frac{1}{2}\alpha ^2)\right) \\&\frac{d}{d\pi } \Phi \left( -\frac{1}{\alpha }(\ln (1-\pi )+\frac{3}{2}\alpha ^2)\right) = \frac{1}{(1-\pi )} e^{-\alpha ^2} \frac{d}{d\pi } \Phi \left( -\frac{1}{\alpha }(\ln (1-\pi )+\frac{1}{2}\alpha ^2)\right) \end{aligned}$$

Derivation of the initial condition of the ODE: Our first step to derive the differential equation for the optimal intended fraction \(\pi (\lambda )\) as a function of the mean \(\lambda \) of the view of the electricity provider of the risk premium attainable by trading in the intraday market is to look at the initial condition for \(\pi (0)\).

For this, we consider the optimization problem with \(\lambda =0\) which has the following form:

$$\begin{aligned}&\max _{\pi } \left\{ \frac{1}{2}\beta - \frac{1}{2}\gamma \sigma ^2 \left[ 1- 2(1-\pi )e^{\alpha ^2} +(1-\pi )^2 e^{3\alpha ^2} \right. \right. \\&\quad \left. \left. + (\delta ^2 -1)\left\{ \Phi \left( -\frac{1}{\alpha }(\ln (1-\pi )+\frac{1}{2}\alpha ^2)\right) - 2(1-\pi )e^{\alpha ^2}\Phi \left( -\frac{1}{\alpha }(\ln (1-\pi )+\frac{3}{2}\alpha ^2)\right) \right. \right. \right. \\&\quad \left. \left. \left. +(1-\pi )^2 e^{3\alpha ^2}\Phi \left( -\frac{1}{\alpha }(\ln (1-\pi )+\frac{5}{2}\alpha ^2)\right) \right\} \right] \right\} \end{aligned}$$

To obtain \(\pi (0)\), we thus have to minimize the expression in square brackets as a continuous function of \(\pi \). Due to the facts that both \(\delta \) and \(\Phi (.)\) are between 0 and 1, this expression further lies between two convex quadratic functions in \(\pi \) and thus has a global minimum.

By making explicit use of the relations in Remark 5 and denoting the expression in square brackets above by \(g(\pi )\), we obtain

$$\begin{aligned} g'(\pi )&= 2 e^{\alpha ^2}\left( 1+(\delta ^2-1)\Phi \left( -\frac{1}{\alpha }(\ln (1-\pi )+\frac{3}{2}\alpha ^2)\right) \right) \\&\quad - 2(1-\pi )e^{3\alpha ^2}\left( 1+(\delta ^2-1)\Phi \left( -\frac{1}{\alpha }(\ln (1-\pi )+\frac{5}{2}\alpha ^2)\right) \right) \end{aligned}$$

If we note further that we have

$$\begin{aligned} g'(1) = 2 e^{\alpha ^2}\left( 1+(\delta ^2-1)\Phi \left( +\infty \right) \right) > 0 \end{aligned}$$

and also

$$\begin{aligned} g'(0)&= 2 e^{\alpha ^2}\left( 1+(\delta ^2-1)\Phi \left( -\frac{3}{2}\alpha )\right) \right) - 2 e^{3\alpha ^2} \left( 1+(\delta ^2-1) \Phi \left( -\frac{5}{2}\alpha )\right) \right) \\&= 2 e^{\alpha ^2}\left( (1-e^{2\alpha ^2}) + (\delta ^2-1)\left( \Phi \left( -\frac{3}{2}\alpha \right) \right) - e^{2\alpha ^2}\Phi \left( -\frac{5}{2}\alpha \right) \right) < 0 , \end{aligned}$$

we obtain the existence of a zero of the derivative. To see the last relation, note that we have

$$\begin{aligned} e^{2\alpha ^2}\Phi \left( -\frac{5}{2}\alpha \right)&= e^{2\alpha ^2}\int _{-\infty }^{-\frac{5}{2}\alpha }{\frac{1}{\sqrt{2\pi }}e^{-\frac{1}{2}x^2}dx} =e^{2\alpha ^2}\int _{-\infty }^{-\frac{3}{2}\alpha }{\frac{1}{\sqrt{2\pi }}e^{-\frac{1}{2}(x+\alpha )^2}dx} \\&< \int _{-\infty }^{-\frac{3}{2}\alpha }{\frac{1}{\sqrt{2\pi }}e^{-\frac{1}{2}x^2}dx} =\Phi \left( -\frac{3}{2}\alpha \right) \end{aligned}$$

due to the fact that we have \(\alpha x - \tfrac{1}{4}\alpha ^2 < - 2 \alpha ^2\) for \(x<-\tfrac{3}{2}\alpha \). On top of this, using again the relations in Remark 5 we get

$$\begin{aligned} g''(\pi ) = 2 e^{3\alpha ^2}\left( 1+(\delta ^2-1)\Phi \left( -\frac{1}{\alpha }(\ln (1-\pi )+\frac{5}{2}\alpha ^2)\right) \right) > 0, \end{aligned}$$

which also yields that the zero \(\pi ^*\) of the derivative is a unique minimum. This value can then be computed numerically and we have the initial condition for our ODE as

$$\begin{aligned} \pi (0) = \pi ^*. \end{aligned}$$
(44)

The full optimization problem and the corresponding ODE: The optimization problem in our new setting is in principle similar to the one of the simplistic setting. However, the replacement of \(\pi \) and \(\pi ^2\) by the expectations \(E({\bar{\pi }})\) and \(E({\bar{\pi }}^2)\) introduces a much more complicated non-linear dependence of the criterion function from \(\pi \). This has already materialized in the derivation of the initial condition for \(\pi (0)\) where we considered the special case of \(\lambda =0\) of the optimization problem. Using the notation of

$$\begin{aligned} \Phi _k:= \Phi _k(\pi ):=\Phi \left( -\frac{1}{\alpha }(\ln (1-\pi )+\frac{k}{2}\alpha ^2)\right) \end{aligned}$$
(45)

and given all our computations above, it is straight forward to write down the optimization problem as:

$$\begin{aligned}&\max _{\pi } \left\{ \lambda \left( 1-(1-\pi )e^{\alpha ^2} -(1-\delta )\Phi _1 + (1-\pi )e^{\alpha ^2}(1-\delta )\Phi _3\right) \right. \\&\quad - \left. \frac{1}{2}\gamma \sigma ^2 \left[ 1- 2(1-\pi )e^{\alpha ^2} +(1-\pi )^2 e^{3\alpha ^2} + (\delta ^2 -1)\left\{ \Phi _1 - 2(1-\pi )e^{\alpha ^2}\Phi _3 \right. \right. \right. \\&\qquad \left. \left. \left. +(1-\pi )^2 e^{3\alpha ^2}\Phi _5 \right\} \right] + \beta \left( M(\pi )\left( 2\Phi \left( \frac{\lambda }{\sigma }\right) -1\right) +\Phi \left( \frac{\lambda }{\sigma }\right) \right) \right\} \end{aligned}$$

Remark 6

  1. 1.

    Note that of course we could find a more compact representation of the criterion in terms of powers of \(\pi \). However, the current one will again prove to be useful in combination with the relations of Remark 5. We will use them to come up with an ODE for \(\pi (\lambda )\) that is derived from the first order condition of the optimization problem.

  2. 2.

    With a similar argument as in the above case of the optimization for \(\lambda =0\), there exists a global minimum of the criterion. For this, note that only additional terms, that at most increase linearly in \(\pi \), appear.

Proposition 5

(ODE in the general case) In the case of our particular model for uncertain electricity consumption and uncertain production, we obtain the following ODE for the optimal fraction \(\pi (\lambda )\)

$$\begin{aligned}&\pi '(\lambda )=\left( -\beta e^{-\alpha ^2}f(\lambda )(2\Phi (\lambda /\sigma )-1)\right) \cdot \\&\left[ \lambda (1-(1-\delta )\Phi _3) -\gamma \sigma ^2(1-(1-\pi )e^{2\alpha ^2}+(\delta ^2-1)(\Phi _3-(1-\pi )e^{2\alpha ^2}\Phi _5)\right] ^{-1} \end{aligned}$$

with initial condition given by Eq. (44).

Solving this ODE numerically is again possible, see Fig. 6. The resulting optimal fractions \(\pi (\lambda )\) admit the properties of the cases of single uncertainty in consumption resp. demand. We observe a positive position \(\pi (0)\), even the trader does not assign a positive risk premium to trading in the intraday market. We also observe that the optimal positions are more extreme in the risk premia for larger uncertainties in production and demand.

Fig. 6
figure 6

Optimal choices of \(\pi (\lambda )\) in the case of uncertain production and demand: Setting normal view on \(\lambda \) with \((\mu , \theta ^2)=(0, 0.0001)\), \(\beta =0.5, \ \sigma ^2=0.04, \ \gamma =1\)

Remark 7

(More random consumption) As already indicated above, we have used a restricted random consumption approach by fixing the constant \(\delta \in (0,1)\). The extension to a capped log-normal distribution for \(\delta \) is straight forward, but needs some tedious computations.

Remark 8

(Existence and uniqueness) Showing existence and uniqueness of the solution of the above ODE can in principle be shown as in the case of the basic ODE (4) (inspect the different steps of the corresponding proof in the appendix). However, we do not give it here as on one hand it needs a more involved notation and on the other hand, we have here only considered a simplified uncertain consumption model.

4.4 Aspects of applicability and some remarks on parameter calibration

Aspects of applicability Our approach can be seen as viewing either trading over a full day or as concentrating on one particular 15 min slot for electricity delivery. While the first choice might be a very rough approximation that completely ignores storage problems of electricity, the second approach amounts to model and solve 96 optimization problems for one day (see e.g. Aïd et al. 2016 for a continuous-time model that avoids solving 96 simple problems, but needs a more advanced mathematical framework and then has to be applied in a discretized version). This, however, can be easily implemented given our results presented above. Of course, we have to admit that the information that is needed about the distribution of the risk aversion of the remaining providers in the market can only be roughly estimated.

Some remarks on parameter calibration Although most of the parameters of our model are subject to the specific situation of the electricity provider or trader, we will give some practical hints on calibrating the parameters. We thereby also suggest methods used in asset portfolio optimization. As the parameters have different characters we treat them and the possibilities for calibration separately in different blocks.

Parameters inside the objective function The parameters \(\gamma \) (the risk aversion) and \(\beta \) (the parameter that yields the importance of the ranking compared to the other traders) are personal (subjective) parameters that have to be chosen by the trader. By construction, they cannot be estimated.

Parameters of the surplus return in the intraday market Let us first define the surplus return at time \(t_i\). Here, \(t_1,\ldots , t_{N}\) denote the delivery times at past days that coincide with the delivery time of our day of interest, e.g. tomorrow 8:00 pm. Let \(D(t_i), I(t_i)\) denote the respective past day-ahead and intraday prices (in Euro per MWh). Then we denote the surplus return \(\Lambda (t_i)\) by

$$\begin{aligned} \Lambda (t_i) = \ln \left( I(t_i)/D(t_i)\right) . \end{aligned}$$

As we assume that the surplus return \(\Lambda \) for our time of interest is normally distributed with mean \(\lambda \) and variance \(\sigma ^2\), we calculate the maximum likelihood estimates of the mean

$$\begin{aligned} {\bar{\Lambda }}_{N}=\frac{1}{N}\sum _{i=1}^{N}\Lambda (t_i) \end{aligned}$$

and the variance

$$\begin{aligned} {\hat{\sigma }}^2_{N}=\frac{1}{N-1}\sum _{i=1}^{N}\left( \Lambda (t_i) - {\bar{\Lambda }}_{N}\right) ^2 \end{aligned}$$

of the actually realized surplus returns \(\Lambda (t_i)\) which can also be negative. As the differences between the intraday and the day-ahead prices are usually small, the surplus return is typically around zero, see also https://energy-charts.info/ for price charts and for average weekly prices. The values of the weekly average surplus returns for the weeks 49, 50, 51 and 52 of 2023 are \(0.055, -0.038, 0.053, 0.25\). However, these are averages and should only serve as illustrations.

Concerning \(\lambda \), we have to take into account that this is the subjective parameter for each individual electricity provider and we again have to make a distributional assumption about it. In the above examples we have assumed

$$\begin{aligned} \lambda \sim N(\mu , \theta ^2) \end{aligned}$$

and thus need to estimate both these parameters. As the decisions of the different traders on the choice of \(\pi (\lambda )\) depend also on their choices/estimates of \(\beta \), \(\gamma \), \(\sigma ^2\), we take a view that is similar to the one in the CAPM-approach of financial mathematics (see e.g. Sharpe 1985): We assume that all traders have chosen the same values of \(\beta \), \(\gamma \), \(\sigma ^2\). Then, we look at the realized fractions of volumes \(1-\pi \) at the day ahead market of the active traders in the relevant past times. Given these values, we can now calibrate \(\mu , \theta ^2\) by minimizing the \(L^2\)-distance between the solution curve \(\pi (\lambda ;\mu ,\theta ^2)\) and the observed values of \(\pi \).

Of course, we are aware of the fact that this is computationally intensive and it requires a deep analysis of the order book to get these data. This is beyond the scope of our actual contribution.

If one ignores the competitors in our problem, then econometric prediction approaches for the surplus return as described and compared in e.g. Kiesel and Paraschiv (2017) or Maciejowska et al. (2019) are natural candidates.

The uncertainty parameters In the cases of production and demand uncertainty we need some additional parameters. For the case of production uncertainty, the provider needs a prediction model for the own production V that is unbiased and yields the expected production of v. For this, we assume that the provider has an algorithm that yields this value on the basis of the production that has been realized in past times under the same e.g. weather forecasts and technical conditions. This could be a simple algorithm that combines averaging over past values with an interpolation method (in case that e.g. the weather forecast has not exactly been observed in the past). The parameter \(\alpha >0\) can then be estimated from past differences between \(V_i\) and predictions \(v_i\), \(i=1,\ldots ,\ell \) using the relation

$$\begin{aligned} Var(V)= v^2 \left( e^{\alpha ^2}-1\right) \end{aligned}$$

by looking at the scaled differences \(V_i/v_i\). For the demand uncertainty a similar approach that is based on a prediction model for the demand can be developed.

5 Discussion and Outlook

We have set up a simple mean-field framework to decide on an optimal fraction of the electricity production that shall be sold in the intraday market. This decision depends on both

  • the view of the electricity provider towards risk and return of trading in the intraday market and

  • the distribution of the views of the competitors.

We have first considered and solved a simple model where only the price risk for the electricity in the intraday market is present. This then allowed us to trace back the solution in settings that include either production or demand uncertainty to the basic problem. What can be observed is that the presence of the competitors leads to strategies that encourage a more risky behaviour in either taking higher or lower positions in the intraday market compared to the situation when the competitors are ignored by the electricity provider.

Although our model uses only a very basic, one-period type mean-field games approach, this can even be seen as an advantage in the application due to the fact that the structure of electricity delivery is basically discrete in time (i.e. in units of 15 min). Further, the solution of the 96 individual problems (related to all the quarters of the day) can in principle be done in advance and should then not cause a lot of effort, only the views on the risk premia for trading in the intraday market possibly have to be updated.

While the simplicity of the model and the existence of (nearly) explicit solutions of the mean-field game make the approach an attractive one, one should also point on some problems and weaknesses of the above presented results:

  • Getting the parameters determining the model requires a mixture of basic statistics, choosing personal preference parameters and solving a calibration problem of the CAPM-type that needs heavy order book analysis.

  • Assuming log-normal distributions for the production and the demand uncertainty in Sects. 4.14.3 lead to tractable problems. However, it should be examined if these assumptions can at least be justified as an approximation.

Consequently, obvious topics for future research and extensions of our model are:

  • the inclusion of storage possibilities (in e.g. batteries) for electricity to transfer a local surplus production to the next trading time slot,

  • the possibility to influence the demand by a suitable offer price strategy when the provider considers a surplus production to be highly likely,

  • a detailed statistical analysis of order books to demonstrate the calibration of the parameters of the surplus return in the intraday market (see Sect. 4.4).

Especially for electricity producers using renewable resources, using such an approach can have a big potential