# Credit Valuation Adjustment with Replacement Closeout: Theory and Algorithms

Chaofan Sun  Ken Seng Tan  Wei Wei Sun: Department of Actuarial Mathematics
and Statistics, School of Mathematics and Computer Science, Heriot-Watt
University, Edinburgh, Scotland, EH14, 4AS, UK. E-mail<EMAIL_ADDRESS>Tan:
Division of Banking & Finance, Nanyang Business School, Nanyang Technological
University, Singapore. Email<EMAIL_ADDRESS>Wei: Department of
Actuarial Mathematics and Statistics, School of Mathematics and Computer
Science, Heriot-Watt University, Edinburgh, Scotland, EH14, 4AS, UK. E-mail:
<EMAIL_ADDRESS>
###### Abstract

The replacement closeout convention has drawn more and more attention since
the 2008 financial crisis. Compared with the conventional risk-free closeout,
the replacement closeout convention incorporates the creditworthiness of the
counterparty and thus providing a more accurate estimate of the Mark-to-market
value of a financial claim. In contrast to the risk-free closeout, the
replacement closeout renders a nonlinear valuation system, which constitutes
the major difficulty in the valuation of the counterparty credit risk.

In this paper, we show how to address the nonlinearity attributed to the
replacement closeout in the theoretical and computational analysis. In the
theoretical part, we prove the unique solvability of the nonlinear valuation
system and study the impact of the replacement closeout on the credit
valuation adjustment. In the computational part, we propose a neural network-
based algorithm for solving the (high dimensional) nonlinear valuation system
and effectively alleviating the curse of dimensionality. We numerically
compare the computational cost for the valuations with risk-free and
replacement closeouts. The numerical tests confirm both the accuracy and the
computational efficiency of our proposed algorithm for the valuation of the
replacement closeout.

Key words: credit risk, CVA, replacement closeout, nonlinear PDE, neural
network.

##  1 Introduction

The purpose of this paper is to provide theoretical and computational
underpinnings for the application of the replacement closeout convention in
the valuation of counterparty credit risk. Credit valuation adjustment (CVA),
commonly viewed as the value of counterparty credit risk, has become an
essential risk measure in the financial risk management since the 2008 global
financial crisis. A challenging task in the calculation of CVA is modelling
and calculating the Mark-to-market (MtM) closeout amount when a default event
is triggered. Before the 2008 financial crisis, almost all credit risk models
were based on the so called risk-free closeout convention in the sense that
the counterparty is assumed to be risk-free and thus the expectation of the
discounted future cash flows is used in recovery calculation111See for example
Jarrow and Yu (2001), Blanchet-Scalliet and Jeanblanc (2004) Bielecki et al.
(2008), Brigo and Chourdakis (2009a) and Brigo and Chourdakis (2009b) for the
valuation of defaultable financial claims under the risk-free closeout
convention. .

A painful lesson of the global financial crisis is that no counterparty should
be considered risk-free and banks must mark to market as much as
possible222See Chapter CAP50 of Basel III.. Due to the inadequate
consideration for the credit quality of the counterparty, the risk-free
closeout fails to adequately reflect the MtM value of a financial claim upon
the default time. In the post-crisis period, many studies have questioned the
validity of the risk-free closeout (e.g., Burgard and Kjaer 2011, Brigo and
Morini 2011 and Brigo et al. 2012.). In particular, the International Swaps
and Derivatives Association (ISDA) highlights the importance of incorporating
the creditworthiness of the counterparty in closeout, and thus suggesting an
alternative way of calculating the recovery.333Quoting from ISDA (2010): “Upon
default close-out, valuations will in many circumstances reflect the
replacement cost of transactions calculated at the terminating party’s bid or
offer side of the market, and will often take into account the
creditworthiness of the terminating party.”

To overcome the drawback of the risk-free closeout convention, more and more
attention has been devoted to the replacement closeout over the past
decade.444See for example Crépey et al. (2010), Hu et al. (2012), Henry-
Labordère (2012), Brigo et al. (2016) and Biagini et al. (2019). The idea of
working with the pre-default value in the recovery calculation is first
suggested in Duffie and Huang (1996) though they do not use the term
“replacement closeout”. As opposed to the risk-free closeout, the replacement
closeout is defined via the pre-default value of a financial claim. As the
counterparty credit risk is inherently embedded with the pre-default value,
the replacement closeout is more appropriate than the risk-free closeout since
it takes into consideration the counterparty’s creditworthiness so that the
MtM value of the contract is adequately captured and thus yields a more
accurate estimate of CVA. The appropriateness of replacement closeout,
however, is achieved at the expense of valuation complexity. This is
attributed by the fact that one cannot obtain the pre-default value without
knowing the future pre-default value and vice versa, thus the definition of
the pre-default value under the replacement closeout is actually a loop rather
than an explicit representation. Consequently, the replacement closeout
creates a nonlinear system, which poses the major difficulty in the valuation.

In this paper, we aim to contribute to the literature on replacement closeout
analysis, particularly in addressing the nonlinearity, from two aspects:
theoretically and computationally. In the theoretical analysis, we produce two
theoretical results. First, we prove that the nonlinear valuation system
arising from the replacement closeout admits a unique solution in broad
generality. Second, we show that the CVA calculated from the replacement
closeout is always larger than the corresponding value from the risk-free
closeout. This result suggests that without taking into consideration the
counterparty’s creditworthiness in recovery calculation would underestimate
the CVA. More severely, through an example of a defaultable European option,
we find that the underestimation could be significant, especially for
unhealthy counterparty’s creditworthiness. Together with the example, our
theoretical result unequivocally points out the importance of tracking the MtM
value of financial claims upon the default times and cautions against ignoring
the creditworthiness of the counterparty in the closeout. It is noteworthy
that the closeout function considered in our model is not only restricted to
CVA models, but also nests most of models of debit valuation adjustment (DVA)
and funding valuation adjustment (FVA). Therefore all the results
aforementioned also apply to the analysis of valuation adjustment (XVA)555For
the studies about DVA, FVA and XVA, see for example Pallavicini et al. (2011),
Albanese et al. (2015), Hull and White (2016) and Andersen et al. (2019)..

From a practitioner’s perspective, the applicability of the replacement
closeout largely hinges on its computational complexity. The nonlinearity of
the replacement closeout gives rise to significant computational burdensome.
Particularly, when the number of risk factors666The sources of risk factors
would be macroeconomic factors (e.g., interest rates), market indices (e.g.,
S&P 500 index), the credit ratings of the investors and their counterparties,
and the randomness of assets (e.g. multi-asset, or stochastic volatility
models), etc. increases, the computational complexity of the nonlinear
valuation system grows exponentially. As the number of risk factors usually
indicates the number of dimensions, the exponential growth on the
computational cost is also called the “curse of dimensionality” 777See, e.g.,
Bellman (1957).. Recently, the deep backward stochastic differential equation
(BSDE) method, advocated by E et al. (2017), Han et al. (2018) and Beck et al.
(2019), has demonstrated a promising performance in overcoming the curse of
dimensionality for high dimensional dynamic models. In the Deep BSDE method,
the dynamic model (usually a partial differential equation (PDE) problem) is
reformulated into a BSDE problem. Then, applying a standard simulation and
discretization to the BSDE problem, one can obtain an optimization problem
associated with the terminal value. Finally, neural networks are employed to
approximate the unknown gradients of the optimization problem.

The Deep BSDE method has been applied to risk management888Besides the Deep
BSDE method, there are also several other attempts to approximate the high
dimensional dynamic models in various areas (e.g., Carleo and Troyer, 2017;
Sirignano and Spiliopoulos, 2018; Weinan and Yu, 2018; Weinan et al., 2019).
Readers interested in this direction would be referred to the literature
surveys by Ruf and Wang (2020) and Beck et al. (2020).. Building on E et al.
(2017), Henry-Labordere (2017) develops a primal-dual method for the valuation
of counterparty credit risk. Combining the dynamic programming, Huré et al.
(2019) develop a new Deep BSDE solver which targets at approximating the value
function. Based on the Deep BSDE method, Gnoatto et al. (2020) design an XVA
solver and deduce a posteriori bounds on the error of the neural network
approximations. Albanese et al. (2021), with a BSDE formulation and GPU
computing, propose a deep learning regression method for the credit risk
valuation. In the existing Deep BSDE solvers for credit risk valuation, the
decision variables, usually the value functions and (or) their gradients, are
viewed as a sequence of functions of state variables, and each function at a
time node is attached to a fully connected (FC) neural network. For ease of
reference, we refer to such a Deep BSDE solver as a multi-FC Deep BSDE solver.
Raissi et al. (2017), Raissi (2018a) and Raissi (2018b), on the other hand,
develop a single network-based Deep BSDE method. Because of the dramatic
decrease of the number of neural networks, Raissi et al.’s method allows more
delicate neural network architectures to be applied in the Deep BSDE solver.
From the reported numerical experiments in Chan-Wai-Nam et al. (2019), one can
see that the multi-FC Deep BSDE solver could be significantly improved by the
single network-based method with a proper neural network.

Motivated by Raissi (2018b), the computational contribution of this paper is
to develop a Deep BSDE algorithm for the calculation of CVA with replacement
closeout. In contrast to the existing literature on the valuation of credit
risk via the Deep BSDE method, our algorithm is single network-based.
Moreover, instead of the fully connected neural network used in E et al.
(2017), we approximate the gradient function by the long-short term memory
(LSTM) neural network, which is originally proposed by Hochreiter and
Schmidhuber (1997) and has been shown to have impressive power in solving
real-world problems with sequential data999For example, the LSTM neural
network has been successfully used in time series prediction (Schmidhuber et
al., 2005), speech recognition (Graves et al., 2013) and rhythm learning (Gers
et al., 2002). . The numerical tests suggest that our proposed solver produces
satisfactory efficiency and yields better convergence stability than the
multi-FC Deep BSDE solver. Finally, we compare the computational cost for
calculating CVA under both risk-free and replacement closeout. We test our
algorithm on the valuations of a defaulable claim with risk-free and
replacement closeout respectively. Because of the computational efficiency of
the single network-based algorithm in calculating the replacement closeout, it
only requires about half of the computational time compared to that with the
risk-free closeout. This therefore effectively alleviates the curse of
dimensionality and enhances the practical application of the replacement
closeout.

The remainder of the paper is organized as follows. In Section 2, we formulate
the valuation of a generic defaultable financial claim with replacement
closeout. In Section 3, we prove that the valuation equation admits a unique
solution. The proof is based on an iteration, which asserts that the
conventional risk-free closeout would underestimate CVA. In Section 4, we
describe the single network-based algorithm. Numerical examples and
discussions are provided in Section 5. Section 6 concludes the paper and
lemmas for the proof of main results are relegated to the appendix.

##  2 General Setup

###  2.1 The dynamics

We start with a filtered probability space
$(\Omega,\mathcal{F},\\{\mathcal{F}_{t}\\}_{t\geq 0},\mathbb{P})$ which
satisfies the usual conditions. Let $W=(W_{1},W_{2},\ldots,W_{n})^{T}$ define
an $n$-dimensional Brownian motion adapted to the filtration
$\\{\mathcal{F}_{t}\\}_{t\geq 0}.$ Filtration $\\{\mathcal{F}_{t}\\}_{t\geq
0}$ captures all accessible information generated by a family of Markov
process $X=X^{x}$ parameterized by the initial state
$X_{0}=x\in\mathbb{R}^{m}$ and governed by the following stochastic
differential equation (SDE),

