I created an AI trading agent and monitored its performance for 3 months. Here’s what it did so far

9 min read Original article ↗

Laurentiu Raducu

Press enter or click to view image in full size

Photo by Maxim Hopman on Unsplash

Lately, I’ve been feeling some serious AI fatigue. I’m getting tired of the constant stream of Twitter posts insisting I’m missing out by not jumping on the latest AI tools, which, more often than not, are just overpriced, slop-generating services. Honestly, it’s starting to feel like a bubble about to pop. It reminds me of the dot-com era, when just having a landing page could net you a $200M valuation. Today, we’re seeing startups with no real product getting valuations in the billions, it’s the same playbook, just inflated numbers.

But is AI only used for generating slop? Can it have some real use cases in, let’s say, stock picking? To find that out, I built an LLM-based agent that can trade small and mid-cap US stocks.

Before we dive in, if you prefer to watch an engaging clip rather than read, I released a YouTube video where I show how to set up the agent and what are its main functions.

The setup is pretty straightforward. First, it uses Perplexity’s API to scan the web for promising small/mid-cap stocks listed in the US. Then it pulls financial data — like the latest quarterly report, EPS, EBITDA, etc. from QuantiQ.live (a SaaS analytics platform). Finally, it feeds everything into GPT-4o, which “reasons” whether a given stock is worth buying. The agent doesn’t short; it can only buy or sell stocks it already holds. The agent can place real trades through the Alpaca API platform and it logs all transactions via YFinance into a CSV to track portfolio performance.

I also added a Streamlit GUI on top for a better user experience. The whole thing’s written in Python and super simple to run; the repo includes full instructions.

When I first ran it (about three weeks ago), it bought two stocks: Rocket Labs (RKLB) and Horizon Technology Finance Corporation (HRZN). RKLB is currently up 25%, HRZN about 4%. That might sound impressive, but with the market generally trending up, it’s too early to draw conclusions.

Here’s a screenshot from the Streamlit UI showing the portfolio’s evolution.

Press enter or click to view image in full size

22% over a month. Not bad at all

I’m planning to update this story every week with the performance of the agent’s portfolio. I’ll be running it weekly and posting updates on what it decided to invest in. Stay tuned.

Updates

It’s been a full week. I reran the agent again and it decided to invest in CRDO, a company delivering high-speed connectivity solutions. The reason why it decided to invest was that Perplexity found it interested in the context of rapid expansion of data center in the US.

I also added a step to hedge your investments. Hedging can be done through any assset: ETF, commodity, crypto, bonds, REIT, or volatility indexes. The agent also bought VIXY when I asked to hedge the current portfolio. The reason for that is because if stocks fall, VIXY grows, being inversely correlated.

Here’s a snippet of the portfolio performance. Since I added two new tickers, the performance dropped, but it’s still positive.

Press enter or click to view image in full size

22–08–2025: Alpaca Integration

In the latest update I pushed to the Git repo you can find an integration with Alpaca to buy and sell stocks. Alpaca is an API platform that allows you to trade different financial instruments, from stocks to crypto.

Since the agent is quite profitable, I decided to give it access to my Alpaca account and trade on my behalf.

Important to mention is that it uses the “paper” API by default, meaning it’s trading virtual money. However, you can set the ALPACA_PAPER env variable to False in your .env config to switch to the real API.

Here’s the first trade the agent did with Alpaca:

Press enter or click to view image in full size

Snapshot from the Agent trading its first stock with the Alpaca API

25–08–2025: Congress Trades

I have integrated a new option to get more information about particular stocks. By asking the agent the following `check house and senate trades for {ticker}`, it will call the QuantiQ.live API to get the latest Congress trades on that particular stock. Here’s an example with NVIDIA:

Press enter or click to view image in full size

30–08–2025: Technical Indicators

I have added the capability to show the most important technical indicators in fancy graphs.

To get the technical indicators for any stock, just type get technicals {ticker} and you’ll get something like this:

Press enter or click to view image in full size

Optionally, you can also supply the technicals to the analyze method, but I do not recommend that. Doing this will overload GPT-5 with so much data, that the results will most probably be influenced by hallucinations due to context overload, but it will also increase your costs quite a lot.

The best way to use this method is to do analysis yourself and check a stock by yourself before buying/selling.

16–09–2025: Google Trends, Backtesting, Portfolio Concentration and Risk Management

Huge update for our AI trading agent!

