Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Run the smallest focused test while iterating, then the relevant suite before op
# Frontend suite, translation guard, type/build verification
pnpm --dir frontend exec vitest run
pnpm --dir frontend run check:i18n
pnpm --dir frontend run check:ui
pnpm --dir frontend run build

# Whitespace and conflict-marker check
Expand Down Expand Up @@ -202,3 +203,11 @@ Use a `codex/`-prefixed branch when changes are made through Codex unless a main
For ordinary bugs, open an issue with reproduction steps, expected and actual behavior, version information, and sanitized logs. Remove tokens, cookies, account identifiers, positions, and other private financial data.

For a security-sensitive issue, do not publish exploit details or credentials in a public issue. Follow the private reporting instructions in [SECURITY.md](SECURITY.md).

## Shared UI conventions

Read the [UI guide](frontend/UI_GUIDELINES.md) ([简体中文](frontend/UI_GUIDELINES.zh-CN.md)) before changing controls or scrolling panels. Run `pnpm --dir frontend check:ui` to catch native selects, browser dialogs, and unstyled scroll regions; verify desktop/mobile and light/dark rendering as well.

## Exchange calendar coverage

Published annual closures and half-days live in `src/platform/scheduling/exchange_calendar_data.py` (currently 2026). Runtime warmup materializes only the previous 30 and upcoming 90 days without fetching historical calendars. Unpublished weekdays are unknown and cannot authorize automatic execution. Update the bundled annual data from exchange publications before the next year; preserve market-local dates, daylight-saving offsets, and half-day regression coverage. Configured Agent Cron/interval cycles remain unchanged; execution and preview share calendar gates.
9 changes: 9 additions & 0 deletions CONTRIBUTING.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ make install-hooks
# 前端测试、多语言门禁、类型检查与生产构建
pnpm --dir frontend exec vitest run
pnpm --dir frontend run check:i18n
pnpm --dir frontend run check:ui
pnpm --dir frontend run build

# 空白符和冲突标记检查
Expand Down Expand Up @@ -202,3 +203,11 @@ PR 标题和正文统一使用英文,标题同样采用 Conventional Commits
普通 Bug 请提交 Issue,包含复现步骤、预期/实际行为、版本信息和脱敏日志。务必移除 Token、Cookie、账户标识、持仓等金融隐私数据。

安全敏感问题不要在公开 Issue 中发布利用细节或凭据;请遵循 [SECURITY.md](SECURITY.md) 中的私密报告方式。

## 统一 UI 约定

修改控件或滚动面板前阅读 [UI 规范](frontend/UI_GUIDELINES.zh-CN.md)([English](frontend/UI_GUIDELINES.md))。运行 `pnpm --dir frontend check:ui` 拦截原生选择框、浏览器弹窗和漏用样式的滚动区域,并验证桌面 / 手机、亮色 / 深色效果。

## 交易日历覆盖

公布的年度休市日和半日市保存在 `src/platform/scheduling/exchange_calendar_data.py`(目前为 2026 年)。运行时只预热过去 30 天和未来 90 天,不请求历史日历。未公布年份的工作日标记未知,不能授权自动执行。跨年前应根据交易所公告补充下一年度数据,并验证市场当地日期、夏令时和半日市。已配置的 Agent Cron / 间隔保持不变,执行与预览共用交易日门禁。
195 changes: 100 additions & 95 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@

[English](README.md) | [简体中文](README.zh-CN.md)

