Skip to main content

Trade Compass Agent(交易罗盘)

Python 3.12+ FastAPI React License: MIT PyPI CI

简体中文 | English

一个专为 A 股市场打造的本地优先 AI 投研工作台。

Trade Compass Agent(交易罗盘)将行情数据、技术面与基本面分析、专业 Agent、模拟组合、自动化工作流和长期记忆整合在一个 Web 与 CLI 应用中。你可以用它研究股票、制定交易计划、跟踪信号、复盘决策,并将自己的投研方法沉淀为一套可重复执行的工作流。

交易罗盘 Web 工作台

快速开始

环境要求

  • macOS 或 Linux
  • 远程模型服务的 API Key,或本地运行的 Ollama / LM Studio

推荐使用一键安装器。它会在需要时安装固定版本的 uv,再把正式包安装到隔离环境中:

curl -fsSL https://github.com/AdenChenCoder/trade-compass-agent/releases/latest/download/install.sh | sh

如果已经安装 uv,也可以直接从 PyPI 正式包安装:

uv tool install --python 3.12 trade-compass-agent

安装完成后运行:

trade-compass setup
trade-compass doctor
trade-compass serve --open

首次设置会创建本地配置并引导选择模型与数据源;后续可用 trade-compass configure 调整。安装器不会自动启动设置,也不会修改已有配置。 完整说明见快速上手和配置。

打开 http://127.0.0.1:19704/agent,即可开始对话。

结合价格结构、基本面、近期公告和市场环境分析 600519,
给出核心驱动因素、主要风险和交易计划。

产品特性

AI 驱动的市场研究

Agent 可以获取行情、计算技术指标、检查基本面与公司公告、搜索资讯和研究资料、分析资金流,并将不同来源的信息汇总为一份完整结论。

专业 Agent 团队

将不同研究任务交给内置的专业角色:

  • 日内技术分析 — 短周期价格结构与技术信号
  • 个股研究 — 基本面、研究资料、多空辩论与投资经理综合判断
  • 宏观情绪 — 宏观环境、市场情绪与资金流
  • 智能筛选 — 对量化筛选候选进行 AI 复核
  • 产业链卡点分析 — 识别供应链瓶颈与关键上游公司
  • 组合风控 — 分析敞口、集中度、回撤与组合风险

A 股市场工具箱

  • 日线与分钟线行情,并支持可替换的数据源
  • MA、MACD、RSI、布林带、ATR 等技术指标
  • 市场脉搏、板块强度、资金流、基本面、公司公告和资讯
  • A 股交易单位、T+0/T+1、不同板块涨跌停、费用与滑点
  • 内置 AkShare 与 Baostock,可选接入 Tushare 和巨潮资讯

模拟组合与信号跟踪

创建多个模拟账户,记录模拟交易,分析持仓和盈亏,检查组合集中度,并在 1、3、5 个交易日后评估信号表现。

自动化研究工作流

按需运行或定时执行完整投研流程:

  • 盘前简报与早盘计划
  • 股票筛选与想法生成
  • 日内技术与个股研究
  • 催化日历与收盘检查
  • 日终复盘与周度复盘

可扩展 Skills

内置 Skills 提供催化日历、想法生成、日内技术和投资大师方法等研究能力。 你也可以添加自己的 Skill,将个人投研流程和输出规范交给 Agent 重复执行。

记忆、规则与复盘

交易罗盘会在本地保存会话、研究笔记、用户规则、历史决策和复盘记录。记忆搜索、反思、矛盾检测和决策调和可以将有效上下文带入后续研究。

Web、CLI、API 与外部集成

通过 React 工作台交互,使用 CLI 自动化任务,基于 FastAPI API 扩展应用,连接 MCP 工具,并通过飞书、企业微信、微信或通用 Webhook 接收通知。

工作方式

flowchart LR
    U["Web / CLI / API"] --> A["交易罗盘 Agent"]
    A --> T["行情与研究工具"]
    A --> S["专业 Agent"]
    T --> P["交易计划与信号"]
    S --> P
    P --> F["模拟组合"]
    F --> R["复盘与记忆"]
    J["定时工作流"] --> A

使用方式

Web 工作台

trade-compass serve

Web UI 集中提供 Agent 对话、历史会话、模拟组合、记忆、审计记录、用户规则、Skills、定时任务和设置。交互式 API 文档位于 http://127.0.0.1:19704/docs。

