PanWatch README

The project's README from github.com/TNT-Likely/PanWatch. As one markdown file: README.md.

盯盘侠 PanWatch

自托管 AI 盯盘助手 · 集成 TradingAgents 多 Agent 投资决策 — A 股 / 港股 / 美股实时监控、持仓管理、智能分析、全渠道推送

GitHub stars Docker Pulls License: MIT Last commit PWA

盯盘侠 PanWatch · TradingAgents 深度分析演示

🧠 持仓页点一下 → TradingAgents 9-Agent 投研团队接力分析 → 看多看空辩论 → 风控审查 → PM 决策书,3-5 分钟一条完整推理链,结论直推到你的 IM。

📸 功能一览

持仓 · 多账户汇总 机会页 · AI 评分选股
持仓管理 机会页 AI 评分
模拟盘 · 净值曲线 + 绩效 个股深度详情
模拟盘 个股详情
技术指标共振 · 一眼 MACD/RSI/KDJ 价格提醒 · 条件组合触发
技术指标 价格提醒
移动端截图

📱 支持 PWA,移动端可「添加到主屏幕」当原生 App 用。

💡 如果盯盘侠对你有帮助,点右上角 ⭐ Star 支持一下 —— 这是对开源项目最好的鼓励,也能让更多人发现它。

🧠 深度分析:TradingAgents 多 Agent 决策

接入 TradingAgents(76k+ star)多 Agent 投资决策框架,在持仓页点 🧠 图标即可触发:

为什么选择盯盘侠?

核心功能

智能 Agent 系统
Agent 触发时机 功能
盘前分析 每日开盘前 综合隔夜美股、新闻消息、技术形态,给出今日操作策略
盘中监测 交易时段实时 监控异动信号,RSI/KDJ/MACD 共振时推送提醒
盘后日报 每日收盘后 复盘当日走势,分析资金流向,规划次日操作
新闻速递 定时采集 抓取财经新闻,AI 筛选与持仓相关的重要信息
专业技术分析
  • 趋势指标:MA 多空排列、MACD 金叉死叉、布林带突破
  • 动量指标:RSI 超买超卖、KDJ 钝化与背离
  • 量价分析:量比异动、缩量回调、放量突破
  • 形态识别:锤子线、吞没形态、十字星等 K 线形态
  • 支撑压力:自动计算多级支撑位和压力位
多市场 & 多账户
  • 覆盖市场:A 股、港股、美股实时行情
  • 账户管理:支持多券商账户独立管理,汇总展示总资产
  • 交易风格:按短线/波段/长线分别设置,AI 建议更精准
全渠道通知

Telegram / 企业微信 / 钉钉 / 飞书 / Bark / 自定义 Webhook

价格提醒
  • 支持价格、涨跌幅、成交额、量比等条件组合(AND / OR)
  • 支持交易时段/全天生效、冷却时间、日触发上限、重复触发模式
  • 到期时间使用弹窗内日期面板 + HH:mm 输入,留空表示永不过期
  • 可按规则选择通知渠道,不选则走系统默认渠道

快速开始

docker run -d \
  --name panwatch \
  -p 8000:8000 \
  -v panwatch_data:/app/data \
  sunxiao0721/panwatch:latest

访问 http://localhost:8000,首次使用设置账号密码即可。

说明:镜像内已包含 Playwright 运行所需的系统依赖;Chromium 浏览器会在容器首次启动时自动下载并安装到挂载卷(默认 /app/data/playwright),首次启动可能需要几分钟且需要网络可达。

如果不需要截图等浏览器能力,可以在启动容器时设置 PLAYWRIGHT_SKIP_BROWSER_INSTALL=1 跳过首次 Chromium 下载/安装。

Docker Compose
version: '3.8'
services:
  panwatch:
    image: sunxiao0721/panwatch:latest
    container_name: panwatch
    ports:
      - "8000:8000"
    volumes:
      - panwatch_data:/app/data
    restart: unless-stopped

