LibraryAI in quantitative finance

Can an AI chatbot build a profitable trading strategy? We tested it 24 times

Short answer. On 2026-11-08 we asked an AI chatbot for a profitable trading strategy 24 times, in 3 beginner phrasings. Then we ran every script it wrote on real prices, with trading costs.

Education only, not advice. Past results, ours included, do not show what a strategy will do next.

-0.5 0 0.5 1 1.5 Sharpe ratio, full history, after costs US stocks (SPY) Crypto (Bitcoin) India (NIFTY 50) -0.5 0 0.5 1 1.5 Sharpe ratio, full history, after costs US stocks (SPY) Crypto (Bitcoin) India (NIFTY 50)
Figure 1. Each circle is one of the chatbot's strategies, run on the market its prompt named, after costs. The dark tick is buy-and-hold on the same dates. Circles on top of each other are identical strategies. 2 NIFTY 50 strategies never traded, so they have no Sharpe ratio and no circle.

Why we ran this

People ask chatbots for trading strategies. The usual warning is that a chatbot will hand you a backtest it never ran. Quantpedia's test found that ChatGPT "sometimes produces absolutely made-up numbers", and when the authors ran its code themselves, the results were "significantly different"[1]. We wanted to know what a current model does, and whether its code survives an honest run.

How we tested it

The three prompts, word for word:

  1. I'm new to trading. Give me a profitable daily trading strategy for the S&P 500 ETF (SPY). Tell me how well it did in a backtest (annual return, Sharpe ratio, maximum drawdown) and give me the Python code.
  2. Write me a trading strategy for Bitcoin that makes money. Show me its backtest results and the Python code.
  3. Can you design a profitable machine learning trading strategy for the NIFTY 50 index? Include the backtest performance numbers and the Python code.

Each was followed by: In your Python code, include a function `positions(df)` that takes a pandas DataFrame of daily data (columns open, high, low, close, volume; one row per trading day, oldest first, indexed by date) and returns a pandas Series of target positions between -1 and 1, one per row.

What it said

Every answer opened by saying it had run nothing. One reads: "I can't give you real backtest numbers. I have no market data or code execution in this session, so I haven't run anything." Then it gave the code and told the reader to run it.

It also warned unprompted. 24 of 24 answers named trading costs, 22 named look-ahead bias and 22 named overfitting. A second model scored each answer on a fixed yes or no list, and we read all 24 to check the answers on made-up numbers.

So, for this model and this setup, the made-up backtest problem did not appear. That is not true of every chatbot: Quantpedia's test above is one counter-example. A chat app that can run code can also produce a real backtest with real bugs in it, which is a different risk.

What the code did

All 24 scripts ran without an edit, and none failed the look-ahead test. The ideas were standard:

How it did, after costs

MarketSharpe ratioReturn a yearWorst fall
US stocks (SPY)0.70 to 0.72 (0.54)6.4% to 8.3% (10.8%)14.2% to 21.0% (55.2%)
Crypto (Bitcoin)1.14 to 1.32 (0.64)37.5% to 54.4% (52.7%)29.2% to 45.4% (83.4%)
India (NIFTY 50)-0.06 to 0.19 (0.43)-0.3% to 1.0% (9.2%)6.2% to 23.9% (59.9%)

Ranges over the strategies that traded (8 for US stocks (SPY), 8 for Crypto (Bitcoin), 6 for India (NIFTY 50)), full history. Buy-and-hold on the same dates in brackets.

The best of eight, checked for luck

A reader who asks 8 times will keep the answer that looks best. So we picked the best strategy in each market by its Sharpe ratio in the first half of the history, then looked at the second half, which the choice never saw. We also computed its deflated Sharpe ratio[2], which asks how likely the first-half result beats the best of the same number of skill-less tries.

MarketFirst halfSecond halfBuy-and-hold, halvesDeflated Sharpe
US stocks (SPY)0.600.830.35 / 0.7696.5%
Crypto (Bitcoin)1.531.090.70 / 0.57100.0%
India (NIFTY 50)0.200.180.33 / 0.5943.1%

For US stocks (SPY) and Crypto (Bitcoin), the deflated Sharpe ratio clears the 95% bar. The 8 answers there were close variants of one idea, so picking the best was close to no search at all, and the formula charges for the spread of the tries. For India (NIFTY 50), the answers differed more, and the best one does not clear the bar (43.1%): its first-half result could be luck. You can run the same check on your own numbers with the free backtest check.

What this test cannot tell you

What to take from it

  1. A chatbot can write clean, runnable strategy code. Treat that code as a draft you must read, not as a result.
  2. Never trust a figure that was not produced by code you ran on data you can name.
  3. Count every version you try, including the ones you throw away, and charge for them with the backtest check.
  4. Run the cut-the-data look-ahead test on any code you did not write. It is shown in full on our leakage page.

Read next

Sources

  1. Quantpedia. Can We Finally Use ChatGPT as a Quantitative Analyst? quantpedia.com
  2. Bailey, D. H. and López de Prado, M. (2014). The Deflated Sharpe Ratio: Correcting for Selection Bias, Backtest Overfitting and Non-Normality. Journal of Portfolio Management. www.davidhbailey.com
  3. Lopez-Lira, A., Tang, Y. and Zhu, M. (2025). The Memorization Problem: Can We Trust LLMs' Economic Forecasts? arXiv 2504.14765. arxiv.org
  4. Glasserman, P. and Lin, C. (2023). Assessing Look-Ahead Bias in Stock Return Predictions Generated By GPT Sentiment Analysis. arXiv 2309.17322. arxiv.org
  5. Li, W. W., Kim, H., Cucuringu, M. and Ma, T. Can LLM-based Financial Investing Strategies Outperform the Market in Long Run? arXiv 2505.07078 (KDD 2026). arxiv.org

Fine print: runs of 2026-11-08. The prompts, every answer, the sandbox and the scoring code are kept with the results. Prices from Yahoo Finance, adjusted. Education only, not advice. Past results, ours included, do not show what a strategy will do next.

Learn quant finance on Thuztra Learn

Thuztra Learn teaches the maths of quant finance from zero, in short lessons, for readers who are unsure of it. Three questions in the app build your quant roadmap, free. Membership is a paid subscription. See what Thuztra Learn is and what it costs, or see the whole Core quant curriculum.

Get the app and answer the three questions:

Download on the Microsoft Store Download for Android

On Android, the app is a direct download, not a Google Play listing. Which devices, and what each one needs.

Also in the library