# Advice for automating swap curve construction

Let me start by assuming a simple single curve framework, whereby we take input instruments (mm,fra,futures,swaps etc) and strip out a discount-factor curve. Modern implementations of this are usually done with a multi-dimensional optimizer whereby all the input instruments are repriced to par (within tolerance).

My question relates to the daily process of performing the curve stripping process. Obviously in the market there is a bid-ask spread on the input quotes, so there is some degree of freedom to where you set the mid (input) price. If I wanted to match the implied forward curve shape for today as closely as possible to yesterday's curve, what would be the best approach to adjust today's input quotes without manual intervention, i.e. visual inspection of both curves and nudging today's inputs accordingly.

I've thought of using some statistical technique where my inputs are: T-1 discount curve, T market data inputs, T adjusted inputs / T discount curve. (Assuming I have a large sample historical dataset with this information).

Are there any other approaches or guidance on the above idea? Is this even a worthwhile investigation?

I first present the bare basics of single curve bootstrapping in part 1, then I try to come up with some ideas in part 2.

### (bare) Basics of single curve bootstrapping

As I understand it, for a common curve building exercise we have the following ingredients:

• A set of market quotes $$Q_{mkt}$$for various instruments (deposits, FRAs, swaps, basis swaps, ...) corresponding to tenors $$t=\{t_1,t_2,\ldots,t_n\}$$. We commonly use something like the mid quote, i.e. during bootstrapping, there is only one fixed quote per tenor.
• A parameterized curve functional, commonly defined via zero rate points $$r=\{r_1,r_2,\ldots,r_n\}$$, some interpolation assumption for any tenor $$\tau \notin t$$ and some discounting function $$D$$ with day count and interest rate conventions. Let's collect all that into the parameter (set) $$\theta$$. Then, for any tenor $$\tau$$, $$D(\tau)=f(r,t,\theta)$$. Commonly (but not necessarily), the quote nodes and the rate nodes coincide, i.e. we use the 3Y-swap to bootstrap the 3Y-zero-rate, i.e. we have $$n$$ quotes and $$n$$ parameters in our model.

Note: Given $$D(\tau)$$, we can trivially obtain the zero rate curve or forward curve.

Usually, our goal is to minimize (or better: set to zero) the difference between all observed quotes and the quotes implied by our model; put differently, we want to minimize pricing errors by varying the zero rate parameters:

$$\min_{r} ||Q_{mkt}-Q(r)||$$

Generally, this is a multivariate ($$n$$-dimensional) problem, but if the curve interpolation mechanism is sufficiently local, i.e. if there are no 'leaks' from varying $$r_i$$ over to any $$D(\tau)$$ with $$\tau or $$\tau>t_{i+1}$$, then we can use a sequence of univariate bootstrapping steps.

### Some ideas

If I understand you correctly, your goal is to find an 'optimal' curve given some quote set whose shape is as close as possible to some other curve, e.g. yesterday's discount or zero rate curve.

To this end, we now let $$\tau$$ or $$t_i$$ denote the time to maturity of a curve point, instead of calendar time.

1. Given quote bid and ask points $$Q_{mkt}^b, Q_{mkt}^a$$ and mid point $$Q_{mkt}^m$$ across (time-to-maturity) tenors $$t_1,\ldots,t_n$$, and some reference discount curve $$\hat{D}(\tau)$$ (whose parameters are not relevant anymore), find optimal curve parameters $$r$$ such that:

\begin{align} \min_r &\int_\limits{0}^{t_n}||D(\tau)-\hat{D}(\tau)||\mathrm{d}\tau\\ s.t.& \quad Q_{mkt,i}^b \leq Q_i(r) \leq Q_{mkt,i}^a \end{align}

1. As in 1, but our goal function becomes: \begin{align} \min_{r} &||Q_{mkt}^m-Q(r)|| + \lambda \int_\limits{0}^{t_n}||D(\tau)-\hat{D}(\tau)||\mathrm{d}\tau\\ s.t.& \quad Q_{mkt,i}^b \leq Q_i(r) \leq Q_{mkt,i}^a \end{align} where $$\lambda$$ is some penalty parameter for the curve distance.

Now if your interpolation is indeed local and you restrict your desired curve differences such that you only require points up to $$t_k$$ when bootstrapping parameter $$r_k$$, then you can still make use of the standard univariate bootstrapping machinery, iteratively optimizing:

$$\min_{r_k} ||Q_{mkt,k}^m-Q_k(r_k|r_1,\ldots,r_{k-1})|| + \lambda\int\limits_{t_{k-1}}^{t_k}||D(\tau)-\hat{D}(\tau)||\mathrm{d}\tau$$ and you could even trivially introduce the box constraints on the bid/ask.

I hope that offers you an idea on how to tackle this, and probably other people here have even better ideas or hints.

• Great answer, upvoted! Nov 6, 2021 at 14:48