$dX_{t}=\mu(t,X_{t})dt+\sigma(t,X_{t})dW_{t}$ (1)

where $\mu(t,x)=(\mu_{1}(t,x),\mu_{2}(t,x),\ldots,\mu_{m}(t,x))^{T}$,
$\sigma(t,x)=(\sigma_{ij}(t,x))_{i=1,2,\ldots,m,j=1,2,\ldots,n}$ are functions
defined on $(\mathbb{R}_{+},\mathbb{R}^{m})$ and valued in $\mathbb{R}^{m}$
and $\mathbb{R}^{m\times n}$ respectively.

Suppose that $\mu$ and $\sigma$ are Lipschitz continuous functions, i.e.,
there exists an $L>0$ such that for $x\neq y,t\neq s$,

$\displaystyle|g(t,x)-g(s,y)|\leq L(|t-s|+|x-y|),$ (2)

where
$g\in\\{\mu,\sigma\\},|A|:=\sqrt{\sum_{j=1}^{m}\sum_{i=1}^{n}A_{ij}^{2}},\forall
A\in\mathbb{R}^{n\times m},n,m\in\mathbb{N}_{+}.$

Condition (2) guarantees the existence and uniqueness of the strong solution
to SDE (1). Moreover, it follows from standard arguments in SDE (e.g. Pham,
2009, chapter 1) that, for any $T>0,p>1$, there exists a constant $L$, such
that

$\displaystyle\mathbb{E}\left[\sup_{t\in[0,T]}|X_{t}|^{p}\right]\leq
L(|x|^{p}+1),$ (3)

where $L$ depends on $T$ and $p.$

Define the infinitesimal Markov generator associated with $X$ by

$\displaystyle\mathcal{L}:=\frac{\partial}{\partial
t}+\sum_{i=1}^{m}\sum_{j=1}^{m}a_{ij}(t,x)\frac{\partial^{2}}{\partial
x_{i}\partial x_{j}}+\sum_{i=1}^{m}b_{i}(t,x)\frac{\partial}{\partial x_{i}},$

where $a_{ij}(t,x)=\frac{1}{2}\sum_{k=1}^{n}\sigma_{ik}(t,x)\sigma_{jk}(t,x)$.
Suppose that $\mathcal{L}$ is uniformly parabolic for any $T>0$, i.e., there
exists a positive constant $\lambda_{1}>0$, such that for any
$\xi=(\xi_{1},\xi_{2},\ldots,\xi_{m})^{T}\in\mathbb{R}^{m},$

$\displaystyle\sum_{i=1}^{m}\sum_{j=1}^{m}a_{ij}(t,x)\xi_{i}\xi_{j}\geq\lambda_{1}|\xi|^{2},\forall(t,x)\in[0,T]\times\mathbb{R}.$
(4)

###  2.2 Default times and hazard rates

Let $\tau$ be a non-negative random variable on
$(\Omega,\mathcal{F},\mathbb{P})$ that captures the default time. Define the
associated default indicator process by $H_{t}=1_{\tau\leq t}$. Let
$\\{\mathcal{H}_{t}\\}_{t\geq 0}$ denote the filtration generated by
$\\{H_{t}\\}_{t\geq 0}$. Suppose that all information in the market at time
$t$, defined by $\sigma$-algebra $\mathcal{G}_{t},$ comprises the accessible
information represented by $\mathcal{F}_{t}$ and the information generated by
the observation of the occurrence of the default up to $t$, i.e.,
$\mathcal{G}_{t}=\mathcal{F}_{t}\vee\mathcal{H}_{t}$.

Denote $G_{t}=\mathbb{P}(\tau>t|\mathcal{F}_{t})$, so that $G_{t}$ represents
the survival process of the default time $\tau$ with respect the reference
filtration $\\{\mathcal{F}_{t}\\}_{t\geq 0}$. Define the hazard rate
associated with $G_{t}$ by $\lambda_{t}$, e.g.,
$G_{t}=\exp\\{-\int^{t}_{0}\lambda_{s}ds\\}$, where $\\{\lambda_{t}\\}_{t\geq
0}$ is a non-negative progressively measurable process with respect to
$\\{\mathcal{F}_{t}\\}_{t\geq 0}$, with integrable sample paths. In order to
keep the Markov property of the model, throughout the paper we suppose that
$\lambda_{t}=\lambda(t,X_{t})$, where $\lambda$ is a Borel function from
$\mathbb{R}_{+}\times\mathbb{R}^{m}$ to $\mathbb{R}_{+}.$

###  2.3 Cash flows, pre-default values and CVA

Consider a defaultable claim maturing at $T$. The holder of the claim receives
a payment flow with rate $c_{t}$ until the default time $\tau$ or the maturity
date $T$, whichever comes earlier. At the maturity date $T$, the holder
receives the terminal payoff $\phi_{T}$ if the default event has not occurred
yet. If there is a default before time $T$, then the holder receives a lump-
sum payoff $Z_{\tau}$, referred to as the closeout amount, at the default time
$\tau$. Denote the risk-free rate by $r_{t}$. Suppose that
$c_{t},\phi_{T},Z_{\tau},r_{t}$ are given by $c(t,X_{t}),\phi(X_{T})$
$Z(\tau,X_{\tau}),r(t,X_{t})$ respectively, where
$c:\mathbb{R}_{+}\times\mathbb{R}^{m}\rightarrow\mathbb{R},\phi:\mathbb{R}^{m}\rightarrow\mathbb{R},Z:\mathbb{R}_{+}\times\mathbb{R}^{m}\rightarrow\mathbb{R},r:\mathbb{R}_{+}\times\mathbb{R}^{m}\rightarrow\mathbb{R}_{+}$
are Borel functions.

The discounted payoff process of the defaultable claim is given by

$\displaystyle P_{t}=\int^{\tau\wedge
T}_{t}e^{-\int^{s}_{t}r(u,X_{u})du}c(s,X_{s})ds+1_{t<\tau\leq
T}Z(\tau,X_{\tau})e^{-\int^{\tau}_{t}r(s,X_{s})ds}+\phi(X_{T})e^{-\int^{T}_{t}r(s,X_{s})ds}1_{\tau>T}.$

Define the value process of the defaultable claim by
$\mathbb{E}[P_{t}|\mathcal{G}_{t}]$, then it follows from the standard
arguments in the literature on credit risk (e.g. Bielecki and Rutkowski, 2013,
chapter 8) that
$\mathbb{E}[P_{t}|\mathcal{G}_{t}]=1_{\tau>t}\bar{V}(t,X_{t})$, where
$\bar{V}$ is referred to as pre-default value function and is given by

$\bar{V}(t,x)=$

$\displaystyle\mathbb{E}\left[\int^{T}_{t}(c(s,X_{s})+\lambda(s,X_{s})Z(s,X_{s}))e^{-\int^{s}_{t}r(u,X_{u})+\lambda(u,X_{u})du}ds+e^{-\int^{T}_{t}r(s,X_{s})+\lambda(s,X_{s})ds}\phi(X_{T})|X_{t}=x\right]$
(5)

We suppose that $c,\lambda,Z,\phi,r$ have polynomial growth in $x$, uniformly
in $t$, i.e., there exist $L>0,n>0,$ such that

$\displaystyle|g(t,x)|\leq
L(|x|^{n}+1),\forall(t,x)\in[0,T]\times\mathbb{R}^{m},$ (6)

where $g\in\\{c,\lambda,Z,\phi,r\\}$ and $L,n$ depend on $T.$

The following proposition demonstrates that $\bar{V}$ has polynomial growth in
$x$, uniformly in $t$.

###### Proposition 1

There exist $L>0,p>0$, such that

$|\bar{V}(t,x)|\leq L(|x|^{p}+1),\forall(t,x)\in[0,T]\times\mathbb{R}^{m}.$

Proof. The proof is just an immediate consequence of some algebra and we
provide the proof for completeness. It is easy to see that

$\displaystyle|\bar{V}(t,x)|\leq\mathbb{E}\left[\int^{T}_{t}(|c(s,X_{s})|+\lambda(s,X_{s})|Z(s,X_{s})|)ds+\phi(X_{T})|X_{t}=x\right].$

Then it follows from (6) that there exist $L_{0}>0,p_{0}>0,$ such that

$\displaystyle|\bar{V}(t,x)|$
$\displaystyle\leq\mathbb{E}\left[\int^{T}_{t}L_{0}(|X_{s}|^{p_{0}}+1)ds+L_{0}(|X_{T}|^{p_{0}}+1)\right]$
$\displaystyle\leq\mathbb{E}\left[TL_{0}\left(\sup_{0\leq s\leq
T}|X_{s}|^{p_{0}}+1\right)+L_{0}(|X_{T}|^{p_{0}}+1)|X_{t}=x\right].$

The result is an immediate consequence of (3).

Moreover, to guarantee the $C^{1,2}$ regularity of $\bar{V}$, we suppose that
$c,\lambda,Z,\phi,r$ are continuous functions of $(t,x)$ and that
$c,\lambda,Z,r$ are locally Hölder continuous in $x$, uniformly in $t$, i.e.,
for any compact set $E\subset[0,T]\times\mathbb{R}^{m}$, there exist
$L>0,\alpha\in(0,1)$ such that

$\displaystyle|g(t,x)-g(t,y)|\leq L|x-y|^{\alpha},\forall t,x,y\in E,$

where $g\in\\{c,\lambda,Z,r\\}$ and $L,\alpha$ depend on $E.$

By denoting $U(t,x)$ as the risk-free value of the defaultable claim, then it
can be obtained from (5) via setting $\tau=\infty,$ or equivalently
$\lambda(t,x)=0$; i.e.,

$\displaystyle
U(t,x)=\mathbb{E}\left[\int^{T}_{t}c(s,X_{s})e^{-\int^{s}_{t}r(u,X_{u})du}ds+e^{-\int^{T}_{t}r(s,X_{s})ds}\phi(X_{T})|X_{t}=x\right].$
(7)

Recall that CVA measures the value of credit risk. We define the CVA for a
defaultable claim by the difference between the risk-free value and the pre-
default value of the financial claim as

$\displaystyle CVA:=U(t,x)-\bar{V}(t,x).$ (8)

##  3 Valuation

###  3.1 Closeout functions

We denote the closeout payoff by a continuous function
$f(t,x,y):\mathbb{R}_{+}\times\mathbb{R}^{m}\times\mathbb{R}\rightarrow\mathbb{R}$,
where $t,x,y$ represent time, state value and the value of the claim
respectively. We further assume that $f$ is locally Hölder continuous in $x$,
uniformly in $t,y$. To rule out the moral hazard in the financial claim, we
suppose that the closeout payoff is no more than the value of the claim, i.e.,
$f(t,x,y)\leq
y,\forall(t,x,y)\in\mathbb{R}_{+}\times\mathbb{R}^{m}\times\mathbb{R}$ and
that the closeout function $f$ and the loss function $y-f(t,x,y)$ are
increasing in $y$, i.e.,

$\displaystyle 0\leq f(t,x,y_{2})-f(t,x,y_{1})\leq y_{2}-y_{1},\forall
y_{1}<y_{2},y_{1},y_{2}\in\mathbb{R},(t,x)\in\mathbb{R}_{+}\times\mathbb{R}^{m}.$
(9)

