Abstract
We consider a pairs trading stochastic control problem with transaction costs and constraints on the gross market exposure, and propose a new monotone Finite Difference scheme approximating the viscosity solution of the Hamilton–Jacobi–Bellman equation characterizing the optimal trading strategies. Given a fixed time horizon and a portfolio of two cointegrated assets, the agent trades the spread between the two assets and the trading strategy is defined as the possibly negative portfolio weight maximizing the expected exponential utility derived from terminal wealth. Furthermore, trades incur transaction costs comprised of explicit transactions fees and commissions and the implicit cost due to slippage. These costs are modeled as a linear or square root function of the trading rate and respectively added or subtracted from the observable asset price at the time when a buy or a sell order enters the market. Our main contribution is the derivation of a robust approximation for the nonlinear transaction cost term in the Hamilton–Jacobi–Bellman equation. Finally, we combine our monotone Finite Difference scheme with a Monte Carlo sampling method to analyze the effects of transaction fees and slippage on the trading policies’ performance.
Similar content being viewed by others
References
Almgren, R. (2003). Optimal execution with nonlinear impact functions and trading-enhanced risk. Applied Mathematical Finance, 10(1), 1–18. https://doi.org/10.1080/135048602100056.
Almgren, R., & Chriss, N. (2001). Optimal execution of portfolio transactions. Journal of Risk, 3, 5–40.
Almgren, R., Thum, C., Hauptmann, E., & Li, H. (2005). Direct estimation of equity market impact. Risk, 18, 57–62.
Angoshtari, B. (2016, August). On the Market-Neutrality of Optimal Pairs-Trading Strategies (Papers No. 1608.08268). arXiv.org. Retrieved from https://ideas.repec.org/p/arx/papers/1608.08268.html.
Barles, G., Daher, C., & Romano, M. (1995). Convergence of numerical schemes for parabolic equations arising in finance theory. Mathematical Models and Methods in Applied Sciences, 5, 125–143.
Barles, G., & Souganidis, P. (1991). Convergence of approximation schemes for fully nonlinear second order equations. Asymptotic Analysis, 4, 271–283.
Benth, F. E., & Karlsen, K. H. (2005). A note on Merton’s portfolio selection problem for the Schwartz mean-reversion model. Stochastic Analysis and Applications, 23, 687–704.
Chiu, M. C., & Wong, H. Y. (2011). Mean. variance portfolio selection of cointegrated assets. Journal of Economic Dynamics and Control, 35, 1369–1385.
Cuoco, D. (1997). Optimal consumption and equilibrium prices with portfolio constraints and stochastic income. Journal of Economic Theory, 72, 33–73.
Curato, G., Gatheral, J., & Lillo, F. (2017). Optimal execution with nonlinear transient market impact. Quantitative Finance, 17(1), 41–54. https://doi.org/10.1080/14697688.2016.1181274.
Cvitanic, J., & Karatzas, I. (1992). Convex duality in constrained portfolio optimization. The Annals of Applied Probability, 2(4), 767–818.
Duan, J.-C., & Pliska, S. (2004). Option valuation with co-integrated asset prices. Journal of Economic Dynamics and Control, 28, 727–754.
Fleming, W. H., & Soner, H. M. (1993). Controlled Markov processes and viscosity solutions. Berlin: Springer.
Gatheral, J. (2010). No-dynamic-arbitrage and market impact. Quantitative Finance, 10(7), 749–759.
Grossman, S., & Vila, J.-L. (1992). Optimal dynamic trading with leverage constraints. The Journal of Financial and Quantitative Analysis, 27(2), 151–168.
Guasoni, P., & Weber, M. (2015). Nonlinear price impact and portfolio choice. Retrieved from. https://doi.org/10.2139/ssrn.2613284.
Hogan, S., Jarrow, R., Teoc, M., & Warachkac, M. (2004). Testing market efficiency using statistical arbitrage with applications to momentum and value strategies. Journal of Financial Economics, 73, 525–565.
Kogan, L., & Uppal, R. (2002). Risk aversion and optimal portfolio policies in partial and general equilibrium economies (Tech. Rep. No. 3306). Centre for Economic Policy Research. (Discussion Paper)
Lei, Y., & Xu, J. (2015). Costly arbitrage through pairs trading. Journal of Economic Dynamics and Control, 56, 1–19.
Leung, T., & Li, X. (2015). Optimal mean reversion trading with transaction costs and stop-loss exit. International Journal of Theoretical and Applied Finance, 18(3), 1550020.
Lillo, F. (2003). Master curve for price-impact function. Nature, 421, 129–130.
Liu, R., Muhler-Karbe, J., & Weber, M. (2017). Rebalancing with linear and quadratic costs. SIAM Journal on Control and Optimization, 55(6), 3533–3563.
Mudchanatongsuk, S., Primbs, J. A., & Wong, W. (2008). Optimal pairs trading: A stochastic control approach. In Proceedings of the American control conference (pp. 1035–1039).
Ngo, M.-M., & Pham, H. (2014). Optimal switching for pairs trading rule: a viscosity solutions approach. Retrieved from http://arxiv.org/pdf/1412.7649v1.pdf.
Pham, H. (2009). Continuous-time stochastic control and optimization with financial applications. Berlin: Springer.
Potters, M., & Bouchaud, J.-P. (2002). More statistical properties of order books and price impact. Physica A: Statistical Mechanics and its Applications, 324, 133–140.
Primbs, J. . A., & Yamada, Y. (2018). Pairs trading under transaction costs using model predictive control. Quantitative Finance, 18(6), 885–895. https://doi.org/10.1080/14697688.2017.1374549.
Rouy, E., & Tourin, A. (1992). A viscosity solutions approach to shape-fromshading. SIAM Journal on Numerical Analysis, 29(3), 867–884.
Soner, H. M. (1986a). Optimal control with state-space constraint. I. SIAM Journal on Control and Optimization, 24, 552–561.
Soner, H. M. (1986b). Optimal control with state-space constraint. II. SIAM Journal on Control and Optimization, 24, 1110–1122.
Tourin, A., & Yan, R. (2013). Dynamic pairs trading using the stochastic control approach. Journal of Economic Dynamics and Control, 37(10), 1972–1981.
Touzi, N. (2013). Optimal stochastic control, stochastic target problems, and backward SDE. Berlin: Springer.
Acknowledgements
The Authors have contributed equally to this paper.
Author information
Authors and Affiliations
Corresponding author
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Appendix: The Finite Difference Scheme for the model with price impact
Appendix: The Finite Difference Scheme for the model with price impact
In this appendix, we derive a monotone approximation for the viscosity solution of (68), (69). We will use the standard notations
As in Sect. 5, we split (68) into two operators:
and
Next, we proceed as in Sect. 5 to derive a scheme for (71) in the interior of the domain by writing
We can solve the above optimization problem in closed form.
-
For the first infimum, the critical point is
$$\begin{aligned} v^{++} = \frac{\kappa \gamma \pi _j G_{i,j}^n-\kappa D_z^+G_{i,j}^n-D_{\pi }^+G_{i,j}^n}{2\lambda \gamma G_{i,j}^n}. \end{aligned}$$The infimum is attained at \(v_1^*\) defined by
-
if \(b_{i,j}+\kappa v \ge 0, v \ge 0\), \(v_1^*=v^{++}\)
-
if \(b_{i,j}+\kappa v \ge 0, v < 0\), \(v_1^*=0\)
-
if \(b_{i,j}+\kappa v < 0, v \ge 0\), \(v_1^*=-\frac{b_{i,j}}{\kappa }\).
-
-
For the second infimum, the critical point is
$$\begin{aligned} v^{+-} = \frac{\kappa \gamma \pi _j G_{i,j}^n-\kappa D_z^+G_{i,j}^n-D_{\pi }^-G_{i,j}^n}{2\lambda \gamma G_{i,j}^n}. \end{aligned}$$The solution of the minimization problem is given by
-
if \(b_{i,j}+\kappa v \ge 0, v < 0\), \(v_2^*=v^{+-}\)
-
if \(b_{i,j}+\kappa v \ge 0, v \ge 0\), \(v_2^*=0\)
-
if \(b_{i,j}+\kappa v< 0, v < 0\), \(v_2^*=-\frac{b_{i,j}}{\kappa }\).
-
-
For the third infimum, the critical point is
$$v^{-+} = \frac{\kappa \gamma \pi _j G_{i,j}^n-\kappa D_z^-G_{i,j}^n-D_{\pi }^+G_{i,j}^n}{2\lambda \gamma G_{i,j}^n},$$and the solution of the optimization problem is
-
if \(b_{i,j}+\kappa v < 0, v \ge 0\), \(v_3^*=v^{-+}\)
-
if \(b_{i,j}+\kappa v< 0, v < 0\), \(v_3^*=0\)
-
if \(b_{i,j}+\kappa v \ge 0, v \ge 0\), \(v_3^*=-\frac{b_{i,j}}{\kappa }\)
-
-
Finally, for the forth infimum, the critical point is
$$\begin{aligned} v^{--} = \frac{\kappa \gamma \pi _j G_{i,j}^n-\kappa D_z^-G_{i,j}^n-D_{\pi }^-G_{i,j}^n}{2\lambda \gamma G_{i,j}^n}, \end{aligned}$$and the solution of the minimization problem is given by
-
if \(b_{i,j}+\kappa v< 0, v < 0\), \(v_4^*=v^{--}\)
-
if \(b_{i,j}+\kappa v < 0, v \ge 0\), \(v_4^*=0\)
-
if \(b_{i,j}+\kappa v \ge 0, v < 0\), \(v_4^*=-\frac{b_{i,j}}{\kappa }\)
-
For instance, when the minimum in (72) is realized for the first infimum and achieved at the critical point inside the interval, the resulting Finite Difference scheme is given by
When, the minimum is realized for one of the other infima and achieved inside the associated interval, on must replace in the above scheme the forward Finite Differences \(D^+_z G_{i,j}^n\) and \(D^+_{\pi } G_{i,j}^n\) by the appropriate pair of Finite Differences, which are respectively \(D^+_z G_{i,j}^n, D^-_{\pi } G_{i,j}^n\) for the second infimum, \(D^-_z G_{i,j}^n, D^+_{\pi } G_{i,j}^n\) for the third, and \(D^-_z G_{i,j}^n, D^-_{\pi } G_{i,j}^n\) for the forth.
When the minimum holds for \(v^*=0\), (73) degenerates to
Finally, we leave to the reader the case when \(v^*=-\frac{b_{i,j}}{\kappa }\).
Note that, as in Sect. 5, we also need to modify the scheme to accommodate the state constraint at the edges \(\pi _{{\min }}\) and \(\pi _{{\max }}\). We leave this straightforward modification to the reader as well.
Since (73) is explicit, the scheme is only convergent under the following CFL condition derived from verifying the monotonicity condition.
Note that when other combinations of the forward and backward Finite Differences arise at the minimum, we need to modify (75) accordingly. Since these changes are straightforward, we leave them to the reader.
Rights and permissions
About this article
Cite this article
Li, Z., Tourin, A. A Finite Difference Scheme for Pairs Trading with Transaction Costs. Comput Econ 60, 601–632 (2022). https://doi.org/10.1007/s10614-021-10159-w
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10614-021-10159-w