Udemy
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Build an AI Trading Bot with Python, Claude and Alpaca
New
2 students

Build an AI Trading Bot with Python, Claude and Alpaca

Python indicators, Claude decisions, risk rules and real Alpaca paper orders — built step by step and tested honestly.
Last updated 11/2026
English

What you'll learn

  • Build a complete trading bot in Python that reads market data, asks Claude for a decision and places orders on Alpaca
  • Compute SMA, RSI, MACD and Bollinger Bands from scratch and combine them into an explicit trading rule
  • Backtest a strategy honestly: no look-ahead bias, trading costs included, train/test split and a buy-and-hold benchmark
  • Use the Anthropic API to get structured BUY/SELL/HOLD decisions from Claude, with safe fallbacks on every error
  • Understand why an AI model cannot be backtested like a rule, and run a fair forward test instead
  • Size every position from the risk you accept (the 1% rule) and protect it with stop-loss and take-profit levels
  • Place bracket orders on an Alpaca paper trading account and exit positions cleanly
  • Keep a trade journal, measure expectancy and decide with evidence whether your bot deserves real money

Course content

5 sections • 22 lectures • 1h 28m total length
  • Introduction — Course Introduction1:27
  • What You Will Build (and What It Will Not Do)3:33
  • Setting Up Your Environment9:02
  • Fetching Stock Market Data4:03
  • Reliable Data and the Limits of Paper Trading3:36
  • Connecting to Alpaca: Your Paper Trading Account4:36
  • Module 1 Quiz

Requirements

  • Basic Python: variables, functions and loops. No finance or AI background needed.
  • A computer (Windows, Mac or Linux) with Python 3.12
  • A free Alpaca paper trading account, available worldwide with no deposit
  • An Anthropic API key with a small amount of credit for Module 3. The course shows you how to estimate the cost before you run anything.

Description

This course contains the use of artificial intelligence.

AI trading bots that promise easy profits are everywhere. This course takes the opposite approach: you build one yourself, you run it on a real paper trading account, and you learn to test it honestly.

Most "AI trading bots" sold online are black boxes. The only reliable way to understand what an AI model adds to a trading decision is to build the whole pipeline yourself and measure it.

What you will build

A human-approved trading copilot in Python that:

  • loads market data and checks its quality before every decision

  • computes four classic indicators: SMA, RSI, MACD and Bollinger Bands

  • asks Claude, Anthropic's AI model, for a structured BUY / SELL / HOLD decision with reasons and risks

  • sizes each position from the risk you accept and vetoes unsafe trades

  • places real bracket orders (entry, stop-loss, take-profit) on your Alpaca paper trading account: virtual money, real market prices

  • logs every decision and every order, and exports evidence to evaluate the results

How the course works

Every lesson first runs on a reproducible teaching dataset, so your results match the video exactly and nothing depends on market hours or API keys. Once each piece works, you switch it to real data: real prices, your own Alpaca paper account and, if you choose, live Claude calls. The final project connects the complete bot to real market data and your Alpaca paper account.

What makes this course different

  • Honest testing first. Backtests without look-ahead bias, with trading costs, on separate training and test periods, against a buy-and-hold benchmark.

  • Claude as a decision layer, evaluated properly. You will see why historical backtests of a language model are biased, and how to compare Claude fairly with a simple rule.

  • Risk management before strategy. The 1% rule, a maximum position size, a daily loss limit and a cap on entries protect the account from day one.

  • 100% paper trading. Nothing in this course requires risking a single dollar.

What you get

  • 5 modules and 22 video lessons

  • a Jupyter notebook, a Python script and a Word study guide for every practical lesson

  • quizzes and practical checkpoints

  • the complete final project: Python backend, local dashboard and a ready-to-use prompt to build your interface with Lovable

About your instructor

Clément Alvarez holds a Master's degree in Corporate & Market Finance from KEDGE Business School and teaches generative AI in university programs. He has built and tested his own AI trading systems, including the ones that did not work. Many of the lessons in this course come from those.

Disclaimer: This course is for educational purposes only and is not financial advice. No strategy shown in this course is guaranteed to make money, and past performance does not predict future results. All exercises use paper trading; any decision to trade real money is yours alone.

Who this course is for:

  • Python learners who want a real, end-to-end project combining finance and AI
  • Retail investors curious about algorithmic trading who want to understand it before risking money
  • Developers who want to use Claude or other AI models in a real decision pipeline, with safeguards
  • Finance students and professionals who want hands-on practice in backtesting and risk management
  • Not for you if you are looking for a ready-made money machine. This course will teach you to be skeptical of those.