不启动后台定时任务:

trade-compass serve --no-scheduler

CLI

# 向 Agent 提问
trade-compass agent "今天 A 股市场怎么样?"

# 检查市场数据
trade-compass market-pulse
trade-compass data check 600519 510300

# 查看定时任务、规则和研究记录
trade-compass jobs list
trade-compass rules list
trade-compass audit recent --limit 20
trade-compass evaluate --limit 100

运行 trade-compass --help 可以查看全部命令。

作为本地服务运行

trade-compass service install
trade-compass service status
trade-compass service verify

配置

日常设置通过配置向导管理,无需手动修改配置文件:

trade-compass configure

正式包和用户数据彼此分离。用下面的命令查看本机实际安装路径,不必猜测 不同系统上的 uv 目录:

uv tool list --show-paths
uv tool dir
uv tool dir --bin
内容 默认位置或查看方式
trade-compass 命令 uv tool dir --bin
隔离的正式包环境 uv tool dir / uv tool list --show-paths
应用主目录 ~/.trade-compass/,可由 TRADE_COMPASS_HOME 覆盖
配置与密钥 ~/.trade-compass/config.yaml、~/.trade-compass/.env
数据与记忆 ~/.trade-compass/data/、~/.trade-compass/memory_vault/
备份 ~/.trade-compass/backups/

密钥不应写入配置文件或提交到 Git。完整的路径覆盖规则、服务定义和日志位置 见配置。

支持的 LLM 提供商包括 DeepSeek、OpenAI、Anthropic、OpenRouter、DashScope、Ollama 和 LM Studio。默认依赖已包含股票分析所需的图表渲染能力;可选依赖还可以增加 Tushare、MCP 客户端、消息通道、行情预测和增强搜索能力。

例如,启用 Tushare 数据:

uv tool install --force --python 3.12 'trade-compass-agent[tushare]'

再次运行 trade-compass configure,选择自动或 Tushare 数据源 并填写 Token。

预测功能使用 Kronos 引擎,需要单独安装完整预测依赖:

uv tool install --force --python 3.12 'trade-compass-agent[forecast]'

补装依赖不会改动 ~/.trade-compass/ 下的配置、数据、规则或记忆。 安装完成后请重启 Trade Compass;首次成功预测时可能需要下载 Kronos 模型权重。 预测结果属于实验性研究辅助,不是交易信号。

文档导航

目标 文档
安装并完成首次运行 快速上手
配置模型、存储、数据源和可选功能 配置
使用和自动化命令行 CLI 参考
创建并打包运行时 Skills Skills
理解仓库和状态边界 架构
了解本地数据与外部服务边界 隐私 / 威胁模型
构建、验证和发布版本 发布

开发与贡献

uv sync --extra dev
pnpm install --frozen-lockfile

uv run trade-compass serve --dev  # API: :19704
pnpm --dir apps/web dev            # Web UI: :3000

提交 Pull Request 前运行:

scripts/ci_check.sh
pnpm --dir apps/web test
pnpm --dir apps/web typecheck
pnpm --dir apps/web build
git diff --check

社区

许可证

MIT

Metadata

Release files for trade-compass-agent 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for trade-compass-agent 0.2.2
File Size Uploaded
trade_compass_agent-0.2.2.tar.gz 1.6 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for trade-compass-agent 0.2.2
File Interpreter ABI Platform
trade_compass_agent-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 2.7 MB

Release files / trade_compass_agent-0.2.2.tar.gz

Download URL trade_compass_agent-0.2.2.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
bb84a880451658273d9a8da3603e77b6b825e57aa057af58746eea1d302a3f11
BLAKE2b-256 checksum
How to use checksums
d1c352260772675afefbc381cc33953ef92d2613916c525a2e2ffcab98d9e11c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 5, 2026.

Transparency log

Release files / trade_compass_agent-0.2.2-py3-none-any.whl

Download URL trade_compass_agent-0.2.2-py3-none-any.whl
Size 1.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
f427087efbcf2f1b5fe3830596a77fa18e42ae9b43999466aed84d57ec1af8cc
BLAKE2b-256 checksum
How to use checksums
d5c3bf23bcc48e4417558bbe983c9c9705ae3cb125c65b97f05cd727e13b934b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page