Condition (9), which is referred to as incentive compatibility in the
literature on (re)insurance,101010See, for example, Huberman et al. (1983) and
Picard (2000). Moreover, see Chi and Tan (2011), Xu et al. (2019) and Tan et
al. (2020), for the impact of condition (9) on the optimal (re)insurance
contract design in static and dynamic models. links to the general revelation
principle in economics111111See, for example, Myerson (1979) and Dasgupta et
al. (1979). . This condition applies to most of closeout functions in credit
modelling. In particular, it is easy to verify that all the closeout functions
used in the calculations of CVA, DVA, FVA and XVA fall into this general
category.

###  3.2 Linear valuation with risk-free closeout

As a benchmark, we briefly consider the case in which the risk-free value of
the defaultable claim is used in the closeout function. We define the value of
the defaultable claim with the risk-free closeout by $V_{0}$. The closeout
function is then given by $f(t,x,U(t,x))$, where $U$ is the risk-free value of
the claim given by (7). Furthermore, $V_{0}$ can be obtained from (5) after
the substitution $Z(t,x)=f(t,x,U(t,x))$; i.e.,

$\displaystyle V_{0}(t,x)$
$\displaystyle=\mathbb{E}\left[\int^{T}_{t}(c(s,X_{s})+\lambda(s,X_{s})f(s,X_{s},U(s,X_{s})))e^{-\int^{s}_{t}r(u,X_{u})+\lambda(u,X_{u})du}ds\right.$
$\displaystyle\left.\hskip
28.90755pt+e^{-\int^{T}_{t}r(s,X_{s})+\lambda(s,X_{s})ds}\phi(X_{T})|X_{t}=x\right].$
(10)

By denoting $\Pi_{0}(t,x)$ as the CVA calculated from the risk-free closeout,
it follows from the definition of CVA (8) that

$\displaystyle\Pi_{0}(t,x)=U(t,x)-V_{0}(t,x).$

The following proposition demonstrates that the value of counterparty credit
risk is positive.

###### Proposition 2

$\Pi_{0}(t,x)\geq 0,\forall(t,x)\in[0,T]\times\mathbb{R}^{m}$.

Proof. As $c,\phi,r$ are locally Hölder continuous,
$\\{a_{ij}\\}_{i,j\in\\{1,2,\ldots,m\\}},b$ are Lipschitz continuous,
$\mathcal{L}$ is uniformly parabolic and $U$ has polynomial growth (See
Proposition 1.), then it follows from standard arguments in PDE121212See,
e.g., Aronson and Besala (1967). and the Feynman-Kac formula that $U\in
C^{1,2}([0,T)\times\mathbb{R}^{m})\cap C([0,T]\times\mathbb{R}^{m})$ and
solves the following Cauchy problem

$\displaystyle\mathcal{L}U(t,x)-r(t,x)U(t,x)+c(t,x)$
$\displaystyle=0,\quad(t,x)\in[0,T)\times\mathbb{R},$ $\displaystyle U(T,x)$
$\displaystyle=\phi(x),\quad x\in\mathbb{R}^{m}.$

Moreover, (9) implies that $f(t,x,y)$ has linear growth in $y$, uniformly in
$(t,x)$ and thus together with the polynomial growth of $U$ in $x$, showing
that $V_{0}$ has polynomial growth in $x$, $V_{0}\in
C^{1,2}([0,T)\times\mathbb{R}^{m})\cap C([0,T]\times\mathbb{R}^{m})$ and
satisfies

$\displaystyle\mathcal{L}V_{0}(t,x)-(r(t,x)+\lambda(t,x))V_{0}(t,x)+c(t,x)+\lambda(t,x)f(t,x,U(t,x))$
$\displaystyle=0,\quad(t,x)\in[0,T)\times\mathbb{R}^{m},$ $\displaystyle
V_{0}(T,x)$ $\displaystyle=\phi(x),\quad x\in\mathbb{R}^{m}$

As $\Pi_{0}=U(t,x)-V_{0}(t,x)$, the difference of the above two PDEs yields

$\displaystyle\mathcal{L}\Pi_{0}(t,x)-r(t,x)\Pi_{0}(t,x)+\lambda(t,x)(V_{0}(t,x)-f(t,x,U(t,x)))=0.$

As $f(t,x,U(t,x))\leq U(t,x)$, we have that

$\displaystyle\mathcal{L}\Pi_{0}(t,x)-r(t,x)\Pi_{0}(t,x)+\lambda(t,x)(V_{0}(t,x)-U(t,x))\leq
0,$

which reduces to

$\displaystyle\mathcal{L}\Pi_{0}(t,x)-(r(t,x)+\lambda(t,x))\Pi_{0}(t,x)\leq
0.$

It is easy to see that $\Pi_{0}$ has polynomial growth and $\Pi_{0}(T,x)=0$,
then it follows from the maximum principle131313See, Friedman, 2008, chapter
2. that $\Pi_{0}\geq 0$.

This completes the proof.

###  3.3 Nonlinear valuation with replacement closeout

Under the replacement closeout convention, the closeout function $f$ depends
on the pre-default value of the defaultable claim. Thus, the representation
(5) of the pre-default value is no longer an explicit formula, rather it is a
nonlinear equation of the pre-default value function.

Let $V$ be the pre-default value obtained under the replacement closeout
convention. Then $V$ can be obtained from (5) after substituting $Z$ by
$f(t,x,V(t,x))$; i.e.,

$\displaystyle V(t,x)$
$\displaystyle=\mathbb{E}\left[\int^{T}_{t}(c(s,X_{s})+\lambda(s,X_{s})f(s,X_{s},V(t,X_{s})))e^{-\int^{s}_{t}r(u,X_{u})+\lambda(u,X_{u})du}ds\right.$
$\displaystyle\hskip
28.90755pt\left.+e^{-\int^{T}_{t}r(s,X_{s})+\lambda(s,X_{s})ds}\phi(X_{T})|X_{t}=x\right]$
(11)

To construct the solution to the valuation equation (3.3), we define

$\displaystyle V^{k}(t,x)$
$\displaystyle=\mathbb{E}\left[\int^{T}_{t}(c(s,X_{s})+\lambda(s,X_{s})f(s,X_{s},V^{k-1}(s,X_{s})))e^{-\int^{s}_{t}r(u,X_{u})+\lambda(u,X_{u})du}ds\right.$
$\displaystyle\hskip
28.90755pt\left.+e^{-\int^{T}_{t}r(s,X_{s})+\lambda(s,X_{s})ds}\phi(X_{T})|X_{t}=x\right],$
(12)

where $V^{0}(t,x)=U(t,x).$

Similar to the proof of Proposition 2, it is easy to see that $V^{k},k\geq 0,$
is well-defined and has polynomial growth in $x,$ uniformly in $t.$ The
following proposition asserts that $\\{V^{k}\\}_{k\geq 0}$ is a monotonically
decreasing sequence of functions.

###### Proposition 3

$V^{k}(t,x)\leq V^{k-1}(t,x),\forall k\geq
1,(t,x)\in[0,T]\times\mathbb{R}^{m}$.

Proof. It is easy to see that $V^{1}(t,x)=V_{0}(t,x),$ then it follows from
Proposition 2 that $V^{1}(t,x)\leq V^{0}(t,x)$. Suppose that $V^{m+1}(t,x)\leq
V^{m}(t,x).$ Consider $w(t,x):=V^{m+2}(t,x)-V^{m+1}(t,x)$, then we have that

$\displaystyle
w(t,x)=\mathbb{E}\left[\int^{T}_{t}\lambda(s,X_{s})(f(s,X_{s},V^{m+1}(s,X_{s}))-f(s,X_{s},V^{m}(s,X_{s})))e^{-\int^{s}_{t}r(u,X_{u})+\lambda(u,X_{u})du}ds|X_{t}=x\right].$

Then $w(t,x)\leq 0$ follows from the monotonicity of $f(t,x,y)$ in $y,$ which
therefore shows that $V^{k}(t,x)$ is decreasing with respect to $k$ by
mathematical induction.

The following theorem demonstrates the solvability of the valuation equation
(3.3).

###### Theorem 1

With the notations above, there exists a unique $V\in
C^{1,2}([0,T)\times\mathbb{R}^{m})\cap C([0,T]\times\mathbb{R}^{m})$ with
polynomial growth, such that the valuation equation (3.3) holds. Moreover,
$V(t,x)=\lim_{k\to\infty}V^{k}(t,x),\forall(t,x)\in[0,T]\times\mathbb{R}^{m}.$

Proof. It follows from Lemma 2 (see Appendix) and Proposition 3 that there
exist constants $C>0,n>1$, independent of $k$, such that

$\displaystyle|V^{k}(t,x)|\leq
C(|x|^{n}+1),\forall(t,x,k)\in\mathbb{R}_{+}\times\mathbb{R}^{m}\times\mathbb{N}.$
(13)

Let
$V(t,x):=\lim_{k\to\infty}V^{k}(t,x),\forall(t,x)\in[0,T]\times\mathbb{R}^{m}.$
Then the dominated convergence theorem and the regularity of $f$ yield that
$V$ solves the valuation equation (3.3) and has polynomial growth.

Moreover, as $c,\phi,r$ are locally Hölder continuous,
$\\{a_{ij}\\}_{i,j\in\\{1,2,\ldots,m\\}},b$ are Lipschitz continuous and
$\mathcal{L}$ is uniformly parabolic, then it follows from standard arguments
in PDE (e.g. Aronson and Besala, 1967) and the Feynman-Kac formula that
$V^{k}\in C^{1,2}([0,T)\times\mathbb{R}^{m})\cap C([0,T]\times\mathbb{R}^{m})$
and solves the following Cauchy problem

$\displaystyle\mathcal{L}V^{k}(t,x)-(r(t,x)+\lambda(t,x))V^{k}(t,x)+\lambda(t,x)f(t,x,V^{k-1}(t,x))+c(t,x)$
$\displaystyle=0,\quad(t,x)\in[0,T)\times\mathbb{R}^{m},$ $\displaystyle
V^{k}(T,x)$ $\displaystyle=\phi(x),\quad x\in\mathbb{R}^{m}.$

Let $E:=(0,T)\times(-M,M)^{m},M>0$. According to the interior
$L^{p}$-estimates (e.g. Lieberman, 1996, chapter 7) and the estimate (13), we
have that, for any $p>1$, there exists a constant $K$, independent of $k$,
such that

$\displaystyle||D^{2}V^{k}||_{p,E}+\left|\left|\frac{\partial V^{k}}{\partial
t}\right|\right|_{p,E}\leq K.$

Then it follows from the embedding theorem (e.g. Gilbarg and Trudinger, 2015,
chapter 7) and the Arzela-Ascoli theorem that $V\in
C^{0,1}([0,T)\times\mathbb{R})^{m}$.

Consider the following standard linear PDE problem,

$\displaystyle\mathcal{L}H(t,x)-(r(t,x)+\lambda(t,x))H(t,x)+\lambda(t,x)f(t,x,V(t,x))+c(t,x)$
$\displaystyle=0,\quad(t,x)\in[0,T)\times\mathbb{R}^{m},$ $\displaystyle
H(T,x)$ $\displaystyle=\phi(x),\quad x\in\mathbb{R}^{m}.$

By the regularity of the coefficients of $\mathcal{L},$ $\lambda,r,c,f,V$, it
is easy to see that the above PDE problem admits a unique classical solution
$H$ with polynomial growth. Then the Feynman-Kac formula yields that

