In this video, I build a live crypto trading bot using Python and Rust, connected to the Alpaca API for paper trading. You’ll learn how algorithmic trading systems process real-time market data, execute trades, and manage risk automatically.
This is Episode 5 of From Quant to AI Trading —
a free Python and Rust trading bot course that
takes you from backtesting all the way to live
automated trading on Alpaca paper trading.
The system runs as two separate processes. Python
connects to Alpaca WebSocket, aggregates one-minute
bars into four-hour candles, computes EMA 200, MACD,
and RSI incrementally, and fires signals over a TCP
socket. Rust receives those signals, applies 25%
position sizing and 5% stop-loss risk management,
and executes real market orders on Alpaca paper
trading automatically.
This is the same triple-condition strategy we
backtested in Episodes 3 and 4 — now running live.
What you will learn in this Python Rust trading
bot tutorial:
→ Why two-process architecture beats a single bot
→ How to aggregate 1-min bars into 4H candles in Python
→ How to build incremental EMA, MACD, RSI from scratch
→ How to send signals from Python to Rust over TCP socket
→ How to set up Alpaca paper trading API keys safely
→ How to implement risk.rs — Side enum, Action enum, stop-loss
→ How to implement executor.rs — Alpaca REST market orders
→ How to wire everything in main.rs — the async orchestrator
→ How to run both processes and confirm orders on Alpaca dashboard
Tech stack:
🐍 Python — websockets, ta, asyncio, TCP socket
⚙️ Rust — tokio, reqwest, serde, dotenvy, tracing
📈 Alpaca — paper trading REST API + WebSocket
⚠ DISCLAIMER: This video uses Alpaca PAPER TRADING
only. No real money is involved. Paper trading uses
real market prices against a simulated balance.
Nothing in this video constitutes financial advice.
📚 Full Course Playlist → https://youtube.com/playlist?list=PLJ2t0Ss2gijQqP85s_oSMXqGqf5H1WxAa&si=2mwbr0TSkptjYs7K
💻 Full code → https://github.com/icusrid/quant-course
🛠️ Solana trading bots → chaincircle.xyz/marketplace
🐦 X → @_ChainCircle
This series covers:
📘 Module 1 — Quant Trading Foundations
📗 Module 2 — Indicators, Backtesting & Risk Management
📙 Module 3 — Algorithmic Trading & Bot Building
📕 Module 4 — Solana & DeFi Quant Trading
📔 Module 5 — AI Trading Systems
New episodes weekly. Subscribe and turn on
notifications so you never miss a release.
#pythonbot #rustbot #algotrading #alpaca
#cryptotradingbot #papertrading #quanttrading