WA

whchien/ai-trader

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

1124 stars 145 forks 品質 72 トレンド 24GPL-3.0

whchien/ai-traderは、[[T0]からインポートされたMCPサーバー候補です。

概要

whchien/ai-traderは、[[T0]からインポートされたMCPサーバー候補です。

概要(AI 翻訳)

中文版說明(中国語サブページ)

Backtraderを基に構築された、アルゴリズム取引のためのプロフェッショナルで設定駆動型のバックテストフレームワークです。株式、暗号資産、外国為替市場で大規模言語モデル(LLM)を使って、取引戦略をシームレスにテスト、最適化、統合できます。

主な特徴

  • 設定駆動型ワークフロー:バージョン制御可能なYAMLファイルでバックテストを定義・管理し、再現可能な結果を実現します。
  • シームレスなLLM統合:組み込みのMCP(モデルコンテキストプロトコル)サーバーにより、ClaudeのようなAIアシスタントがバックテストを実行し、データを取得し、戦略を分析できます。
  • マルチマーケットサポート:米国株、台湾株、暗号通貨、外国為替の戦略を試す。
  • 豊富な戦略ライブラリ:クラシックな指標から高度な適応モデルまで、20以上の組み込み戦略が搭載されています。
  • 強力なCLI:バックテストを実行し、市場データの取得、戦略をリストアップするための豊富なコマンドラインインターフェース。
  • 開発者に優しい:シンプルなヘルパーと明確な構造でカスタム戦略を簡単に作成・テストできます。

クイックスタート

1.設置

オプションA:PyPIからのインストール(CLI使用推奨)

もしよければ、これを使えば:

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。

AI-Trader

中文版說明 (Chinese Subpage)

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!)
GitHub で README 全文を見る

インストール

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" } } }