$\displaystyle H(t,x)$
$\displaystyle=\mathbb{E}\left[\int^{T}_{t}(c(s,X_{s})+\lambda(s,X_{s})f(s,X_{s},V(t,X_{s})))e^{-\int^{s}_{t}r(u,X_{u})+\lambda(u,X_{u})du}ds\right.$
$\displaystyle\hskip
28.90755pt\left.+e^{-\int^{T}_{t}r(s,X_{s})+\lambda(s,X_{s})ds}\phi(X_{T})|X_{t}=x\right].$

In other words, we have $H(t,x)=V(t,x)$ which suggests that $V$ is in
$C^{1,2}([0,T)\times\mathbb{R}^{m})\cap C([0,T]\times\mathbb{R}^{m})$ and has
polynomial growth.

Finally, we consider the uniqueness of the solution to the valuation equation
(3.3). First, using the Feynman-Kac formula on (3.3), we have that $V$ solves
the following PDE problem

$\displaystyle\mathcal{L}V(t,x)-(r(t,x)+\lambda(t,x))V(t,x)+\lambda(t,x)f(t,x,V(t,x))+c(t,x)$
$\displaystyle=0,\quad(t,x)\in[0,T)\times\mathbb{R}^{m},$ (14) $\displaystyle
V(T,x)$ $\displaystyle=\phi(x),\quad x\in\mathbb{R}^{m}.$ (15)

Second, suppose that $\tilde{V}\in C^{1,2}([0,T)\times\mathbb{R}^{m})\cap
C([0,T]\times\mathbb{R}^{m})$ solves (3.3) and has polynomial growth. Let
$h:=V-\tilde{V},$ then it follows from (14) and (15) that

$\displaystyle\mathcal{L}h(t,x)-(r(t,x)+\lambda(t,x)-e(t,x))h(t,x)$
$\displaystyle=0,\quad(t,x)\in[0,T)\times\mathbb{R}^{m},$ $\displaystyle
h(T,x)$ $\displaystyle=0,\quad x\in\mathbb{R}^{m},$

where
$e(t,x):=\lambda(t,x)\frac{f(t,x,V(t,x))-f(t,x,\tilde{V}(t,x))}{V(t,x)-\tilde{V}(t,x)}1_{V(t,x)-\tilde{V}(t,x)\neq
0}.$

It follows from condition (9) that $0\leq e(t,x)\leq\lambda(t,x)$. Therefore,
the uniqueness of the solution to the valuation equation (3.3) is a result of
the maximum principle (eee, e.g., Friedman, 2008, chapter 2).

This completes the proof.

In related literature, Kim and Leung (2016), Bichuch et al. (2018) and Brigo
et al. (2019) have focused on the unique solvability of the nonlinear
valuation system. These literature usually assumes the boundedness of the
hazard rates to guarantee the applicability of the contraction mapping, and
thus excluding almost all commonly used stochastic intensity-based models. In
contrast, our methodology does not require the boundedness assumption, and
hence allowing the analysis of valuation models with stochastic hazard rates.

###  3.4 Risk-free versus replacement closeout: a consequence for valuation

Analogously, we define the CVA calculated using the replacement closeout by
$\Pi(t,x),$ i.e.,

$\displaystyle\Pi(t,x)=U(t,x)-V(t,x).$

The following theorem verifies that the CVA based on risk-free closeout
convention underestimates the corresponding value based on the replacement
closeout.

###### Theorem 2

$\Pi_{0}(t,x)\leq\Pi(t,x),\forall(t,x)\in[0,T]\times\mathbb{R}^{m}$.

Proof. The result is an immediate consequence of Proposition 3 and Theorem 1.

Theorem 2 points out that neglecting the counterparty’s creditworthiness in
the recovery calculation is one of the critical sources of the underestimation
of CVA. To provide additional insight on the severity of the underestimation,
we proceed by valuing a defaultable European put option. In this example, we
assume that the dynamics of the underlying asset is given by a one-dimensional
geometric Brownian motion with $\mu(t,x)=rx,$ and $\sigma(t,x)=\sigma x$ in
(1), where $r,\sigma$ are positive constants. We also set
$\phi(x)=(K-x)^{+},c(t,x)=0$ in (7), (3.2), and (3.3), where $K$ is a positive
constant. Suppose further that $f(t,x,y)=Ry^{+}-y^{-}$ and $\lambda$ is a
constant in (3.2), and (3.3), with $R$ being a positive constant ranging over
$[0,1)$. Finally, we set the CVA calculated with the replacement closeout as
an exact value and define the relative error attributed to the use of risk-
free closeout by $e(t,x)$, i.e.,
$e(t,x)=\frac{\Pi(t,x)-\Pi_{0}(t,x)}{\Pi(t,x)}.$

Figure 3.4, which plots the relative error against the counterparty’s hazard
rate, illustrates that the underestimation is intensified with the worsening
of the credit quality of the counterparty since higher hazard rate implies
lower credit quality. For example, when the counterparty’s creditworthiness is
as low as that corresponds to 0.3 hazard rate, the degree of underestimation
is as high as almost 40%. By and large, Theorem 2 and the numerical result
depicted by Figure 3.4 caution against the risk-free approximation in the
recovery calculation and thus highlighting the importance of keeping track of
the MtM value in the CVA calculation.

Fig. 3.4. The magnitude of the underestimate of CVA. Notes. The figure plots
the variation of relative error resulting from the neglect of the
counterparty’s creditworthiness with respect to the degree of hazard rate
$\lambda$. The graph uses the parameters
$r=0.05,R=0.5,\sigma=0.2,K=X_{0}=1,T=10.$

###  3.5 An extension: the bilateral case

Our analysis so far has focused on the unilateral CVA for which only the
counterparty’s default is considered, we extend the theoretical results to the
bilateral case in this subsection141414See, for example, Gregory (2009) and
Brigo et al. (2014), for the valuation of bilateral counterparty credit risk
under the risk-free closeout convention..

In the bilateral case, in addition to the risk due to the potential default of
the counterparty, the possibility of the investor’s default is also
considered. Let $\tau^{\prime}$ be a non-negative random variable on
$(\Omega,\mathcal{F},\mathbb{P})$ that represent the default time of the
investor. Define the associated default process by $H^{\prime}_{t},$ i.e.,
$H^{\prime}_{t}=1_{\tau^{\prime}\leq t}$. At time $t$, the conditional
survival probability of the investor with respect to the accessible
information $\mathcal{F}_{t}$ is given by
$\mathbb{P}(\tau^{\prime}>t|\mathcal{F}_{t}):=e^{-\int^{t}_{0}\bar{\lambda}(s,X_{s})ds}$,
where
$\bar{\lambda}:\mathbb{R}_{+}\times\mathbb{R}^{m}\rightarrow\mathbb{R}_{+},$
satisfies the same growth and regularity conditions as $\lambda.$ Following
the standard literature on the hazard rate models (e.g., Bielecki and
Rutkowski, 2013, chapter 9), we suppose that $\tau$ and $\tau^{\prime}$ are
conditionally independent with respect to $\\{\mathcal{F}_{t}\\}_{t\geq 0}$,
i.e.,
$\mathbb{P}(\tau>t,\tau^{\prime}>t|\mathcal{F}_{t})=\mathbb{P}(\tau>t|\mathcal{F}_{t})\mathbb{P}(\tau^{\prime}>t|\mathcal{F}_{t})=e^{-\int^{t}_{0}\lambda(t,X_{s})+\bar{\lambda}(s,X_{s})ds}.$

Denote the closeout function for the investor by
$\bar{f}(t,x,y):\mathbb{R}_{+}\times\mathbb{R}^{m}\times\mathbb{R}\rightarrow\mathbb{R}$,
where $\bar{f}$ is locally Hölder continuous in $x$, uniformly in $t,y$.
Suppose that $\bar{f}(t,x,y)\geq
y,\forall(t,x,y)\in\mathbb{R}_{+}\times\mathbb{R}^{m}\times\mathbb{R}$. In
order to rule out the moral hazard, we similarly assume that $\bar{f}$
satisfies inequality (9). A specific form of $\bar{f}$ is
$y^{+}-R^{\prime}y^{-},R^{\prime}\in[0,1)$, which is used as a closeout
function in the calculation of DVA. Also, it is immediate to see that our
closeout functions are sufficiently general to accommodate different
specifications of cash flows that arises in the studies of FVA and XVA (see,
e.g., Kim and Leung, 2016; Brigo et al., 2019).

Let us consider the following discounted payoff process of a defaultable claim

$\displaystyle\Upsilon_{t}$ $\displaystyle=\int^{\tau\wedge\tau^{\prime}\wedge
T}_{t}e^{-\int^{s}_{t}r(u,X_{u})du}c(s,X_{s})ds+1_{t<\tau\leq\tau^{\prime}\leq
T}\chi_{1}(\tau,X_{\tau})e^{-\int^{\tau}_{t}r(s,X_{s})ds}$
$\displaystyle+1_{t<\tau^{\prime}<\tau\leq
T}\chi_{2}(\tau^{\prime},X_{\tau^{\prime}})e^{-\int^{\tau^{\prime}}_{t}r(s,X_{s})ds}+\phi(X_{T})e^{-\int^{T}_{t}r(s,X_{s})ds}1_{\tau\wedge\tau^{\prime}>T},$
(16)

where $\chi_{1}$ ($\chi_{2}$) denotes the recovery when the counterparty
(investor) defaults.

Let the pre-default value of the financial claim with replacement closeout be
defined by $\Psi:\mathbb{R}_{+}\times\mathbb{R}^{m}\rightarrow\mathbb{R}$ and
let $\chi_{1}(\tau,X_{\tau})=f(\tau,X_{\tau},\Psi(\tau,X_{\tau}))$ and
$\chi_{2}(\tau^{\prime},X_{\tau^{\prime}})=\bar{f}(\tau^{\prime},X_{\tau^{\prime}},\Psi(\tau^{\prime},X_{\tau^{\prime}}))$
in (3.5). Then it follows from the standard argument (e.g. Bielecki and
Rutkowski, 2013, chapter 9) on credit risk that the pre-default value $\Psi$
is given by

$\displaystyle\Psi(t,x)$
$\displaystyle=\mathbb{E}\left[\int^{T}_{t}(c(s,X_{s})+\lambda(s,X_{s})f(s,X_{s},\Psi(t,X_{s}))\right.$
$\displaystyle+\bar{\lambda}(s,X_{s})\bar{f}(s,X_{s},\Psi(t,X_{s})))e^{-\int^{s}_{t}r(u,X_{u})+\lambda(u,X_{u})+\bar{\lambda}(u,X_{u})du}ds$
$\displaystyle\left.+e^{-\int^{T}_{t}r(s,X_{s})+\lambda(s,X_{s})+\bar{\lambda}(s,X_{s})ds}\phi(X_{T})|X_{t}=x\right].$
(17)

We close this subsection by studying the solvability of the valuation equation
(3.5) and the impact of the replacement closeout on the valuation. To this
end, we set a benchmark as follows:

