Challenges of Agentic Trading
Agentic trading is the process of using LLM agents to perform investment decisions at the stock market. This is the story of the challenges I faced building such a system
Over the past two months I built Cocaine.Casino, a trading bot based on multiple LangGraph agents with the goal of combining the speed of algo-trading with the precision of fundamentals-investing. With the bot having finally reached a state where I trust and use it on a daily basis, I thought it might be a good idea to reflect on the challenges I faced – so that you can build something even better!
How does it work?
The bot is built around company-specific news events and official filings whose publication often leads to changes in company valuation as a direct response to them. Sources include a real-time news aggregator like newsapi.ai and a scraper of SEC EDGAR. You could add as many sources as you like to this initial step, if you believe that they are likely to emit market-moving news. All news events are standardized and subsequently deduplicated by using language-neutral embeddings.

Even though a news event is recent and unique it does not mean it contains information that can directly impact the valuation of a company. Therefore news events are passed to a fast, small LLM to quickly classify the event as potentially impactful or irrelevant. You would be surprised to see how much of what we call breaking news is merely a repackaging of yesterday's news.
Once a potentially market-moving news event is found a list of tradable securities impacted by the event is determined by a LangGraph agent with access to a market-data provider like EODHD and web search capabilities. By having access to a stock-screener API like the one by EODHD the agent can translate news that may have a sector-wide impact into a list of most likely affected constituents.
On each discovered instrument the expected impact of the news event on its valuation is then performed. For this analysis to be grounded in hard facts it needs access to recent pricing data, news coverage, fundamentals data and the ability to perform calculations and data analysis. This is achieved by giving a LangGraph agent access to a market-data provider, web search, news search and the ability to run python code. The result of the analysis is firstly a decision on whether or not the expected impact is significant, e.g. greater than one percent. Secondly it is a decision on the confidence in the predicted impact. Finally, if an impact is considered significant and there is high confidence in it, the result includes a likely upper ceiling for the absolute change in valuation and direction.
{
"direction": "short",
"estimated_change_pct": -2.2,
"exchange": "XETRA",
"symbol": "MTE",
"type": "stop_order_intent"
}
The Challenges
The challenges to overcome in order for a bot like this to work reliably are quite diverse. It turns out that optimizations had to be made across the entire pipeline in order for the bot to deliver valuable recommendations in a reliable manner while keeping costs from getting out of hand.
News Recency
In stock trading nothing is more valuable than information. Those who have it first stand to gain the most. That is why obvious insider-trading is usually strictly regulated and subject to early disclosure. In the absence of insider-knowledge news events and official filings are usually how the broad market acquires the information it needs to arrive at a valuation for a company. The distribution of news however does not happen at the same speed for all market actors. Actors with direct access to news agencies have an edge over subscribers of premium news feeds by Bloomberg and LSEG who in turn have an edge over consumers of major public news outlets like Reuters, Financial Times and the Wall Street Journal. Building a custom news scraper on such public news outlets will thus never give you access to market moving information in time. Instead it will make you show up between one and two hours late to the party. Paying for a true real-time news aggregator is thus the best way for the average market actor to ensure that they have a chance at responding in time to new information.
Token Burn
Although an obvious factor it should be mentioned nonetheless: token burn. A common problem for unconstrained LLM agents is that they are blind to the amount of tokens they use and thus the costs they ramp up to complete a task. Even though giving an agent more freedom will allow it to behave more intelligently it will also come at a great cost. Whenever a task can thus be represented in the form of a structured graph like a workflow in LangGraph you should make use of it instead of spending excessive time on prompt engineering.
Notification Delivery
As already mentioned earlier your trading bot will never be the first one to receive a valuable bit of information. Every second you can thus skim from the time it takes your bot to turn a news event into an actionable recommendation sitting in front of you is an advantage. The two most common ways to deliver notifications are as of now email and messenger apps. Even though email is great due to its universal compatibility it can not compete with the speed of messengers like Telegram and Whatsapp.
People
You may have realized that Cocaine.Casino is not a true trading bot in the sense that it does not execute trades by itself. Instead it sends recommendations to the trader who is then responsible for making the final trade. This is done on purpose due to a major limiting factor of trading bots: their lack of empathy. People do not interpret news events in an isolated fashion. Instead their interpretation will be guided in part by their current believes in the future and what they perceive their peers' believes to be. A negative news event will be judged less negatively in a highly optimistic environment while a positive news event will be judged less positively in a highly depressed environment. Ignoring human intuition while trading with humans will lead to a trade bot that remains consistently removed from reality.
ETFs
This is a controversial one but may get worse over the next few years: the popularity of ETFs. More and more people are no longer taking the time to participate in the trading of individual stocks but instead place their money in index-backed investment funds. This may lead to more aggressive but less regular revaluations of individual companies [1] and a reduction in informational efficiency [2]. We are thus faced with a strange contradiction: information distribution is becoming more efficient while such information's impact on the market is becoming less efficient.
Trade On
Our markets may be becoming less efficient and the playing field around information may not be a plain one. The rise of agentic trading however is a great new way to combine the speed of algo-trading with the precision of a thorough fundamental analysis. If you are interested in building your own agentic trading pipeline, you are welcome to use the public cocaine-casino-public repo on GitHub as a basis or inspiration.