How to use Gemini, Claude, and OpenAI to create trading strategies that DESTROY the market.
The list of models available to create your trading strategyLarge language models have enabled a new way of interacting with the stock market, available to everybody.
Instead of spending years learning Python, object-oriented programming, connecting with APIs, and data analysis, you can spend minutes creating, testing, and deploying your algorithmic trading strategy using any large language model.
Here’s how.
What WILL NOT work: using ChatGPT by itself
Trying to use ChatGPT to create a trading strategyBefore I show you how to create strategies using any large language model, I want to clear up a common misconception.
You can't just create your trading strategies using ChatGPT.
These tools are specialized for language, but don't have any of the necessary infrastructure to test, optimize, or deploy real trading strategies to the market.
For example, if you try to ask, ChatGPT to create a trading strategy, it's simply going to give you some psuedocode which you can try to deploy yourself.
Code on how to backtest a strategyHowever, once you get to more complicated functionality, such as trying to test your strategy, you're going to run into a host of issues.
- You need to integrate with external APIs to gather accurate, historical data, including fundamentals (if your strategy needs it).
- You need infrastructure to seamlessly go from backtesting to paper trading to real-time trading. This process can take months to years to build.
- You need an easy way to modify your strategies and create additional strategies without having to write code for that too.
So, while getting started testing strategies using ChatGPT is simple, you can quickly see that this problem becomes intractable when you dig into the details.
There is a MUCH easier way.
How to ACTUALLY use these models to build trading strategies
Instead of blindly using ChatGPT, we can instead of use these APIs to help us accomplish our goal.
The multi step process for creating a strategy using large language modelsI built a platform that allows us to effortlessly build the building blocks of an algorithmic trading strategy. The way it works is a multi-step process.
- Send Chat Message: The message from the user is sent to the application
- Classify Request: From a list of different actions, such as the “Stock Screening”, “Create Strategy”, and “Analyze Fundamentals”, the model determines the most relevant action to process the request
- Forward to Prompt: We send the chat message to the most relevant prompt and get a response
- Post-Process Response: Depending on the action, we’ll perform additional actions. For example, with the “AI Stock Screener” prompt, we’ll generate a SQL query, and we’ll then in the post-process step, we’ll execute the query against the database.
When the model interprets the user to want to create trading strategies, it creates a “prompt chain”. With a prompt chain, the output of one prompt is used as the input of another.
For example, we will first create the portfolio, which includes the name, initial value, and a list of trading strategy descriptions.
Creating a portfolio using a “Prompt Chain”From these descriptions, we’ll then create an outline of each strategy. This includes a strategy name, an action (“buy” or “sell”), the asset we want to trade, an amount (for example 20% of your buying power or 10 shares), and a description of when we want to perform the action.
Creating a strategy using the prompt chainFinally, we repeat this process for the conditions, and transform the description into a condition that can be interpreted by the application.
This works with every single major large language model. The important part of this process is that the large language models are not being used to test or deploy the trading strategies. The creation process is facilitated by these models, but an entire application is needed to make use of these strategies.
Here is one application that implements this particularly well.
How to create your own algorithmic trading strategy using Claude, Gemini, or OpenAI
Creating a trading strategy using LLMsNexusTrade is a platform that brings theory into practice. It allows anybody, even absolute beginners, to create, test, and deploy their own algorithmic trading strategies.
With NexusTrade, you can use any of the major large language models to create your own trading strategy. This includes:
- OpenAI: GPT-4o-mini, GPT-4, and GPT-o1
- Anthropic: Claude 3.5 Haiku and Claude 3.5 Sonnet
- Google: Gemini 1.5 Flash and Gemini 1.5 Pro
These models have different “personalities”, and have different ways of responding to ambiguous input. For example, this is a “Breakout” trading strategy for NVIDIA that’s created with Claude 3.5 Haiku.
NVDA Breakout strategy from Claude 3.5 HaikuIntrast, here’s the same “Breakout” strategy created with Gemini 1.5 Pro.
NVDA Breakout strategy from Gemini 1.5 ProThey create different rules, and these rules result in different backtesting performance.
In addition, you don’t have to be ambiguous – you can use these models to create highly-specific trading strategies that you may have previously had to do manually.
By doing this, you can create a trading plan that outperforms the market. Here’s an example.
DESTROYING the market with your algorithmic trading strategies
My initial strategy created from the LLMBeing able to create a trading strategy is the first step.
The process of iterating, testing, and refining it is where most people mess up.
Using these LLMs, I have created a market-beating trading strategy by translating the rules that I would use for manual trading into automated trading strategies.
For example, I started with the following rules:
- Buy 35% of my buying power in TQQQ if I have no positions or my positions are down 10% and my portfolio value is less than 150% of its initial value
- Buy 35% of my buying power in BTC if I have no positions or my positions are down 15% and my portfolio value is less than 150% of its initial value
- Buy 15% of my buying power in TQQQ if I have no positions or my positions are down 10% and my portfolio value is greater than 150% of its initial value
- Buy 15% of my buying power in BTC if I have no positions or my positions are down 15% and my portfolio value is greater than 150% of its initial value
- Sell 20% of my portfolio value of TQQQ if my positions are up 12% and my portfolio value is less than 150% of its initial value and 30 days passed since the last tqqq or bitcoin sell
- Sell 20% of my portfolio value of BTC if my positions are up 20% and my portfolio value is less than 150% of its initial value and 30 days passed since the last tqqq or bitcoin sell
I then had a conversation with the AI to iteratively tweak some of the rules, try new conditions, and ultimately create new trading strategies that significantly outperforms the market.
The market-beating strategy I created with large language modelsNow granted, this strategy only does well in bullish markets. In a bearish market, such as during Covid, this type of strategy does far worse.
The performance of these strategies during CovidA strategy’s past performance is no guarantee of its future success. It is up to the trader to understand what types of strategies perform well in certain market conditions and to deploy the best strategies given the market conditions.
This isn’t just a test or a demonstration; I’ve deployed trading rules just like this to manage my actual portfolio.
Traders, even those without technical experience, can now deploy their own algorithmic trading strategies. If you need help on iteratively creating your strategy using large language models, refer to this conversation I had with Aurora.
Concluding Thoughts
The advent of large language models has fundamentally shifted the way we approach trading and finance. These models empower anyone — regardless of their coding expertise — to create, test, and deploy algorithmic trading strategies that were once only accessible to seasoned quants or institutional investors.
The examples outlined here showcase the transformative potential of these technologies. By leveraging AI tools like Claude, Gemini, and OpenAI, traders can gain a real, competitive edge. The ability to translate abstract trading rules into actionable, automated strategies democratizes algorithmic trading for everybody, including you.
Now is the time to embrace this revolution. With platforms like NexusTrade, the barriers to entry are lower than ever. Whether you’re an experienced trader or a curious beginner, the tools to create market-beating strategies are at your fingertips. The future of finance is here — are you ready to take control and transform your trading journey?
Follow me: LinkedIn | X (Twitter) | TikTok | Instagram | Newsletter