$\displaystyle\Psi_{0}(t,x)$
$\displaystyle=\mathbb{E}\left[\int^{T}_{t}(c(s,X_{s})+\lambda(s,X_{s})f(s,X_{s},V(t,X_{s}))\right.$
$\displaystyle+\bar{\lambda}(s,X_{s})\bar{f}(s,X_{s},V(t,X_{s})))e^{-\int^{s}_{t}r(u,X_{u})+\lambda(u,X_{u})+\bar{\lambda}(u,X_{u})du}ds$
$\displaystyle\left.+e^{-\int^{T}_{t}r(s,X_{s})+\lambda(s,X_{s})+\bar{\lambda}(u,X_{u})ds}\phi(X_{T})|X_{t}=x\right].$
(18)

###### Theorem 3

With the notations above, there exists a unique $\Psi\in
C^{1,2}([0,T)\times\mathbb{R}^{m})\cap C([0,T]\times\mathbb{R}^{m})$ with
polynomial growth, such that the valuation equation (3.5) holds. Moreover,
$\Psi(t,x)\geq\Psi_{0}(t,x),\forall(t,x)\in[0,T]\times\mathbb{R}^{m}.$

Proof. Using Lemmas 3, 4 and 5, the proof is essentially the same as the
proofs of Theorems 1 and 2. Thus we omit it.

Theorem 3, which extends Theorem 1 to the bilateral case, demonstrates the
unique solvability of the valuation equation (3.5). Also, comparing (3.5) and
(3.5), one can see that the pricing formula (3.5) ignores the investor’s
creditworthiness in the recovery calculation. Hence, Theorem 3 shows that the
neglecting the investor’s creditworthiness in the recovery calculation would
result in overestimating the counterparty credit risk.

##  4 Algorithms

In this section, we introduce a deep learning-based algorithm for computing
CVA. We work within the Deep BSDE framework established by E et al. (2017).
While E et al. (2017) treat the gradient of the value function as a sequence
of state functions at different time nodes, and thus use a sequence of
different neural networks to approximate the gradient, the algorithm proposed
in this paper, on the other hand, considers the gradient to be a function of
time and states and thus allows us to use one unified neutral network to
approximate the gradient.

###  4.1 The BSDE formulation

As CVA is defined by the difference between the risk-free value and the pre-
default value of a financial claim, and the risk-free value is a special case
of the pre-default value with $\lambda(t,X_{t})\equiv 0$, it suffices to focus
on the valuation equation (3.3) of the pre-default value of the financial
claim. An immediate result of Theorem 1 and Feynman-Kac formula is that $V$,
defined by the valuation equation (3.3), is the classical solution to the
following PDE problem:

$\displaystyle\mathcal{L}V(t,x)-(r(t,x)+\lambda(t,x))V(t,x)+\lambda(t,x)f(t,x,V(t,x))+c(t,x)$
$\displaystyle=0,\quad(t,x)\in[0,T)\times\mathbb{R}^{m},$ (19) $\displaystyle
V(T,x)$ $\displaystyle=\phi(x),\quad x\in\mathbb{R}^{m}.$ (20)

It follows from El Karoui et al. (1997) that the nonlinear PDE problem, which
comprises (19) and (20), is related to a BSDE in the sense that151515See,
e.g., Crépey (2015a), Crépey (2015b) and Bichuch et al. (2018), for more
discussion about the BSDE formulation for the valuation of credit risk.

$\displaystyle
V(t,X_{t})=\phi(X_{T})+\int^{T}_{t}F(s,X_{s},V_{s})ds-\int^{T}_{t}(\sigma(s,X_{s})^{T}\nabla_{x}V(s,X_{s}))^{T}dW_{s}.$
(21)

Here $\\{X_{t}\\}_{t\in[0,T]}$ is given by the SDE (1) and
$F(t,x,y)=c(t,x)+\lambda(t,x)f(t,x,y)-(r(t,x)+\lambda(t,x))y$.

###  4.2 The stochastic control problem

We apply a time discretization to (1) and (21). More specifically, let
$0=t_{0}<t_{1}<t_{2}<...<t_{N}=T$ and denote $\Delta
W_{i}=W_{t_{i+1}}-W_{t_{i}},\Delta t_{i}=t_{i+1}-t_{i},i=0,1,2,...,N-1.$ Then
applying the Euler-Maruyama scheme results in

$\displaystyle X_{t_{i+1}}\approx X_{t_{i}}+\mu(t_{i},X_{t_{i}})\Delta
t_{i}+\sigma(t_{i},X_{t_{i}})\Delta W_{i},\quad X_{0}=x$ (22) $\displaystyle
V_{t_{i+1}}$ $\displaystyle\approx
V_{t_{i}}-F(t_{i},X_{t_{i}},V_{t_{i}})\Delta
t_{i}+\nabla_{x}V(t_{i},X_{t_{i}})^{T}\sigma(t_{i},X_{t_{i}})\Delta
W_{i},\quad V_{0}=v.$ (23)

Taking $\nabla V$ and $V_{0}$ as decision variables, we then obtain the
stochastic control problem

$\displaystyle\min_{v\in\mathbb{R}^{m},\\{z_{i}\\}_{i=0,1,2,...,N-1},z_{i}\in\mathbb{R}^{m}}\mathbb{E}|V_{t_{N}}-\phi(X_{t_{N}})|^{2},$
(24)

such that

$\displaystyle V_{t_{i+1}}$
$\displaystyle=V_{t_{i}}-F(t_{i},X_{t_{i}},V_{t_{i}})\Delta
t_{i}+z_{i}^{T}\sigma(t_{i},X_{t_{i}})\Delta W_{i},\quad V_{0}=v,$ (25)

where $X_{t_{i}},i=0,1,2,...,N-1$ is given by (22).

In order to solve the stochastic control problem (24), we use Monte Carlo
method to simulate $L$ paths
$(X^{l}_{t_{i}},V^{l}_{t_{i}})_{i=0,1,2,...,N-1},l=1,2,3...,L,$ using (22) and
(25). Then the control problem (24) reads

$\displaystyle\min_{v\in\mathbb{R}^{m},\\{z_{i}\\}_{i=0,1,2,...,N-1},z_{i}\in\mathbb{R}^{m}}\frac{1}{L}\sum_{l=1}^{L}(V^{l}_{t_{N}}-\phi(X^{l}_{t_{N}}))^{2},$
(26)

where $(X^{l}_{t_{N}},V^{l}_{t_{N}}),l=1,2,3...,L,$ are the simulated sample
paths correspond to (22) and (25).

###  4.3 The single network-based algorithm

Motivated by Raissi (2018b), we propose a single network-based algorithms for
solving the stochastic control problem (24). We consider $\nabla_{x}V$ to be a
function of $(t,x)$ and approximate it by a network $\mathcal{N}$, i.e.,

$\displaystyle\nabla_{x}V(t_{i},X_{t_{i}})\thickapprox\mathcal{N}(t_{i},X_{t_{i}}|\theta),0\leq
i\leq N-1,$ (27)

where $\theta=\\{\theta_{j}\\}_{j=1,2,3...,J}$ denotes the trainable
parameters in the network.

Equipping the Discretized BSDE (23) with the neural network, we have

$\displaystyle\mathcal{V}^{\theta}_{t_{i+1}}=\mathcal{V}^{\theta}_{t_{i}}-F(t_{i},X_{t_{i}},\mathcal{V}^{\theta}_{t_{i}})\Delta
t_{i}+\mathcal{N}(t_{i},X_{t_{i}})^{T}\sigma(t_{i},X_{t_{i}})\Delta
W_{i},\quad\mathcal{V}^{\theta}_{0}=v.$ (28)

Replacing the objective function (24), we define the loss function used in the
Deep BSDE method by $\iota(y,\theta),$ i.e.,

$\displaystyle\iota(v,\theta)=\mathbb{E}|\mathcal{V}^{\theta}_{t_{N}}-\phi(X_{t_{N}})|^{2}.$
(29)

We then obtain the control problem considered in the Deep BSDE method

$\displaystyle\min_{v\in\mathbb{R}^{m},\theta\in\mathbb{R}^{J}}\iota(v,\theta),$
(30)

subject to (22) and (28).

Having obtained the control problem (30), we are poised to use the a
stochastic gradient descent-type (SGD) algorithm to seek the optimal solution.
The algorithm is summarized as follows.

Algorithm 1 The single network-based Deep BSDE solver

1:function DBSDE($N$, $L$, SDE, BSDE): $\triangleright$ $N$ time steps, $L$
paths for Monte Carlo loop, SDE defined by (22) and BSDE defined by (28).

2: Fix the neural network architecture $\mathcal{N}$.

3: Initialize trainable parameters $(y,\theta)$.

4: for $i=1$ to $n$ do: $\triangleright$ $n$ iterations for training the
neural network.

5: Simulate $L$ paths of $X$ and $\mathcal{V}$ by SDE and BSDE respectively.

6: Replace $\iota(v,\theta)$ by
$\frac{1}{L}\sum_{l=1}^{L}(\mathcal{V}^{\theta,l}_{t_{N}}-\phi(X^{l}_{t_{N}}))^{2}.$
$\triangleright$ $(X^{l},\mathcal{V}^{\theta,l})_{1\leq l\leq L}$ are the
sample paths of $X$ and $\mathcal{V^{\theta}}$.

7: Compute the loss
$\displaystyle\frac{1}{L}\sum_{l=1}^{L}(\mathcal{V}^{\theta,l}_{t_{N}}-\phi(X^{l}_{t_{N}}))^{2},$

8: Reduce the loss by an SGD algorithm and update $(y_{i},\theta_{i})$.

9: end for

10: return updated parameters $(y^{*},\theta^{*}).$ $\triangleright$
$(y^{*},\theta^{*})$ are all parameters of the trained network
$\mathcal{N}^{*}$. Thus, the algorithm returns the trained network
$\mathcal{N}^{*}$.

11:end function

In practice, in order to increase the reliability of the algorithm, one
usually runs independently the algorithm many times with different initial
values and then takes the average as the value function. Using this idea, we
obtain the algorithms for the pre-default value of a defaultable claim with
the replacement closeout and corresponding CVA as follows.

Algorithm 2 The algorithm for the pre-default value of a defaultable claim
with the replacement closeout

1:function VALUE_REPLACEMENT($N$, $L$, SDE, BSDE, $M$): $\triangleright$ $N$
time steps, $L$ paths for Monte Carlo loop, SDE defined by (22), BSDE defined
by (28) and $M$ independent trials.

2: for $i=1$ to $M$ do:

3: Import the function from Algorithm 1 and set up the initial value of
trainable parameters $(y_{i},\theta_{i})$.

4: $(y_{i}^{*},\theta_{i}^{*})\leftarrow$ DBSDE($N$, $L$, SDE, BSDE).

5: end for

6: return $V(t_{0},X_{t_{0}})\leftarrow\frac{1}{M}\sum_{i=1}^{M}y^{*}_{i}$.
$\triangleright$ $V$ is the pre-default value of the defaultable claim with
the replacement closeout.

7:end function

Algorithm 3 The CVA solver

1:function CVA($N$, $L$, SDE, BSDE, BSDE_U, $M$):$\triangleright$ $N$ time
steps, $L$ paths for Monte Carlo loop, SDE defined by (22), BSDE defined by
(28), BSDE_U defined by (28) with $\lambda(t,x)\equiv 0$ and $M$ independent
trials.

2: Import the function from Algorithm 2.

3: $y_{0}^{*}\leftarrow$ VALUE_REPLACEMENT($N$, $L$, SDE, BSDE,
M).$\triangleright$ $y_{0}$ is the pre-default value of the defaultable claim
with the replacement closeout at $(t_{0},X_{t_{0}})$.

