by whchien
Backtrader-powered backtesting framework for algorithmic trading, featuring 20+ strategies, multi-market support, CLI tools, and an integrated MCP server for professional traders.
# Add to your Claude Code skills
git clone https://github.com/whchien/ai-traderA professional, config-driven backtesting framework for algorithmic trading, built on Backtrader. Seamlessly test, optimize, and integrate trading strategies with Large Language Models (LLMs) across stocks, crypto, and forex markets.

1. Installation
Option A: Install from PyPI (Recommended for using the CLI)
pip install ai-trader
Use this if you want to:
ai-trader run, , No comments yet. Be the first to share your thoughts!
ai-trader fetchai-trader quickOption B: Install from Source (Recommended for examples and config templates)
git clone https://github.com/whchien/ai-trader.git
cd ai-trader
pip install -e .
Use this if you want to:
config/backtest/data/scripts/examples/poetry install)2. Run a Backtest via CLI
If you cloned from source, run a predefined backtest using a configuration file:
# Run a backtest from a config file (requires source installation)
ai-trader run config/backtest/classic/sma_example.yaml
Or, run a quick backtest on any data file (works with both pip and source installation):
# Quick backtest on your own data file
ai-trader quick CrossSMAStrategy your_data.csv --cash 100000
3. Fetch Market Data
Download historical data for any supported market:
# US Stock
ai-trader fetch TSM --market us_stock --start-date 2020-01-01
# Taiwan Stock (台灣股票)
ai-trader fetch 2330 --market tw_stock --start-date 2020-01-01
# Cryptocurrency
ai-trader fetch BTC-USD --market crypto --start-date 2020-01-01
The most robust way to run backtests is with a YAML config file.
my_backtest.yaml:
broker:
cash: 1000000
commission: 0.001425
data:
file: "dat...