Directly Learning Stock Trading Strategies Through Profit Guided Loss Functions

Devroop Kar, Zimeng Lyu, Sheeraja Rajakrishnan, Hao Zhang, Alex Ororbia +2 more
7/25/2025
cs.LGcs.NE

No confident code implementation found for this paper.

Abstract

Stock trading has always been a challenging task due to the highly volatile nature of the stock market. Making sound trading decisions to generate profit is particularly difficult under such conditions. To address this, we propose four novel loss functions to drive decision-making for a portfolio of stocks. These functions account for the potential profits or losses based with respect to buying or shorting respective stocks, enabling potentially any artificial neural network to directly learn an effective trading strategy. Despite the high volatility in stock market fluctuations over time, training time-series models such as transformers on these loss functions resulted in trading strategies that generated significant profits on a portfolio of 50 different S&P 500 company stocks as compared to a benchmark reinforcment learning techniques and a baseline buy and hold method. As an example, using 2021, 2022 and 2023 as three test periods, the Crossformer model adapted with our best loss function was most consistent, resulting in returns of 51.42%, 51.04% and 48.62% respectively. In comparison, the best performing state-of-the-art reinforcement learning methods, PPO and DDPG, only delivered maximum profits of around 41%, 2.81% and 41.58% for the same periods. The code is available at https://anonymous.4open.science/r/bandit-stock-trading-58C8/README.md.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{kar2025directly,
  title  = {Directly Learning Stock Trading Strategies Through Profit Guided Loss Functions},
  author = {Devroop Kar and Zimeng Lyu and Sheeraja Rajakrishnan and Hao Zhang and Alex Ororbia and Travis Desell and Daniel Krutz},
  year   = {2025},
  eprint = {2507.19639},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2507.19639v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2507.19639.svg)](https://codeofpaper.com/paper/2507.19639)

Discussion