4: $y_{1}^{*}\leftarrow$ VALUE_REPLACEMENT($N$, $L$, SDE, BSDE_U,
$M$).$\triangleright$ $y_{1}$ is the value of the risk-free counterpart of the
defaultable claim at $(t_{0},X_{t_{0}})$.

5: return $c\leftarrow$ $y_{1}^{*}-y_{0}^{*}$.$\triangleright$ $c$ is the CVA
for the defaultable claim with the replacement closeout.

6:end function

##  5 Numerical Results and Discussion

In this section, we test our algorithm on a defaultable European option by
assuming
$\phi(x)=(dK-\sum_{i=1}^{d}x_{i})^{+},\lambda(t,x)=\lambda,c(t,x)=0,r(t,x)=r,f(t,x,y)=Ry^{+}-y^{-},$
where $K,\lambda,R$ are positive constants. Moreover, we suppose the
underlying asset follows a multi-dimensional Geometric Brownian motion,

$\displaystyle dX_{it}=\mu_{i}X_{it}dt+\sigma_{i}X_{it}dW_{it},i=1,2,\dots,d,$

where $\mu_{i},\sigma_{i}$ are constants and
$W=(W_{1},W_{2},\ldots,W_{d})^{T}$ is a $d$-dimensional Brownian motion.

The single network-based algorithm is tested with the stacked LSTM
architecture with $3$ hidden layers (all $d+10$ dimensions). We choose the
hyperbolic tangent function as the activation function and use the Adam
optimizer (Kingma and Ba, 2014) for the SGD process. We implement our
algorithm on the defaultable option with $N=100$ (number of time steps),
$L=64$ (number of paths for the Monte Carlo loop). All tests in this section
are run on a PC with a 2.80GHz Intel Core i5-8400 CPU and an NVIDIA GeForce
RTX 2060 GPU using Google TensorFlow in Python.

###  5.1 CVA

The nonlinearity resulting from the replacement closeout is regarded as a
major obstacle to the application, especially when the dimension (the number
of the risk factors) of the valuation model is high. Because of the power of
the deep learning technique, we are now able to calculate the CVA with
replacement closeout in high dimensional contexts. Table 5.1 lists the CVA for
the defaultable European option over different values of dimensional case $d$,
where $d=5,10,20,50,100.$

Dimension | 5 | 10 | 20 | 50 | 100
---|---|---|---|---|---
CVA | $0.04487$ | $0.0876$ | $0.1794$ | $0.4495$ | $0.8288$

Table 5.1. The CVA for the defaultable European put option. Notes. The table
compares the CVA for the defaultable European put option, calculated with the
single LSTM DBSDE solver in the present paper. The table uses the parameters
$r=0.03,\mu=0.05,\sigma=0.2,\lambda=0.1,R=0.4,K=1,X_{i0}=0.8,i=1,2,\ldots,d,T=1$.
The number of the independent trials is $M=5$.

###  5.2 Comparison with the multi-FC DBSDE solver (E et al. 2017)

In this subsection, we show the accuracy of our algorithm. To this end, we
compare our algorithm with the multi-FC DBSDE solver (E et al., 2017), whose
validation for the valuation of defaultable claims has been examined by
Gnoatto et al. (2020). While the results obtained from multi-FC DBSDE serve as
a benchmark, Table 5.2 demonstrates the ability of the single network-based
algorithm in providing accurate numerical approximations even for dimension as
high as 100.

Figure 5.2 compares the algorithm in the present paper with the mult-FC DBSDE
solver in terms of the iteration number required for the convergence in the
$100$-dimensional case. The left panel shows that the single LSTM DBSDE solver
requires fewer iterations to reach the convergence than the mult-FC DBSDE
solver. The right panel analyzes the approximations in the convergence state.
The shaded areas depict the means and the ranges of the 20 independent runs of
the two algorithms. This panel clearly demonstrates that the proposed single
network-based algorithm is more stable with the random choice of the initial
parameters than the mult-FC DBSDE solver.

Dimension | 5 | 10 | 20 | 50 | 100
---|---|---|---|---|---
Multi-FC | $0.7378$ | $1.4578$ | $2.9082$ | $7.2663$ | $14.5331$
Single-LSTM | $0.7285$ | $1.4548$ | $2.9013$ | $7.2690$ | $14.5273$
Relative Error | $1.26\%$ | $0.21\%$ | $0.24\%$ | $0.04\%$ | $0.04\%$

Table 5.2. The pre-default values of the defaultable European put option.
Notes. The table compares the pre-default values of the defaultable European
put option, calculated with the multi-FC DBSDE solver and the single LSTM
DBSDE solver in the present paper. The table uses the parameters
$r=0.03,\mu=0.05,\sigma=0.2,\lambda=0.1,R=0.4,K=1,X_{i0}=0.8,i=1,2,\ldots,d,T=1$.
The number of the independent trials is $M=5$. We set the results obtained
from the Multi-FC DBSDE solver as a benchmark. Thus the relative error is
given by $|\frac{V^{s}-V^{m}}{V^{m}}|,$ where $V^{m}$ and $V^{s}$ are the pre-
default values calculated with the multi-FC DBSDE solver and the single LSTM
DBSDE solver respectively.

Fig. 5.2. Approximation of the pre-default value of the option against the
number of iterations. Notes. The left panel compares the iteration numbers
required for the convergence of the single LSTM DBSDE solver and the multi-FC
DBSDE solver respectively. The right panel breaks down the convergence state
and demonstrates the stability of the two solvers. The shade areas depict the
ranges of the $20$ independent runs of the algorithms with different initial
trainable parameters. The figure uses the parameters
$r=0.03,\mu=0.05,\sigma=0.2,\lambda=0.1,R=0.4,K=1,X_{i0}=0.8,i=1,2,\ldots,d,T=1$.

###  5.3 Risk-free versus replacement closeout: a consequence for
computational cost

Recall that in the proof of Theorem 1, the pre-default value of a defaultable
claim with the replacement closeout is obtained with an iterative process,
while the pre-default value with the risk-free closeout is the result of the
second iteration. Thus, it seems to suggest that the valuation with
replacement closeout is computationally more burdensome. However, the Deep
BSDE framework gives a different pattern on the computational cost. A
distinctive feature of Deep BSDE solvers is that this type of algorithm
tackles the nonlinear problems directly, rather than linearizing the problem
using a sequence of iterations. As a result, using deep learning to compute
the replacement closeout is computationally more efficient than computing the
risk-free closeout. This is validated in Table 5.3 which shows that the
computational time for the valuation of the defaultable option with the
replacement closeouts is less than half of the corresponding risk-free
closeouts. The saving in computational time holds consistently over the
dimensions we have compared.

Dimension | 5 | 10 | 20 | 50 | 100
---|---|---|---|---|---
Replacement closeout | 318s | 352s | 405s | 599s | 857s
Risk-free closeout | 668s | 751s | 873s | 1299s | 1879s

Table 5.3. The running time for the computation of the pre-default values of
the defaultable option with the risk-free and replacement closeout conventions
respectively. Notes. The table compares the risk-free and replacement closeout
conventions in terms of computational cost. All the results are obtained with
the single LSTM DBSDE solver. The table uses the parameters
$r=0.03,\mu=0.05,\sigma=0.2,\lambda=0.1,R=0.4,K=1,X_{0}=0.8,T=1$. The running
time is the average running time of $5$ independent trials.

##  6 Conclusions

In this paper, we have developed a general framework to underpin the
replacement closeout in the valuation of defaultable claims and counterparty
credit risk. The majority of the paper is focused on how to handle the
nonlinear valuation system attributed to the replacement closeout. In the
theoretical part, we show the unique solvability of the nonlinear system and
thus justifying the valuation model from a mathematical perspective. Moreover,
we study the impact of the replacement on calculation of CVA. Compared to the
traditional risk-free closeout, the replacement closeout captures the
creditworthiness of the counterparty. Our result shows that the replacement
closeout yields a higher CVA than the conventional risk-free counterpart and
thus cautioning that lack of the incorporation of the counterparty’s credit
quality in the recovery calculation would result in an underestimate of CVA.

The nonlinearity arising from the replacement closeout poses a computing
challenge for high dimensional valuation models. To address this issue, we
develop a Deep BSDE algorithm for the valuation of counterparty risk with the
replacement closeout. In contrast to the existing BSDE algorithm in the credit
risk literature, our algorithm is single network based. Numerical tests
demonstrate that our algorithm works satisfactory in high dimensional models
and would show better convergence stability than the conventional multi-
network based algorithm. Finally, we conduct numerical analysis to show the
impact of the replacement closeout on the computational cost. Our numerical
results show that the computation with replacement closeout would consume less
running time than the risk-free closeout for the valuation of defaultable
claims, and thus suggesting that the Deep BSDE type algorithm would help clear
the obstacles for the application of the replacement closeout.

##  Appendix A Appendix: Lemmas

###### Lemma 1

Define

$\displaystyle
U_{0}(t,x)=\mathbb{E}\left[\int^{T}_{t}-|c(s,X_{s})|e^{-\int^{s}_{t}r(u,X_{u})du}ds-e^{-\int^{T}_{t}r(s,X_{s})ds}|\phi(X_{T})||X_{t}=x\right],$
$\displaystyle U_{k}(t,x)$
$\displaystyle=\mathbb{E}\left[\int^{T}_{t}(-|c(s,X_{s})|+\lambda(s,X_{s})f(s,X_{s},U_{k-1}(t,X_{s})))e^{-\int^{s}_{t}r(u,X_{u})+\lambda(u,X_{u})du}ds\right.$
$\displaystyle\hskip
28.90755pt\left.-e^{-\int^{T}_{t}r(s,X_{s})+\lambda(s,X_{s})ds}|\phi(X_{T})||X_{t}=x\right],k\geq
1.$ $\displaystyle J(t,x)$
$\displaystyle=\mathbb{E}\left[\int^{T}_{t}(-|c(s,X_{s})|+\lambda(s,X_{s})f(s,X_{s},0))e^{-\int^{s}_{t}r(u,X_{u})du}ds\right.$
$\displaystyle\hskip
28.90755pt\left.-e^{-\int^{T}_{t}r(s,X_{s})ds}|\phi(X_{T})||X_{t}=x\right]$

Then

$\displaystyle U_{k}(t,x)\geq
J(t,x),\quad\forall(t,x)\in[0,T]\times\mathbb{R}^{m},\forall k\geq 1.$

Proof. It follows from the Feynman-Kac formula and the polynomial growth of
$U_{k}$ (See Proposition 1.) that

$\displaystyle\mathcal{L}U_{k}(t,x)-(r(t,x)+\lambda(t,x))U_{k}(t,x)-|c(t,x)|+\lambda(t,x)f(t,x,U_{k-1}(t,x))=0,$
(31)

Thanks to Proposition 3, we have that

$\displaystyle 0\geq U_{k-1}(t,x)\geq U_{k}(t,x),\forall k\geq
1,\forall(t,x)\in[0,T]\times\mathbb{R}^{m}.$ (32)

Moreover, it is to see from Condition (9) that

$\displaystyle f(x)\geq f(0)+x,\forall x\leq 0.$

Thus, from (32) and (31), we have that

