Skip to content
All library documents

Bull and Bear AI Debate for Daily Large-Cap Stock Selection

Article Lumibot

Summary

This example describes a daily stock selection process in which a research agent ranks large US stocks using recent prices, trends, and news. Bull and bear agents assess the same research from opposing perspectives, then a judge and trading agent select the debate winners, allocate the account among them, and sell stocks that lose. The workflow uses AI prompts as its decision logic and is presented as a backtestable LumiBot strategy.

The document reports a short backtest using daily Yahoo prices from January 5 to 16, 2026, with a $100,000 starting balance. It says the strategy rotated among seven named stocks, finished at $99,691, and trailed SPY, which rose 1%; cash remained above $539. These results cover only a short period and do not establish future performance. The page also notes that AI calls incur costs and distinguishes backtest configuration from live trading setup.

Key ideas

  • A research agent ranks large US stocks using recent price behavior, trends, and news.
  • Bull and bear agents argue opposing cases from the same research before a judge selects trades.
  • The bot reallocates among selected stocks and repeats the process daily.
  • The reported short backtest lost value while SPY gained, so the example does not show outperformance.
  • AI calls add costs, and the document cautions that a short backtest cannot promise future returns.

Tags

Full text
# agents example bull vs bear ai stock trading bot


Bull vs Bear AI Stock Trading Bot
=================================

.. meta::
   :description: A bull AI and a bear AI argue about each big stock, then a judge AI makes the trade. Free Python code you can backtest in LumiBot.

.. image:: ../docs/assets/ai-agent-workflows/bull-vs-bear-ai-stock-trading-bot.png
   :alt: Research agent ranks the biggest stocks, bull and bear agents argue, judge and trader picks the winners, then the trade order
   :width: 100%

Before this bot puts money into a stock, two AI agents argue about it. A bull agent makes the case for buying and a bear agent makes the case against. A judge agent weighs both sides and trades. Why debate? In the TradingAgents research paper, AI agents that argued bull and bear cases before trading beat simpler baselines on returns, Sharpe ratio, and drawdown (`Xiao et al., 2024 <https://arxiv.org/abs/2412.20138>`__).

How it works
------------

1. **Research agent** ranks 13 of the biggest US stocks, like Apple, Microsoft, and Nvidia, from recent prices, trends, and news.
2. **Bull agent** and **bear agent** read the same research and argue at the same time: one for buying, one about the risks.
3. **Judge and trading agent** weighs both sides, picks the stocks that win the debate, and splits the account across them. It sells stocks that lost the debate. The bot repeats this once a day.

Run it on BotSpot
-----------------

Run this bot on `BotSpot <https://botspot.trade/marketplace?utm_source=documentation&utm_medium=docs&utm_campaign=lumibot_ai_examples&utm_content=agents_example_bull_vs_bear_ai_stock_trading_bot>`_ without installing anything. BotSpot runs LumiBot in the cloud, backtests it, and connects it to your broker.

Backtest tear sheet
-------------------

GPT-6 Luna, January 5 to 16, 2026, Yahoo daily prices, $100,000 start. The debate rotated between AMZN, GOOGL, JPM, LLY, NVDA, V, and XOM, and the bot ended at $99,691 (-0.3%) while SPY rose 1%. Cash never went below $539.

.. image:: ../docs/assets/ai-bot-backtests/bull-vs-bear-ai-stock-trading-bot.png
   :alt: Backtest tear sheet for the Bull vs Bear AI Stock Trading Bot
   :width: 100%
   :target: tearsheets/bull-vs-bear-ai-stock-trading-bot.html

`Open the full tear sheet <tearsheets/bull-vs-bear-ai-stock-trading-bot.html>`__. A short backtest shows the bot works as written. It is not a promise of future returns.

The code
--------

The whole bot is one short file. The prompts are plain English, and they are the strategy.

.. literalinclude:: ../lumibot/example_strategies/ai_trading_team_bull_bear_large_cap_stocks.py
   :language: python

Run it yourself
---------------

.. code-block:: bash

   pip install lumibot
   python -m lumibot.example_strategies.ai_trading_team_bull_bear_large_cap_stocks

Put these in your ``.env`` file: ``OPENAI_API_KEY``, and your broker keys (for example ``ALPACA_API_KEY``, ``ALPACA_API_SECRET``, and ``ALPACA_IS_PAPER=true`` for paper trading). With ``IS_BACKTESTING=false`` the bot trades. With ``IS_BACKTESTING=true`` it backtests instead; set ``BACKTESTING_START`` and ``BACKTESTING_END`` to pick the dates, and start with a week or two, because every AI call costs a little.

See :doc:`agents_examples` for more AI trading bots and :doc:`strategy_run_modes` for backtest and live runs.

Shown in full with attribution under the source's licence. Licence: GPL-3.0

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.