**Turn your watchlist and portfolio into an always-on AI research desk.** PanWatch combines real-time monitoring, portfolio management, automated analysis, and multi-channel alerts for China A-shares, Hong Kong, and U.S. markets—all on infrastructure you control.
Monitor A-shares, Hong Kong, and U.S. stocks, manage your portfolios, and research ideas with [TradingAgents](https://github.com/TauricResearch/TradingAgents). Self-host PanWatch with your preferred OpenAI-compatible provider or local models through Ollama.

Powered by [TradingAgents](https://github.com/TauricResearch/TradingAgents) for multi-agent investment research, including specialist analysis, bull/bear debate, risk review, and a portfolio-manager decision.

> 🌐 Available in English and Simplified Chinese. On first visit, PanWatch follows the browser language; a manual selection is remembered.

[Quick start](#quick-start) · [Feature overview](#-feature-overview) · [Core features](#core-features) · [Development](#local-development) · [Support](#support-the-project) · [Contributing](#contributing)
[Quick start](#quick-start) · [Core features](#core-features) · [Feature overview](#-feature-overview) · [Reference](#reference) · [Support](#support-the-project) · [Contributing](#contributing)

[![GitHub stars](https://img.shields.io/github/stars/TNT-Likely/PanWatch?style=flat&logo=github&color=yellow)](https://github.com/TNT-Likely/PanWatch/stargazers)
[![Docker Pulls](https://img.shields.io/docker/pulls/sunxiao0721/panwatch?logo=docker&label=docker%20pulls&color=2496ED)](https://hub.docker.com/r/sunxiao0721/panwatch)
Expand All @@ -30,12 +26,74 @@ Powered by [TradingAgents](https://github.com/TauricResearch/TradingAgents) for

> 🧠 **Start from a portfolio holding → let a nine-agent TradingAgents research team analyze it → follow the bull/bear debate and risk review → receive a PM decision memo and the complete reasoning trail in your messaging app within 3–5 minutes.**

## Why PanWatch?
## Core Features

| Capability | What you can do |
|---|---|
| **Portfolio** | Manage multiple brokerage accounts, track holdings and P&L, and set trading styles. |
| **AI research** | Follow technical, sentiment, news, and fundamentals analysis through debate, risk review, and a portfolio-manager decision. |
| **Scheduled agents** | Run pre-market, intraday, and closing workflows on eligible exchange trading days using your configured schedules. |
| **Price alerts** | Combine conditions with AND/OR logic and configure cooldowns, daily limits, expiration, and notification channels. |
| **Opportunities** | Review ranked candidates with entry levels, targets, and risk context. |
| **Paper trading** | Simulate signal-based entries and exits, then track equity and performance. |
| **Notifications** | Deliver reports and alerts through Telegram, WeCom, DingTalk, Feishu, Bark, or webhooks. |
| **Mobile** | Install the PWA on your home screen and use the same workspace on your phone. |

## Quick Start

```bash
docker run -d \
--name panwatch \
--restart unless-stopped \
-p 8000:8000 \
-v panwatch_data:/app/data \
sunxiao0721/panwatch:latest
```

Open `http://localhost:8000` and create your login credentials.

<details>
<summary>Initial setup</summary>

1. Open the web interface and create your login credentials.
2. Go to **Settings → AI Services** and configure an OpenAI-compatible API, such as OpenAI, Zhipu AI, DeepSeek, or Ollama.
3. Go to **Settings → Notification Channels** and add Telegram or another delivery channel.
4. Go to **Portfolio → Add Stock**, add a symbol to your watchlist, and enable the relevant agents.

</details>

<details>
<summary>Docker Compose</summary>

```yaml
services:
panwatch:
image: sunxiao0721/panwatch:latest
container_name: panwatch
ports:
- "8000:8000"
volumes:
- panwatch_data:/app/data
restart: unless-stopped

volumes:
panwatch_data:
```

- **Private by design** — self-host it so portfolio data remains under your control.
- **Action-oriented AI** — turn market data, news, technical signals, and portfolio context into concrete watch items instead of another indicator dashboard.
- **Always on** — schedule pre-market, intraday, and closing agents, then deliver results through Telegram, WeCom, DingTalk, Feishu, Bark, or webhooks.
- **Multi-market and model-agnostic** — monitor China A-shares, Hong Kong, and U.S. stocks with OpenAI-compatible providers, including local models through Ollama.
```bash
docker compose up -d
```

</details>

<details>
<summary>First startup and browser installation</summary>

The image includes Playwright's system dependencies. Chromium's headless shell for screenshots is downloaded on first startup into the mounted volume (default `/app/data/playwright`), which requires network access and can take a few minutes.

If you do not need browser features such as screenshots, set `PLAYWRIGHT_SKIP_BROWSER_INSTALL=1` to skip this installation.

</details>

## 📸 Feature Overview

Expand All @@ -60,26 +118,33 @@ The screenshots below use the English interface; Simplified Chinese is available

> 💡 If PanWatch is useful to you, please consider giving the project a ⭐ **Star**. It is the best way to support the project and help more people discover it.

## 🧠 Deep Analysis with TradingAgents
## Reference

PanWatch integrates [TradingAgents](https://github.com/TauricResearch/TradingAgents), the multi-agent investment decision framework with more than 76k stars. Select the 🧠 icon next to a portfolio holding to start an analysis:
<details>
<summary>Scheduled agents and deep analysis</summary>

- **Four analyst roles** — technical, sentiment, news, and fundamentals — followed by a **bull/bear debate**, **risk review**, and **portfolio-manager decision**.
- A complete reasoning trail is generated in 3–5 minutes and can be delivered to Telegram, WeCom, or DingTalk.
- The default model is `deepseek-chat`; a typical run costs about USD 0.05, keeping monthly spending predictable.
- [View the TradingAgents deep-analysis flowchart](docs/tradingagents-flow.en.md)
- [Read the backend architecture guide](src/ARCHITECTURE.en.md)
| Agent | Purpose |
|---|---|
| **Pre-market outlook** | Combine overnight moves, news, and technical structure into a plan. |
| **Intraday monitor** | Watch unusual moves and technical signals during open sessions. |
| **Daily report** | Review the session and prepare the next trading day's plan. |

## Core Features
Schedules are configurable. Automatic runs filter exchange holidays before collection and analysis; intraday workflows also require an open trading session.

Select the brain icon beside a holding to start TradingAgents deep analysis. Four analyst roles feed a bull/bear debate, risk review, and portfolio-manager decision, with the reasoning trail available in the app and through configured notification channels. Runtime and cost depend on the selected models and configuration.

[Deep-analysis flowchart](docs/tradingagents-flow.en.md) · [Backend architecture](src/ARCHITECTURE.en.md)

</details>

<details>
<summary><b>Intelligent agent system</b></summary>
<summary>Market calendars and scheduling</summary>

| Agent | Trigger | Purpose |
|-------|---------|---------|
| **Pre-market outlook** | Before each market session | Combines overnight U.S. market moves, news, and technical structure into an action plan for the day. |
| **Intraday monitor** | During trading hours | Watches unusual moves and sends alerts when indicators such as RSI, KDJ, and MACD align. |
| **Daily report** | After market close | Reviews the session, analyzes capital flows, and prepares a plan for the next trading day. |
- Select the market status strip to compare all three exchanges across the next 14 dates. Opening/session times use your browser timezone; trade dates and status use each exchange's local date.
- A non-trading day shows closed; a completed trading day shows market closed. Beijing Saturday morning may still be New York Friday after close.
- Published 2026 closures and half-days are bundled locally. Startup warms only the previous 30 and next 90 days, without downloading full history. Unpublished weekdays show a pending calendar and block automatic execution; the bundled annual data must be updated for the next year.
- Agent Cron/interval settings remain unchanged; execution and schedule previews share calendar filters. Price alerts in “all day” mode still require a trading day.
- Paper fills require an open session for that stock's market. Paper notifications follow each exchange's local clock, including half-days and U.S. daylight-saving changes.

</details>

Expand All @@ -94,73 +159,16 @@ PanWatch integrates [TradingAgents](https://github.com/TauricResearch/TradingAge

</details>

<details>
<summary><b>Multiple markets and accounts</b></summary>

- **Markets:** real-time quotes for China A-shares, Hong Kong stocks, and U.S. stocks.
- **Account management:** manage brokerage accounts independently while viewing consolidated total assets.
- **Trading styles:** set short-term, swing, or long-term preferences for more relevant AI suggestions.

</details>

<details>
<summary><b>Multi-channel notifications</b></summary>

Telegram / WeCom / DingTalk / Feishu / Bark / custom webhooks

</details>

<details>
<summary><b>Price alerts</b></summary>

- Combine price, percentage change, turnover, volume ratio, and other conditions with AND/OR logic.
- Limit rules to market hours or keep them active all day; configure cooldowns, daily trigger limits, and repeat behavior.
- Limit rules to market hours or keep them active all day on trading days; configure cooldowns, daily trigger limits, and repeat behavior.
- Set an expiration date and `HH:mm` time in the rule dialog, or leave it empty so the rule never expires.
- Choose notification channels per rule, or use the system default when none is selected.

</details>

## Quick Start

```bash
docker run -d \
--name panwatch \
--restart unless-stopped \
-p 8000:8000 \
-v panwatch_data:/app/data \
sunxiao0721/panwatch:latest
```

Open `http://localhost:8000`, create your username and password, and connect an OpenAI-compatible provider. PanWatch selects English or Simplified Chinese from the browser language on first visit.

The image includes the system dependencies required by Playwright. Chromium's headless shell, used for screenshots, is downloaded and installed into the mounted volume (by default `/app/data/playwright`) on the first container startup. This can take a few minutes and requires network access.

If you do not need browser-based features such as screenshots, set `PLAYWRIGHT_SKIP_BROWSER_INSTALL=1` when starting the container to skip the initial Chromium installation.

<details>
<summary>Docker Compose</summary>

```yaml
services:
panwatch:
image: sunxiao0721/panwatch:latest
container_name: panwatch
ports:
- "8000:8000"
volumes:
- panwatch_data:/app/data
restart: unless-stopped

volumes:
panwatch_data:
```

```bash
docker compose up -d
```

</details>

<details>
<summary>Environment variables</summary>

Expand All @@ -170,24 +178,14 @@ docker compose up -d
| `AUTH_PASSWORD` | Preconfigured login password | Set on first visit |
| `JWT_SECRET` | Secret used to sign JWTs | Generated automatically |
| `DATA_DIR` | Data storage directory | `./data` |
| `TZ` | Application timezone used for agent schedules and displayed times | `Asia/Shanghai` |
| `TZ` | Application timezone for Agent schedules; market-calendar times follow the browser timezone | `Asia/Shanghai` |
| `PLAYWRIGHT_SKIP_BROWSER_INSTALL` | Skip the initial Chromium installation when browser features are not required | Not set |
| `LOG_LEVEL` | Console log level. `INFO` prints business events and errors; use `DEBUG` for scheduler heartbeats, collection steps, and other diagnostics. The UI log panel always retains the complete log. | `INFO` |
| `HTTP_PROXY` / `HTTPS_PROXY` / `http_proxy` | Outbound HTTP proxy. Configure it through an external environment variable, `http_proxy=http://host:port` in `.env`, or **Settings → Global HTTP Proxy**. Priority: external environment variables > UI > `.env`. `NO_PROXY` includes `localhost,127.0.0.1` by default. | Not set |
| `OTEL_EXPORTER_OTLP_ENDPOINT` | OpenTelemetry OTLP endpoint, such as `http://jaeger:4318`. Export remains completely disabled when this is empty. The optional dependencies in `requirements-otel.txt` are also required. | Not set (disabled) |

</details>

<details>
<summary>Initial setup</summary>

1. Open the web interface and create your login credentials.
2. Go to **Settings → AI Services** and configure an OpenAI-compatible API, such as OpenAI, Zhipu AI, DeepSeek, or Ollama.
3. Go to **Settings → Notification Channels** and add Telegram or another delivery channel.
4. Go to **Portfolio → Add Stock**, add a symbol to your watchlist, and enable the relevant agents.

</details>

<details>
<summary>Local development</summary>

Expand All @@ -208,7 +206,8 @@ cd frontend && pnpm install && pnpm dev # Frontend on :5183

The frontend development server runs at `http://localhost:5183` and proxies `/api` to `127.0.0.1:8000`.

Port `5183` is used instead of Vite's default `5173` to avoid conflicts with other locally running projects such as BeeCount-Cloud.

[Frontend UI conventions and checks](frontend/UI_GUIDELINES.md)

</details>

Expand Down Expand Up @@ -279,6 +278,12 @@ Configure these repository secrets before publishing:

## Support the Project

### Sponsorship

For sponsorship or partnership inquiries, contact [sunxiaoyes@outlook.com](mailto:sunxiaoyes@outlook.com?subject=PanWatch%20sponsorship).

### Donations

PanWatch is free and open source. If it saves you time or improves your workflow, you can support continued development:

[![PayPal](https://img.shields.io/badge/PayPal-Donate-0070BA?logo=paypal&logoColor=white&style=for-the-badge)](https://paypal.me/sunxiaoyes)
Expand Down
Loading
Loading