$\displaystyle 0=$
$\displaystyle\mathcal{L}U_{k}(t,x)-(r(t,x)+\lambda(t,x))U_{k}(t,x)-|c(t,x)|+\lambda(t,x)f(t,x,U_{k-1}(t,x))$
$\displaystyle\geq$
$\displaystyle\mathcal{L}U_{k}(t,x)-(r(t,x)+\lambda(t,x))U_{k}(t,x)-|c(t,x)|+\lambda(t,x)f(t,x,U_{k}(t,x))$
$\displaystyle\geq$
$\displaystyle\mathcal{L}U_{k}(t,x)-(r(t,x)+\lambda(t,x))U_{k}(t,x)-|c(t,x)|+\lambda(t,x)(f(t,x,0)+U_{k}(t,x)),$

i.e.,

$\displaystyle\mathcal{L}U_{k}(t,x)-r(t,x)U_{k}(t,x)-|c(t,x)|+\lambda(t,x)f(t,x,0)\leq
0.$ (33)

Using the Feynman-Kac formula on $J(t,x)$, we have that

$\displaystyle\mathcal{L}J(t,x)-r(t,x)J(t,x)-|c(t,x)|+\lambda(t,x)f(t,x,0)=0.$
(34)

Thanks to (33) and (34), we then have

$\displaystyle\mathcal{L}(J(t,x)-U_{k}(t,x))-r(t,x)(J(t,x)-U_{k}(t,x))\geq 0.$
(35)

Then $J(t,x)\leq U_{k}(t,x)$ follows from the maximum principle and the fact
that $J(T,x)-U_{k}(T,x)=0$.

This completes the proof.

###### Lemma 2

$\displaystyle U(t,x)\geq V^{k}(t,x)\geq
J(t,x),\quad\forall(t,x)\in[0,T]\times\mathbb{R}^{m},\forall k\geq 1.$

Proof. It is easy to see that $U_{0}(t,x)\leq U(t,x)$. Then the monotonicity
of $f(t,x,y)$ in $y$ yields that $U_{1}(t,x)\leq V^{1}(t,x)$. Following the
mathematical induction, we have that $U_{k}(t,x)\leq V^{k}(t,x),\forall k\geq
1.$ Then the conclusion follows from Lemma 1 and Proposition 3.

###### Lemma 3

$\Psi_{0}(t,x)\geq V(t,x),\forall k\geq 1,(t,x)\in[0,T]\times\mathbb{R}^{m}$.

Proof. Similar to the proof of Proposition 2, one can see that $\Psi_{0}$ has
polynomial growth and is the classical solution to the following Cauchy
problem,

$\displaystyle\mathcal{L}\Psi_{0}(t,x)-(\lambda(t,x)+\bar{\lambda}(t,x)+r(t,x))\Psi_{0}(t,x)+\lambda(t,x)f(t,x,V(t,x))$
$\displaystyle+\bar{\lambda}(t,x)\bar{f}(t,x,V(t,x))+c(t,x)=0,\quad(t,x)\in[0,T)\times\mathbb{R}^{m},$
$\displaystyle\Psi_{0}(T,x)=\phi(x),\quad x\in\mathbb{R}^{m}.$

It follows from Theorem 1 and the Feynman-Kac formula that $V$ is the
classical solution to the following Cauchy Problem

$\displaystyle\mathcal{L}V(t,x)-(\lambda(t,x)+r(t,x))V(t,x)+\lambda(t,x)f(t,x,V(t,x))+c(t,x)$
$\displaystyle=0,\quad(t,x)\in[0,T)\times\mathbb{R}^{m},$ $\displaystyle
V(T,x)$ $\displaystyle=\phi(x),\quad x\in\mathbb{R}^{m}.$

Let $S(t,x):=\Psi_{0}(t,x)-V(t,x).$ Then some algebra yields that

$\displaystyle\mathcal{L}S(t,x)-(\lambda(t,x)+\bar{\lambda}(t,x)+r(t,x))S(t,x)+\bar{\lambda}(t,x)(\bar{f}(t,x,V(t,x))-V(t,x))$
$\displaystyle=0,\quad(t,x)\in[0,T)\times\mathbb{R}^{m},$ $\displaystyle
S(T,x)$ $\displaystyle=0,\quad x\in\mathbb{R}^{m}.$

As $\bar{f}(t,x,V(t,x))-V(t,x)\geq 0,$ we have that,

$\displaystyle\mathcal{L}S(t,x)-(\lambda(t,x)+\bar{\lambda}(t,x)+r(t,x))S(t,x)$
$\displaystyle\leq 0,\quad(t,x)\in[0,T)\times\mathbb{R}^{m}.$

Then it follows from the maximum principle that

$\displaystyle S(t,x)\geq 0,\quad(t,x)\in[0,T]\times\mathbb{R}^{m},$

This completes the proof.

###### Lemma 4

Let

$\displaystyle\Psi^{k}(t,x)$
$\displaystyle=\mathbb{E}\left[\int^{T}_{t}(c(s,X_{s})+\lambda(s,X_{s})f(s,X_{s},\Psi^{k-1}(t,X_{s}))\right.$
$\displaystyle\hskip
28.90755pt\left.+\bar{\lambda}(s,X_{s})\bar{f}(s,X_{s},\Psi^{k-1}(t,X_{s})))e^{-\int^{s}_{t}r(u,X_{u})+\lambda(u,X_{u})+\bar{\lambda}(u,X_{u})du}ds\right.$
$\displaystyle\hskip
28.90755pt\left.+e^{-\int^{T}_{t}r(s,X_{s})+\lambda(s,X_{s})+\bar{\lambda}(u,X_{u})ds}\phi(X_{T})|X_{t}=x\right],\forall
k=1,2,3...,$

where $\Psi^{0}(t,x)=\Psi_{0}(t,x).$

Then $\Psi^{k}(t,x)\geq\Psi^{k-1}(t,x),\forall k\geq
1,(t,x)\in[0,T]\times\mathbb{R}^{m}.$

Proof. Thanks to the monotonicity of $f(t,x,y)$ and $\bar{f}(t,x,y)$ in $y,$
and Lemma 3, we have that

$\displaystyle\Psi^{1}(t,x)\geq\Psi^{0}(t,x),(t,x)\in[0,T]\times\mathbb{R}^{m}.$

Then the conclusion can be obtained by the mathematical induction.

###### Lemma 5

Let

$\displaystyle I(t,x)$
$\displaystyle=\mathbb{E}\left[\int^{T}_{t}(c(s,X_{s})+\bar{\lambda}(s,X_{s})(\bar{f}(s,X_{s},V(s,X_{s}))-V(s,X_{s})))e^{-\int^{s}_{t}r(u,X_{u})du}ds\right.$
$\displaystyle\hskip
28.90755pt\left.+e^{-\int^{T}_{t}r(s,X_{s})ds}\phi(X_{T})|X_{t}=x\right].$

Then $\Psi^{k}(t,x)\leq I(t,x),k=1,2,3...,(t,x)\in[0,T]\times\mathbb{R}^{m}.$

Proof. As $V$ has polynomial growth (see Theorem 1), $I$ is well-defined. Then
it follows from the Feynman-Kac formula that

$\displaystyle\mathcal{L}I(t,x)-r(t,x)I(t,x)+\bar{\lambda}(t,x)(\bar{f}(t,x,V(t,x))-V(t,x))+c(t,x)$
$\displaystyle=0,\quad(t,x)\in[0,T]\times\mathbb{R}^{m},$ $\displaystyle
I(T,x)$ $\displaystyle=\phi(x),\quad x\in\mathbb{R}^{m}.$

Similarly, we have that

$\displaystyle\mathcal{L}\Psi^{k}(t,x)-(\lambda(t,x)+\bar{\lambda}(t,x)+r(t,x))\Psi^{k}(t,x)+\lambda(t,x)f(t,x,\Psi^{k-1}(t,x))$
$\displaystyle+\bar{\lambda}(t,x)\bar{f}(t,x,\Psi^{k-1}(t,x))+c(t,x)=0,\quad(t,x)\in[0,T)\times\mathbb{R}^{m},$
$\displaystyle\Psi^{k}(T,x)=\phi(x),\quad x\in\mathbb{R}^{m}.$

As $f(t,x,y)\leq y$, then Lemma 4 yields that

$\displaystyle f(t,x,\Psi^{k-1}(t,x))\leq\Psi^{k}(t,x).$ (36)

Plug (36) into the PDE that $\Psi^{k}$ satisfies, then we have that

$\displaystyle\mathcal{L}\Psi^{k}(t,x)-(\bar{\lambda}(t,x)+r(t,x))\Psi^{k}(t,x)+\bar{\lambda}(t,x)\bar{f}(t,x,\Psi^{k-1}(t,x))+c(t,x)\geq
0.$ (37)

Note that condition (9) implies that $y-\bar{f}(t,x,y)$ is monotone in $y$,
then Lemma 4 and Lemma 3 yield that

$\displaystyle\Psi^{k}(t,x)-\bar{f}(t,x,\Psi^{k-1}(t,x))\geq\Psi^{k-1}(t,x)-\bar{f}(t,x,\Psi^{k-1}(t,x))\geq
V(t,x)-\bar{f}(t,x,V(t,x)).$ (38)

Then it follows from (37) and (38) that

$\displaystyle\mathcal{L}\Psi^{k}(t,x)-r(t,x)\Psi^{k}(t,x)+\bar{\lambda}(t,x)(\bar{f}(t,x,V(t,x))-V(t,x))+c(t,x)\geq
0.$ (39)

Let $Q(t,x)=I(t,x)-\Psi^{k}(t,x)$, then (39) and the PDE that $I$ satisfies
yield that

$\displaystyle\mathcal{L}Q(t,x)-r(t,x)Q(t,x)$ $\displaystyle\leq
0,\quad(t,x)\in[0,T)\times\mathbb{R}^{m},$ $\displaystyle Q(T,x)=0,\quad
x\in\mathbb{R}^{m}.$

This implies $Q(t,x)\geq 0,(t,x)\in[0,T]\times\mathbb{R}$ and thus completing
the proof.

