Computing sensitivities is at the core of XVA calculations. In a risk management context, it is required to compute sensitivities of the XVAs to its inputs, such as interest rates, FX rates, or correlation coefficients. As XVA depends on many such inputs, it is often required to compute hundreds of sensitivities. Further, calibrating the models used for scenario generation to current market data typically involves non-linear optimisation algorithms. These also often need derivatives of the objective function with respect to the model parameters.The traditional approach of bumping the inputs one by one and re-evaluating the XVA leads to an extensive increase in complexity and is often not practical.

In this paper we will zoom on Algorithmic Differentiation as an efficient and robust alternative to compute sensitivities. This tutorial focuses on how to efficiently compute sensitivities. First, we outline the traditional finite differences approach. Then, we introduce algorithmic differentiation. Finally, we give implementations in C++ for a swap pricer, for finite differences, manual AD, and using an automatic AAD tool.

  • Forward mode algorithmic differentiation
  • Adjoint mode algorithmic differentiation
  • Differentiation of arbitrary code
  • Example on a swap pricer code
  • Differentiation of large code-bases
top
Ask A Question