# Plotting a CSA curve in QuantLib

### IRS under a CSA

Let's consider an example of Interest Rate Swap under a CSA. To calculate discount factors that can be used to discount cashflows in one currency, $$C_{1}$$, collateralized in another currency, $$C_{2}$$, all we need are the FX spot and forward rates from $$C_{1}$$ to $$C_{2}$$ and the discount factors in $$C_{2}$$. Let

$$FX_{C1\rightarrow C2}^{FWD}(T)$$ = $$FX\: forward\: rate\: to\: convert\: from$$ $$C_{1}$$ $$to$$ $$C_{1}$$ $$at\: time\: T$$

$$FX_{C1\rightarrow C2}^{SPOT}$$ = $$FX_{C1\rightarrow C2}^{FWD}(0)$$ = $$FX\: spot\: rate\: to\: convert\: from$$ $$C_{1}$$ $$to$$ $$C_{1}$$

$$DF_{C2}(T)$$ = $$discount\: factor\:at\: time\: T\: for\: currency$$ $$C_{2}$$,

Then under the assumption that FX forwards are independent of collateralization we conclude that

$$\Large\frac{FX_{C1\rightarrow\:C2}^{CSA}(T)}{DF_{C2}(T)}$$ $$\Large=$$ $$\Large\frac{FX_{C1\rightarrow\:C2}^{FWD}(T)}{FX_{C1\rightarrow\:C2}^{FWD}(0)}$$

### Question

Is it possible to find such functions in QuantLib that will directly find the discount factors of the CSA curve (And we know how to build an ZeroRate Curve here)? Please guide me in the right direction.

Thank you!

• When I last checked, QuantLib did not offer a cross-currency based bootstrapping or other multi-currency curve building out-of-the-box. The Python documentation hints at the existence of an FXImpliedCurve, maybe that could be a starting point: quantlib-python-docs.readthedocs.io/en/latest/… Jun 23 '21 at 12:31
• @Kermittfrog, Thank you! I will investigate this in detail. Hope this section (FXImpliedCurve) will be updated in the future. Jun 23 '21 at 12:54