## References

  * Albanese et al. (2015) Albanese, C., L. Andersen, and S. Iabichino (2015): “FVA accounting, risk management and collateral trading,” _Risk_ , 64.
  * Albanese et al. (2021) Albanese, C., S. Crépey, R. Hoskinson, and B. Saadeddine (2021): “XVA analysis from the balance sheet,” _Quantitative Finance_ , 21, 99–123.
  * Andersen et al. (2019) Andersen, L., D. Duffie, and Y. Song (2019): “Funding value adjustments,” _The Journal of Finance_ , 74, 145–192.
  * Aronson and Besala (1967) Aronson, D. and P. Besala (1967): “Parabolic equations with unbounded coefficients,” _Journal of Differential Equations_ , 3, 1–14.
  * Beck et al. (2019) Beck, C., W. E, and A. Jentzen (2019): “Machine learning approximation algorithms for high-dimensional fully nonlinear partial differential equations and second-order backward stochastic differential equations,” _Journal of Nonlinear Science_ , 29, 1563–1619.
  * Beck et al. (2020) Beck, C., M. Hutzenthaler, A. Jentzen, and B. Kuckuck (2020): “An overview on deep learning-based approximation methods for partial differential equations,” _arXiv preprint arXiv:2012.12348_.
  * Bellman (1957) Bellman, R. (1957): “Dynamic programming,” _Press Princeton, New Jersey_.
  * Biagini et al. (2019) Biagini, F., A. Gnoatto, I. Oliva, et al. (2019): “Pricing of counterparty risk and funding with CSA discounting, portfolio effects and initial margin,” _arXiv preprint arXiv:1905.11328_.
  * Bichuch et al. (2018) Bichuch, M., A. Capponi, and S. Sturm (2018): “Arbitrage-free XVA,” _Mathematical Finance_ , 28, 582–620.
  * Bielecki et al. (2008) Bielecki, T. R., M. Jeanblanc, and M. Rutkowski (2008): “Pricing and trading credit default swaps in a hazard process model,” _The Annals of Applied Probability_ , 18, 2495–2529.
  * Bielecki and Rutkowski (2013) Bielecki, T. R. and M. Rutkowski (2013): _Credit risk: modeling, valuation and hedging_ , Springer Science & Business Media.
  * Blanchet-Scalliet and Jeanblanc (2004) Blanchet-Scalliet, C. and M. Jeanblanc (2004): “Hazard rate for credit risk and hedging defaultable contingent claims,” _Finance and Stochastics_ , 8, 145–159.
  * Brigo et al. (2012) Brigo, D., C. Buescu, and M. Morini (2012): “Counterparty risk pricing: Impact of closeout and first-to-default times,” _International Journal of Theoretical and Applied Finance_ , 15, 1250039.
  * Brigo et al. (2014) Brigo, D., A. Capponi, and A. Pallavicini (2014): “Arbitrage-free bilateral counterparty risk valuation under collateralization and application to credit default swaps,” _Mathematical Finance: An International Journal of Mathematics, Statistics and Financial Economics_ , 24, 125–146.
  * Brigo and Chourdakis (2009a) Brigo, D. and K. Chourdakis (2009a): “Counterparty Risk for Credit Default Swaps,” _International Journal of Theoretical and Applied Finance_ , 12, 1007–1026.
  * Brigo and Chourdakis (2009b) ——— (2009b): “Counterparty risk for credit default swaps: Impact of spread volatility and default correlation,” _International Journal of Theoretical and Applied Finance_ , 12, 1007–1026.
  * Brigo et al. (2019) Brigo, D., M. Francischello, and A. Pallavicini (2019): “Nonlinear valuation under credit, funding, and margins: Existence, uniqueness, invariance, and disentanglement,” _European Journal of Operational Research_ , 274, 788–805.
  * Brigo et al. (2016) Brigo, D., Q. D. Liu, A. Pallavicini, and D. Sloth (2016): “Nonlinearity valuation adjustment,” in _Innovations in Derivatives Markets_ , Springer, Cham, 3–35.
  * Brigo and Morini (2011) Brigo, D. and M. Morini (2011): “Close-out convention tensions,” _Risk_ , 24, 74.
  * Burgard and Kjaer (2011) Burgard, C. and M. Kjaer (2011): “Partial differential equation representations of derivatives with bilateral counterparty risk and funding costs,” _The Journal of Credit Risk_ , 7, 1–19.
  * Carleo and Troyer (2017) Carleo, G. and M. Troyer (2017): “Solving the quantum many-body problem with artificial neural networks,” _Science_ , 355, 602–606.
  * Chan-Wai-Nam et al. (2019) Chan-Wai-Nam, Q., J. Mikael, and X. Warin (2019): “Machine learning for semi linear PDEs,” _Journal of Scientific Computing_ , 79, 1667–1712.
  * Chi and Tan (2011) Chi, Y. and K. S. Tan (2011): “Optimal reinsurance under VaR and CVaR risk measures: a simplified approach,” _ASTIN Bulletin: The Journal of the IAA_ , 41, 487–509.
  * Crépey (2015a) Crépey, S. (2015a): “Bilateral counterparty risk under funding constraints-Part I: Pricing,” _Mathematical Finance_ , 25, 1–22.
  * Crépey (2015b) ——— (2015b): “Bilateral counterparty risk under funding constraints-Part II: CVA,” _Mathematical Finance_ , 25, 23–50.
  * Crépey et al. (2010) Crépey, S., M. Jeanblanc, and B. Zargari (2010): “Counterparty risk on a CDS in a Markov chain copula model with joint defaults,” in _Recent Advances in Financial Engineering 2009_ , World Scientific, 91–126.
  * Dasgupta et al. (1979) Dasgupta, P., P. Hammond, and E. Maskin (1979): “The implementation of social choice rules: Some general results on incentive compatibility,” _The Review of Economic Studies_ , 46, 185–216.
  * Duffie and Huang (1996) Duffie, D. and M. Huang (1996): “Swap rates and credit quality,” _The Journal of Finance_ , 51, 921–949.
  * E et al. (2017) E, W., J. Han, and A. Jentzen (2017): “Deep learning-based numerical methods for high-dimensional parabolic partial differential equations and backward stochastic differential equations,” _Communications in Mathematics and Statistics_ , 5, 349–380.
  * El Karoui et al. (1997) El Karoui, N., S. Peng, and M. C. Quenez (1997): “Backward stochastic differential equations in finance,” _Mathematical finance_ , 7, 1–71.
  * Friedman (2008) Friedman, A. (2008): _Partial differential equations of parabolic type_ , Courier Dover Publications.
  * Gers et al. (2002) Gers, F. A., N. N. Schraudolph, and J. Schmidhuber (2002): “Learning precise timing with LSTM recurrent networks,” _Journal of machine learning research_ , 3, 115–143.
  * Gilbarg and Trudinger (2015) Gilbarg, D. and N. S. Trudinger (2015): _Elliptic partial differential equations of second order_ , vol. 224, springer.
  * Gnoatto et al. (2020) Gnoatto, A., C. Reisinger, and A. Picarelli (2020): “Deep xVA Solver–A neural network based counterparty credit risk management framework,” _Available at SSRN 3594076_.
  * Graves et al. (2013) Graves, A., A.-r. Mohamed, and G. Hinton (2013): “Speech recognition with deep recurrent neural networks,” in _2013 IEEE international conference on acoustics, speech and signal processing_ , Ieee, 6645–6649.
  * Gregory (2009) Gregory, J. (2009): “Being two-faced over counterparty credit risk,” _Risk_ , 22, 86–90.
  * Han et al. (2018) Han, J., A. Jentzen, and W. E (2018): “Solving high-dimensional partial differential equations using deep learning,” _Proceedings of the National Academy of Sciences_ , 115, 8505–8510.
  * Henry-Labordère (2012) Henry-Labordère, P. (2012): “Cutting CVA’s complexity,” _Risk_ , 25, 67.
  * Henry-Labordere (2017) Henry-Labordere, P. (2017): “Deep primal-dual algorithm for BSDEs: Applications of machine learning to CVA and IM,” _Available at SSRN 3071506_.
  * Hochreiter and Schmidhuber (1997) Hochreiter, S. and J. Schmidhuber (1997): “Long short-term memory,” _Neural computation_ , 9, 1735–1780.
  * Hu et al. (2012) Hu, B., L. Jiang, J. Liang, and W. Wei (2012): “A fully non-linear PDE problem from pricing CDS with counterparty risk,” _Discrete & Continuous Dynamical Systems-B_, 17, 2001.
  * Huberman et al. (1983) Huberman, G., D. Mayers, and C. W. Smith Jr (1983): “Optimal insurance policy indemnity schedules,” _The Bell Journal of Economics_ , 415–426.
  * Hull and White (2016) Hull, J. and A. White (2016): “XVAs: A gap between theory and practice,” _Risk_ , 29, 50–52.
  * Huré et al. (2019) Huré, C., H. Pham, and X. Warin (2019): “Some machine learning schemes for high-dimensional nonlinear PDEs,” _arXiv preprint arXiv:1902.01599_ , 2.
  * Jarrow and Yu (2001) Jarrow, R. A. and F. Yu (2001): “Counterparty risk and the pricing of defaultable securities,” _the Journal of Finance_ , 56, 1765–1799.
  * Kim and Leung (2016) Kim, J. and T. Leung (2016): “Pricing derivatives with counterparty risk and collateralization: A fixed point approach,” _European Journal of Operational Research_ , 249, 525–539.
  * Kingma and Ba (2014) Kingma, D. P. and J. Ba (2014): “Adam: A method for stochastic optimization,” _arXiv preprint arXiv:1412.6980_.
  * Lieberman (1996) Lieberman, G. M. (1996): _Second order parabolic differential equations_ , World scientific.
  * Myerson (1979) Myerson, R. B. (1979): “Incentive compatibility and the bargaining problem,” _Econometrica: journal of the Econometric Society_ , 61–73.
  * Pallavicini et al. (2011) Pallavicini, A., D. Perini, and D. Brigo (2011): “Funding valuation adjustment: a consistent framework including cva, dva, collateral, netting rules and re-hypothecation,” _DVA, Collateral, Netting Rules and Re-Hypothecation (December 6, 2011)_.
  * Pham (2009) Pham, H. (2009): _Continuous-time stochastic control and optimization with financial applications_ , vol. 61, Springer Science & Business Media.
  * Picard (2000) Picard, P. (2000): “On the design of optimal insurance policies under manipulation of audit cost,” _International Economic Review_ , 41, 1049–1071.
  * Raissi (2018a) Raissi, M. (2018a): “Deep hidden physics models: Deep learning of nonlinear partial differential equations,” _The Journal of Machine Learning Research_ , 19, 932–955.
  * Raissi (2018b) ——— (2018b): “Forward-backward stochastic neural networks: Deep learning of high-dimensional partial differential equations,” _arXiv preprint arXiv:1804.07010_.
  * Raissi et al. (2017) Raissi, M., P. Perdikaris, and G. E. Karniadakis (2017): “Physics informed deep learning (part i): Data-driven solutions of nonlinear partial differential equations,” _arXiv preprint arXiv:1711.10561_.
  * Ruf and Wang (2020) Ruf, J. and W. Wang (2020): “Neural networks for option pricing and hedging: a literature review,” _Journal of Computational Finance, Forthcoming_.
  * Schmidhuber et al. (2005) Schmidhuber, J., D. Wierstra, and F. J. Gomez (2005): “Evolino: Hybrid neuroevolution/optimal linear search for sequence prediction,” in _Proceedings of the 19th International Joint Conferenceon Artificial Intelligence (IJCAI)_.
  * Sirignano and Spiliopoulos (2018) Sirignano, J. and K. Spiliopoulos (2018): “DGM: A deep learning algorithm for solving partial differential equations,” _Journal of computational physics_ , 375, 1339–1364.
  * Tan et al. (2020) Tan, K. S., P. Wei, W. Wei, and S. C. Zhuang (2020): “Optimal dynamic reinsurance policies under a generalized Denneberg?s absolute deviation principle,” _European Journal of Operational Research_ , 282, 345–362.
  * Weinan et al. (2019) Weinan, E., M. Hutzenthaler, A. Jentzen, and T. Kruse (2019): “On multilevel Picard numerical approximations for high-dimensional nonlinear parabolic partial differential equations and high-dimensional nonlinear backward stochastic differential equations,” _Journal of Scientific Computing_ , 79, 1534–1571.
  * Weinan and Yu (2018) Weinan, E. and B. Yu (2018): “The deep Ritz method: a deep learning-based numerical algorithm for solving variational problems,” _Communications in Mathematics and Statistics_ , 6, 1–12.
  * Xu et al. (2019) Xu, Z. Q., X. Y. Zhou, and S. C. Zhuang (2019): “Optimal insurance under rank-dependent utility and incentive compatibility,” _Mathematical Finance_ , 29, 659–692.