# Unwinding a Portfolio

I have a portfolio $${\mathbf P}$$ made up of positions $$n_i$$ in each of $$N$$ securities, which I'm assuming are jointly normally distributed with means $$x_i$$, and covariance matrix $${\mathbf M}$$.

Markets are getting choppy and I decide I want to unwind it as quickly and safely as possible - so hedging positions should be unwound at the same time (I think this roughly corresponds to minimizing the variance over the lifetime of the portfolio), but I'm also concerned about market impact and/or bid-offer for large orders. I'm trying to formalize this as a minimization problem.

I have a super-linear cost function $$f(n)$$ to trade a clip of size $$n$$, and I want to minimize the sum of that cost and the variance of the portfolio over time, by varying position functions $$n_i(t)$$ which represent the position I'm still holding in that security at time $$t$$ - in the continuous limit I think that looks like this (treating $$n_i$$s as a vector $${\mathbf n}$$):

\begin{align} \underset{n(t)}{\mathrm{argmin}} \int_0^\infty \Bigl( f({\mathbf n}'(t)) + \lambda {\mathbf n^{\intercal}(t)}\cdot{\mathbf M} \cdot {\mathbf n(t)} \Bigr) dt \end{align}

where $$\lambda$$ lets me control the speed of the unwind. I have in mind that calculus of variations can help me here, which gives me an Euler-Lagrange equation

\begin{align} 0 &= \lambda {\frac {\partial {\mathbf n^{\intercal}}\cdot{\mathbf M} \cdot {\mathbf n}} {\partial {\mathbf n}}} - {\frac d {dt}} {\frac {\partial f({\mathbf n}')} {\partial {\mathbf n'}}}\\ &= 2 \lambda {\mathbf n^{\intercal}}\cdot{\mathbf M} - {\frac d {dt}} {\frac {\partial f({\mathbf n}')} {\partial {\mathbf n'}}} \end{align}

using matrix calculus on the first term.

For concreteness and simple algebra, if I assume $$f({\mathbf n}')$$ is the magnitude of the time gradient, $$f({\mathbf n}') = {\mathbf n}'^{\intercal}{\mathbf n}'$$, then I get a sequence of coupled differential equations: \begin{align} 0 &= 2 \lambda {\mathbf n^{\intercal}}\cdot{\mathbf M} - {\frac d {dt}} {\frac {\partial {\mathbf n}'^{\intercal}{\mathbf n}'} {\partial {\mathbf n'}}}\\ &= 2 \lambda {\mathbf n^{\intercal}}\cdot{\mathbf M} - {\frac d {dt}} 2{\mathbf n}'^{\intercal}\\ &= \lambda {\mathbf n^{\intercal}}\cdot{\mathbf M} - {\mathbf n}''^{\intercal} \end{align}

I suppose I can then solve these equations using conventional techniques (although it might be more tricky for an arbitrary cost function $$f$$, which I plan eventually to extract from order book data).

• Is this a sensible approach to the problem?
• Have other people used this or any other approaches?
• Out-of-the-box this technique sometimes suggests increasing position sizes to minimize variance... how should I constrain it to be reducing-only?
• There is literature on optimal portfolio choice with transaction costs, e.g. pages.stern.nyu.edu/~lpederse/papers/…. These models seem related.
– fes
Commented Dec 10, 2020 at 7:23