
whchien/ai-trader
Developer toolsЭта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал
whchien/ai-trader — это кандидат на MCP-сервер, импортированный из https://github.com/whchien/ai-trader.
Обзор
whchien/ai-trader — это кандидат на MCP-сервер, импортированный из https://github.com/whchien/ai-trader.
Обзор (машинный перевод)
中文版說明 (китайская подстраница)
Профессиональный фреймворк для обратного тестирования на основе конфигурации для алгоритмической торговли, построенный на базе Backtrader. Бесшовно тестируйте, оптимизируйте и интегрируйте торговые стратегии с Large Language Models (LLM) на рынках акций, криптовалюты и форекс.
Ключевые особенности
- Рабочие процессы, управляемые конфигурацией: Определяйте и управляйте бэктестами с использованием YAML-файлов с контролем версий для воспроизводимых результатов.
- Бесшовная интеграция с LLM: встроенный сервер MCP (Model Context Protocol) позволяет AI-ассистентам, таким как Claude, проводить обратные тесты, получать данные и анализировать стратегии.
- Многорыночная поддержка: Тестирование стратегий на акциях США, Тайваня, криптовалютах и форексе.
- Обширная библиотека стратегий: включает более 20 встроенных стратегий — от классических индикаторов до продвинутых адаптивных моделей.
- Мощный CLI: Богатый интерфейс командной строки для выполнения обратных тестов, получения рыночных данных и стратегий составления списков.
- Дружелюбно к разработчикам: Легко создавать и тестировать пользовательские стратегии с помощью простых помощников и чёткой структуры.
Быстрый старт
1. Установка
Вариант A: Установка с PyPI (рекомендуется для использования CLI)
Используйте это, если хотите:
Эта страница переведена автоматически. Технические детали смотрите в оригинале.
README
Показан фрагмент оригинального README. Открыть оригинал.
AI-Trader
A 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.
Key Features
- Config-Driven Workflows: Define and manage backtests with version-controllable YAML files for reproducible results.
- Seamless LLM Integration: Built-in MCP (Model Context Protocol) server allows AI assistants like Claude to run backtests, fetch data, and analyze strategies.
- Multi-Market Support: Test strategies on US stocks, Taiwan stocks, cryptocurrencies, and forex.
- Extensive Strategy Library: Comes with over 20 built-in strategies, from classic indicators to advanced adaptive models.
- Powerful CLI: A rich command-line interface to run backtests, fetch market data, and list strategies.
- Developer Friendly: Easily create and test custom strategies with simple helpers and a clear structure.
Quick Start
1. Installation
Option A: Install from PyPI (Recommended for using the CLI)
pip install ai-trader
Use this if you want to:
- Use the CLI commands:
ai-trader run,ai-trader fetch,ai-trader quick - Run backtests on your own data files
- Use as a library in your Python projects
Option B: Install from Source (Recommended for examples and config templates)
git clone https://github.com/whchien/ai-trader.git
cd ai-trader
# Install dependencies (choose one method)
uv sync # Recommended (fastest, modern tool)
# poetry install # Or use Poetry
# pip install -e . # Or traditional pip with editable install
Use this if you want to:
- Run the config-based examples in
config/backtest/ - Use the example data files in
data/ - Run the example scripts in
scripts/examples/ - Contribute or customize strategies
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 (default: saves to CSV)
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
# With SQLite persistent caching (NEW!)
Установка
This server does not publish a one-line install command.
Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →Конфигурация
{
"mcpServers": {
"ai-trader": {
"command": "python3",
"args": ["-m", "ai_trader.mcp"],
"cwd": "/path/to/ai-trader"
}
}
}