Robust time to buy and sell stock
DOI:
https://doi.org/10.17721/2706-9699.2025.1.08Keywords:
stock trading, robust optimization, dynamic programming, regret minimization, combinatorial optimizationAbstract
This paper focuses on the robust version of the classical algorithmic problem of finding the best time to buy and sell stock. We consider its variants with different transaction limits, as well as other modifications like transaction fee or cooldown. We reduce each classical problem to its robust version, thereby obtaining lower bounds on the time complexity of all potential solutions. We extensively test all developed methods on random and adversarial data to ensure correctness and evaluate performance. We propose efficient methods for the robust counterparts of almost all problems. We also discuss suboptimal polynomial method based on dynamic programming techniques for the limited number of transactions. Developed methods are valuable in the practical applications of stock trading to obtain a minimum regret solution and evaluate the regret of an existing solution. We expect these applications of dynamic programming techniques to robust optimization problems to be relatively easy to extend and generalize for similar issues in combinatorial optimization.
References
Bianchi S., Pantanella A., Pianese A. Modeling stock prices by multifractional Brownian motion: an improved estimation of the pointwise regularity. Quantitative Finance. 2013. Vol. 13, No. 8. P. 1317–1330.
Chernov M., Gallant A.R., Ghysels E., Tauchen G. Alternative models for stock price dynamics. Journal of Econometrics. 2003. Vol. 116, No. 1–2. P. 225–257.
Mondal P., Shit L., Goswami S. Study of effectiveness of time series modeling (ARIMA) in forecasting stock prices. Int. J. Comput. Sci., Eng. and Applications. 2014. Vol. 4, No. 2. P. 13.
Jarrett J.E., Kyper E. ARIMA modeling with intervention to forecast and analyze Chinese stock prices. Int. J. Eng. Bus. Manag.. 2011. Vol. 3, No. 3. P. 53–58.
Kim T., Kim H.Y. Forecasting stock prices with a feature fusion LSTM-CNN model using different representations of the same data. PLoS ONE. 2019. Vol. 14. No. 2. e0212320.
Tsantekidis A., Passalis N., Tefas A., Kanniainen J., Gabbouj M., Iosifidis A. Forecasting stock prices from the limit order book using convolutional neural networks. In: Proc. IEEE 19th Conf. on Business Informatics (CBI). 2017. Vol. 1. P. 7–12.
Wu X., Chen H., Wang J., Troiano L., Loia V., Fujita H. Adaptive stock trading strategies with deep reinforcement learning methods. Information Sciences. 2020. Vol. 538. P. 142–158.
Nuij W., Milea V., Hogenboom F., Frasincar F., Kaymak U. An automated framework for incorporating news into stock trading strategies. IEEE Trans. Knowl. Data Eng.. 2013. Vol. 26, No. 4. P. 823–835.
Fifield S.G.M., Power D.M., Sinclair C. D. An analysis of trading strategies in eleven European stock markets. Eur. J. Finance. 2005. Vol. 11, No. 6. P. 531–548.
Vijh A.M. S&P 500 trading strategies and stock betas. Rev. Financ. Stud.. 1994. Vol. 7, No. 1. P. 215–251.
LeetCode. Best Time to Buy and Sell Stock with One Transaction. 2014. https://leetcode.com/problems/best-time-to-buy-and-sell-stock/. Accessed: 2023-03-21.
LeetCode. Best Time to Buy and Sell Stock with Unlimited Transactions. 2014. https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/. Accessed: 2023-03-21.
LeetCode. Best Time to Buy and Sell Stock with Two Transactions. 2014. https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii/. Accessed: 2023-03-21.
LeetCode. Best Time to Buy and Sell Stock with Limited Transactions. 2015. https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iv/. Accessed: 2023-03-21.
LeetCode. Best Time to Buy and Sell Stock with Cooldown. 2016. https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-cooldown/. Accessed: 2023-03-21.
LeetCode. Best Time to Buy and Sell Stock with Transaction Fee. 2017. https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee/. Accessed: 2023-03-21.