Bull vs Bear AI Stock Trading Bot

Research agent ranks the biggest stocks, bull and bear agents argue, judge and trader picks the winners, then the trade order

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).

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 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.

Backtest tear sheet for the Bull vs Bear AI Stock Trading Bot

Open the full tear sheet. 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.

"""Bull vs Bear AI Stock Trading Bot.

Two AI agents argue about the biggest US stocks before any money moves. A
research agent ranks the stocks. A bull agent makes the case for buying and a
bear agent makes the case against, at the same time. A judge agent weighs both
sides and splits the account across the stocks that win the debate.
"""

from lumibot.strategies import Strategy


class AITradingTeamBullBearLargeCapStocksStrategy(Strategy):
    parameters = {
        "universe": ["AAPL", "MSFT", "NVDA", "AMZN", "META", "GOOGL", "TSLA", "AVGO", "COST", "JPM", "V", "LLY", "XOM"]
    }

    def initialize(self):
        self.sleeptime = "1D"
        self.agents.create(
            name="researcher",
            allow_trading=False,
            system_prompt=("Rank the stocks in the universe from recent prices, trends, and news. Do not trade."),
        )
        self.agents.create(
            name="bull",
            allow_trading=False,
            system_prompt=("Argue for buying the strongest stocks. Do not trade."),
        )
        self.agents.create(
            name="bear",
            allow_trading=False,
            system_prompt=("Argue the biggest risks in each stock. Do not trade."),
        )
        self.agents.create(
            name="trader",
            allow_trading=True,
            system_prompt=(
                "You are the judge. Weigh the bull and bear cases, pick the stocks that win the debate, and "
                "split the account across them. Sell the stocks that lose."
            ),
        )

    def on_trading_iteration(self):
        facts = {"universe": self.parameters["universe"]}
        research = self.agents["researcher"].run(task_prompt="Rank the stocks.", context=facts)
        facts = {**facts, "research": research.summary}
        debate = self.agents.run_together(
            [("bull", "Make the bull case.", facts), ("bear", "Make the bear case.", facts)]
        )
        self.agents["trader"].run(
            task_prompt="Judge the debate and rebalance.",
            context={**facts, "bull": debate["bull"].summary, "bear": debate["bear"].summary},
        )


if __name__ == "__main__":
    from lumibot.credentials import IS_BACKTESTING

    if IS_BACKTESTING:
        from lumibot.backtesting import YahooDataBacktesting

        AITradingTeamBullBearLargeCapStocksStrategy.backtest(YahooDataBacktesting)
    else:
        AITradingTeamBullBearLargeCapStocksStrategy().run_live()

Run it yourself

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 AI Trading Bot Examples for more AI trading bots and Backtest, paper, or live: choose the runner for backtest and live runs.