volumes:
  panwatch_data:
docker-compose up -d
环境变量
变量名 说明 默认值
AUTH_USERNAME 预设登录用户名 首次访问时设置
AUTH_PASSWORD 预设登录密码 首次访问时设置
JWT_SECRET JWT 签名密钥 自动生成
DATA_DIR 数据存储目录 ./data
TZ 应用时区(影响 Agent 调度触发时间与时间展示) Asia/Shanghai
PLAYWRIGHT_SKIP_BROWSER_INSTALL 跳过首次 Chromium 安装(不需要截图时可用) 未设置
LOG_LEVEL 控制台日志级别。默认 INFO(只输出业务事件 + 错误);排查问题时设 DEBUG 可看到调度心跳、采集过程等底层日志。UI 日志板始终保留完整记录,不受影响 INFO
HTTP_PROXY / HTTPS_PROXY / http_proxy 出站 HTTP 代理。三种配置方式任选其一: ① 启动前 export HTTP_PROXY=...;② .env 里写 http_proxy=http://host:port;③ UI「设置 → 全局 HTTP 代理」。三者优先级:外部环境变量 > UI > .env。生效后所有 httpx 客户端走代理。NO_PROXY 默认包含 localhost,127.0.0.1 未设置
OTEL_EXPORTER_OTLP_ENDPOINT OpenTelemetry OTLP 导出端点(如 http://jaeger:4318)。配置后才启用 OTel trace 导出;留空则完全关闭(零副作用)。还需安装可选依赖 requirements-otel.txt。详见下方「OTel 导出」 未设置(关闭)
首次配置
  1. 访问 Web 界面,设置登录账号
  2. 设置 → AI 服务商:配置 OpenAI 兼容 API(支持 OpenAI / 智谱 / DeepSeek / Ollama 等)
  3. 设置 → 通知渠道:添加 Telegram 或其他推送渠道
  4. 持仓 → 添加股票:添加自选股,启用对应 Agent
本地开发

环境要求:Python 3.10+ / Node.js 18+ / pnpm

# 一键开发(推荐)
make dev-api          # 启动后端(自动 venv+依赖,监听 :8000)
make dev-web          # 启动前端(自动 pnpm install,监听 :5183)

# 或手动
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
python server.py                              # 后端 :8000

cd frontend && pnpm install && pnpm dev       # 前端 :5183

前端 dev server 跑在 http://localhost:5183,并把 /api 代理到 127.0.0.1:8000。 前端用 :5183 而非默认 :5173,是为了和 BeeCount-Cloud 等本地常驻前端错开。

技术栈

后端:FastAPI / SQLAlchemy / APScheduler / OpenAI SDK

前端:React 18 / TypeScript / Tailwind CSS / shadcn/ui

OTel 导出(可选,默认关闭)

PanWatch 内建一套自建可观测体系(结构化日志 trace_id 贯穿 / agent_runs 运行表 / TradingAgents 节点级进度与成本),开箱即用、无需任何外部组件。

在此之上,可可选地再挂一层标准 OpenTelemetry 导出,把 trace 送到 Jaeger / Tempo / Langfuse 等标准 APM。三类 span 映射:

  • Agent 一次运行 → root span(复用 agent_runs 的 trace_id 关联)
  • 单次 LLM 调用 → gen_ai 子 span,遵循 OpenTelemetry GenAI 语义约定(gen_ai.system / gen_ai.request.model / gen_ai.usage.input_tokens / gen_ai.usage.output_tokens / gen_ai.operation.name),可被标准 APM 识别为一次模型调用
  • TradingAgents 节点 → 子 span(复用节点级进度回调)

默认完全关闭:不装依赖、不配 endpoint 时,导出层全程 no-op,不改变任何现有行为。

开启三步:

# 1. 安装可选依赖
pip install -r requirements-otel.txt

# 2. 配置 OTLP 端点(指向你的 collector / APM)
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
export OTEL_SERVICE_NAME=panwatch   # 可选,默认 panwatch

# 3. 正常启动;启动日志出现 "OTel 导出已启用" 即生效
python server.py

本地起一个 Jaeger 验证:

docker run -d --name jaeger -p 16686:16686 -p 4318:4318 \
  jaegertracing/all-in-one:latest
# 触发任意 Agent 运行后,打开 http://localhost:16686 选 service=panwatch 查看 trace

Langfuse / Tempo 同理,把 OTEL_EXPORTER_OTLP_ENDPOINT 指向对应 OTLP 入口即可。

发布(Docker 镜像)

本项目内置 GitHub Actions 发布流程:

  • 打 tag(例如 0.2.3)会自动构建并推送 Docker 镜像
    • sunxiao0721/panwatch:0.2.3
    • sunxiao0721/panwatch:latest
  • 也支持在 GitHub Actions 里手动触发(workflow_dispatch)指定版本号

需要在仓库 Secrets 中配置:

  • DOCKERHUB_USERNAME
  • DOCKERHUB_TOKEN

捐赠支持

如果你觉得 PanWatch 有帮助,欢迎请作者喝杯咖啡:

微信赞赏 支付宝

贡献

欢迎提交 Issue 和 PR!自定义 Agent 和数据源开发请参考 贡献指南。 社区交流(Telegram):t.me/panwatch

License

MIT

PanWatch (TNT-Likely/PanWatch)

trading-bot
Searching Database…

What is this?PanWatch (盯盘侠) is a self-hosted AI stock-monitoring assistant covering A-share, Hong Kong and US markets: portfolio tracking, real-time alerts and automated reports, with multi-agent analysis powered by the TradingAgents framework.
Is this a hosted service I sign up for, or something I run myself?You run it yourself — deploy it via Docker Compose and use it in a browser; on mobile you can add it to the home screen as a PWA. Nothing is hosted for you.
How do I get it running?Deploy the Docker Compose stack (image sunxiao0721/panwatch), open the web UI to set a login, then in Settings pick an AI provider and a notification channel and add stocks. The README promises a 5-minute setup.
Do I need any API keys to use it?You need an OpenAI-compatible API key (OpenAI, Zhipu, DeepSeek, Ollama and more are supported) set in Settings; deepseek-chat is the default, at roughly $0.05 per analysis. For push you add a channel like Telegram, WeChat Work or DingTalk.
Anything to watch out for on the first launch?On first start the container downloads Chromium into its data volume for screenshot features, which can take a few minutes and needs network access. Set PLAYWRIGHTSKIPBROWSERINSTALL=1 if you don't need screenshots.
What happens when I trigger an AI analysis on a holding?A 9-agent TradingAgents pipeline runs: four analysts (technical, sentiment, news, fundamentals) feed a bull-vs-bear debate, then a risk-control review, then a PM decision memo. The full reasoning chain takes 3-5 minutes and the conclusion is pushed to your messenger.
Which markets and accounts does it cover?Real-time quotes for A-shares, Hong Kong and US stocks. Several broker accounts can be managed independently with combined total assets, and you can set short-term, swing or long-term trading styles so the AI advice fits your horizon.
How do price alerts work?You combine conditions (price, change %, turnover, volume ratio) with AND/OR logic, plus active hours, cooldown, daily trigger caps and optional expiry. Each rule can pick its own channel - Telegram, WeChat Work, DingTalk, Feishu, Bark or a custom webhook - or use the default one.
What does it do on its own every trading day?Four scheduled agents: pre-market analysis with a strategy before the open, intraday monitoring that alerts on RSI/KDJ/MACD resonance during the session, a post-market report reviewing the day and money flows, and an AI-filtered news feed relevant to your holdings.
Creator
TNT-Likely
Size
19.1 MB
Stars
2.1K
Age
8mo
Commits · 90 Days