  We study the problem of valuing a vulnerable derivative with bilateral cash
flows between two counterparties in the presence of funding, credit and
wrong-way risks, and derive a closed-form valuation formula for an at-the-money
(ATM) forward contract as well as a second order approximation for the general
case. We posit a model with heterogeneous interest rates and default occurrence
and infer a Cauchy problem for the pre-default valuation function of the
contract, which includes ab initio any counterparty risk - as opposed to
calculating valuation adjustments collectively known as XVA. Under a specific
funding policy which linearizes the Cauchy problem, we obtain a generic
probabilistic representation for the pre-default valuation (Theorem 1). We
apply this general framework to the valuation of an equity forward and
establish the contract can be expressed as a continuous portfolio of European
options with suitably chosen strikes and expiries under a particular
probability measure (Theorem 2). Our valuation formula admits a closed-form
expression when the forward contract is ATM (Corollary 2) and we derive a
second order approximation in moneyness when the contract is close to ATM
(Theorem 3) which is shown to be extremely accurate. Numerical results of our
model show that the forward is more sensitive to funding factors than credit
ones, while higher stock funding costs increase sensitivity to credit spreads
and wrong-way risk.
