# Factor immunization for bond portfolio

I'm trying to figure out some kind of immunization using a factor model I developed for interest rates. Here is the basic problem. Let's say that we have a bond portfolio containing $N$ bonds with weights $x_i$ and one liability. Call the present value of the liability $P_L$. I'll suppose that the bond prices are given by $$P_i=\Sigma_{t=1}^T F_{it}e^{-r_tt}$$ where $F_{it}$ is the future payoff of bond $i$ and $r_t$ is the interest rate at time $t$. Now the factor model for the term structure of the interest rates can be written $$\Delta r_t=\Sigma_{j=1}^k \beta_{jt} \Delta f_j +\epsilon_t$$ for $k$ independent factors and standard normal error term $\epsilon_t$. I'm assuming I have small but not necessarily parallel-shifts in the term structure, I want a first order condition for factor immunization. Can someone help?

The present value is $$P_i= \sum_{t=1}^T F_{i,t} \exp(-r_t t),$$ what happens if rates change to $r_t + \Delta r_t$ then the new price is $$P_i^{new} = \sum_{t=1}^T F_{i,t} \exp(-(r_t+\Delta r_t) t).$$ by the exponential series $\exp(x)\approx 1 + x$ we can write $$P_i^{new} - P_i =: \Delta P_i \approx -\sum_{t=1}^T F_{i,t} \Delta r_t t.$$ Observing the shifts in these rates we have some kind of key-rate duration setting.
If you can decompose your liablity $P_L$ in the is way too (denote the cash flows by $F_t$, then you can try to find quantities $Q_i$ such that $$|\sum_{t=1}^T (Q_i F_{i,t} - F_t) \Delta r_t t| -> Min$$