I just added the following functionalities:

  • Google Trends: getting Google keywords related to a stock and find how they are trending on the search engine. This is done through GPT-5, and the trends are retrieved using pytrends library. Just type get trends <stock> in the chat interface and you’ll get the performance of the most relevant 5 queries.

Why is this important? Because we want to predict market movements that are not priced in yet. Seeing a surge in people searching for “how to return leased cars” might mean bad news for banks or car manufacturers.

  • Backtesting: Before you buy a stock, you can now backtest using historical data. See how your investment would have performed throughout time and get the Sharpe ratio and potential return as well. Here’s how it looks like for AAPL:

Press enter or click to view image in full size

  • Portfolio Concentration: In the Portfolio Performance screen I have added a heatmap showing the portfolio concentration by sector:

Press enter or click to view image in full size

  • Risk Management: When buying a stock, you have the ability to set stop-loss and take-profit orders. Those orders are automatically created in Alpaca.

25–09–2025: Auto-pilot, Event Calendar, Macros, News, Social Sentiment

Major update just rolled out. Let’s break each feature one by one:

  • Auto-pilot: You can now give the agent total liberty to book trades on your behalf. Just type `enable auto-pilot` and it will start working. It finds first 10 small & mid-cap stocks to buy, analyzes them using the QuantiQ API, searches for congress trades for the stocks it finds, checks the news and sentiment on Reddit (specifically on r/wallstreetbets) and decides if it trades or not. Here’s a screenshot of what it did for me:

Press enter or click to view image in full size

Summary of the actions done by the agent in auto-pilot mode
  • Event Calendar: As an investor you know how important market events are. On this tab you can see the calendar for the earning dates for each stock you have in your portfolio. You can also check economic events, such as Fed Rate Decision meetings, but you would need a premium account FMP account.

Press enter or click to view image in full size

Screenshot for the newly-added event calendar
  • Macro Indicators: You probably observed in the above screenshot the new button called Macro Indicators. This is the place where you can check figures like real GDP, unemployment figures, CPI, consumer sentiment index, housing starts. To enable this in your local environment, you need to create a free account with FRED.

Press enter or click to view image in full size

Macro indicators are now visible in the Streamlit UI
  • News: Since I am trying to transform this into an intelligent investment platform, I had to add news as well. Just type `get news {ticker}` and you will get the latest news for that stock. You just need to create a free account on News API.

Press enter or click to view image in full size

How news are displayed in the Streamlit UI
  • Social Sentiment: News are great, but traditional news media outlets might not capture information that can move the markets in the near future. That is why I have added an integration with Reddit to scour subs like r/stocks, r/investing, r/wallstreetbets for tips about specific stocks. Just type get social sentiment {ticker} and you will get the latest posts about that stock. Reddit integration is a bit more complex, but here’s what you need to do:
  • Go to https://www.reddit.com/prefs/apps
  • Create a new application (select “script” type)
  • Replace the placeholder credentials in the `.env` file with your actual credentials

Press enter or click to view image in full size

Social sentiment based on Reddit posts

03–11–2025: SaaS Launched!

I’ve been busy lately brushing things up, adding Stripe integration and user management. Yep, you guessed it, I launched a SaaS based on this product, so you can use it without creating so many accounts, for just $15 per month.

You can access it here: the best investment AI agent.

You have 3 free actions once you validate your account. Auto-pilot does not work on free trial, but anything else does.

Btw, if you encounter issues, want to propose a new feature to the bot, or just want to get in touch with me, you can join my discord server: https://discord.gg/tZktXAHkev.

19–12–2025: More Asset Classes Added

I have added the possibility to trade not only stocks, but commodities, crypto and other asset classes such as bonds, ETFs or REITs, basically anything that is exchange-traded and is available in Alpaca.

When it comes to performance, as of 21st of December I have the following positions:

  • RKLB -> probably the best-performing stock. It’s up 110% since the agent last bought it in June.
  • IONS -> 9.41%
  • EBMT -> 14.82%
  • GIL -> 11.92%
  • OVLY -> 5.32%
  • TSBK -> 5.41%
  • RGCO -> 0.92%
  • ADNT -> -14.5%
  • BBWI -> -23.05%

This is the latest snapshot of the agent’s portfolio. Although it has two unprofitable positions, the rest of them were good picks, especially Rocket Labs, which has doubled since the first time it bought the stock. I am expecting it to sell the worst-performing positions, however it still believes in those due to the good financial figures reported by these companies.