项目 / DemonDamon/FinnewsHunter

DemonDamon/FinnewsHunter

行业推荐
语言 Python标签 agentic-aifintechmulti-agentquant-financesentiment-analysisalpha-signals数据更新 2026-11-25 06:49:28 · 仓库 2026-11-24

一段话介绍

FinnewsHunter: Multi-agent financial intelligence platform powered by AgenticX. Real-time news analysis, sentiment fusion, and alpha factor mining.

本站整理,非 GitHub 官方 description。

官方 description(GitHub API 原样)
FinnewsHunter: Multi-agent financial intelligence platform powered by AgenticX. Real-time news analysis, sentiment fusion, and alpha factor mining.
1,521累计星
345Fork
—峰值日增
0上榜次数
总榜
暂未入榜
日榜
暂未入榜
周榜
暂未入榜
月榜
暂未入榜

官方快照(gh_history.db,2026-11-25):总榜 未进 Top50 · 日榜 未进 Top50 · 周榜未满 7 天基线(官方不生成) · 月榜暂无官方口径;下方四卡为站内趋势聚合(周卡按上榜次数,非官方 7 日增量窗)。

行业与场景

按行业选型 →

量化研究与策略回测

适配系统:量化投研平台、行情终端 · 得分 1.4

内置行情接入、因子计算与回测框架,可作为投研团队的策略实验与绩效归因底座。

大模型应用工程化与评测

适配系统:AI 应用平台、模型评测平台 · 得分 1.2

提供模型接入、编排与效果评测能力,可作为行业 AI 应用的工程底座与质量闸门。

更多信息

以下三段按该项目自己的 GitHub README 章节摘录(可合理截断并标明);README 没有对应章节的留空,不编造。

我的用法
系统通过 Celery Beat 自动触发所有新闻源每分钟抓取。
特点或设计要点
项目直接调用 AgenticX 的 BailianEmbeddingProvider 和 MilvusStorage,避免重复造轮子。
星标走势还差一天的数据,明天就能看到曲线
每天 10:30 记一次星标,连续两天后自动生成曲线
首次发现 — · 最近在榜 2026-11-10 · 语言 Python · 贡献者 —
agent

GitHub 项目主页介绍

来自 GitHub 仓库 README / 主页介绍正文,正文较长,已截断:保留前 20000 字符(原始 43,093 字节),完整内容见 GitHub 仓库。

# FinnewsHunter: Multi-Agent Investment Decision Platform Driven by Financial News

<div align="right">
  <a href="README_zn.md">中文版</a> | <a href="README.md">English</a>
</div>

<div align="center">
  <img src="assets/images/FINNEWS_HUNTER_LOGO.png" alt="FinnewsHunter Logo" width="450">
</div>

An enterprise-grade financial news analysis system built on the [AgenticX](https://github.com/DemonDamon/AgenticX) framework, integrating real-time news streams, deep quantitative analysis, and multi-agent debate mechanisms.

FinnewsHunter goes beyond traditional text classification by deploying multi-agent teams (NewsAnalyst, Researcher, etc.) to monitor multiple financial news sources in real-time, including Sina Finance, National Business Daily, Financial World, Securities Times, and more. It leverages large language models for deep interpretation, sentiment analysis, and market impact assessment, combined with knowledge graphs to mine potential investment opportunities and risks, providing decision-level alpha signals for quantitative trading.

---

## 🎯 Project Features

- ✅ **AgenticX Native**: Deeply integrated with AgenticX framework, using core abstractions like Agent, Tool, and Workflow
- ✅ **AgenticX Component Integration**: Direct use of AgenticX's `BailianEmbeddingProvider` and `MilvusStorage`, avoiding reinventing the wheel
- ✅ **Agent-Driven**: NewsAnalyst agent automatically analyzes news sentiment and market impact
- ✅ **Multi-Provider LLM Support**: Supports 5 major LLM providers (Bailian, OpenAI, DeepSeek, Kimi, Zhipu), switchable with one click in the frontend
- ✅ **Batch Operations**: Supports batch selection, batch deletion, and batch analysis of news, improving operational efficiency
- ✅ **Stock K-Line Analysis**: Integrated with akshare real market data, supporting daily/minute K-line multi-period display
- ✅ **Intelligent Stock Search**: Supports code and name fuzzy queries, pre-loaded with 5000+ A-share data
- ✅ **Complete Tech Stack**: FastAPI + PostgreSQL + Milvus + Redis + React
- ✅ **Real-time Search**: Supports multi-dimensional search by title, content, stock code, with keyword highlighting
- ✅ **Async Vectorization**: Background async vectorization execution, non-blocking analysis flow
- ✅ **Production Ready**: One-click deployment with Docker Compose, complete logging and monitoring

---

## 🏗️ System Architecture

![FinnewsHunter Architecture](assets/images/arch-20251201.png)

The system adopts a layered architecture design:
- **M6 Frontend Interaction Layer**: React + TypeScript + Shadcn UI
- **M1 Platform Service Layer**: FastAPI Gateway + Task Manager
- **M4/M5 Agent Collaboration Layer**: AgenticX Agent + Debate Workflow
- **M2/M3 Infrastructure Layer**: Crawler Service + LLM Service + Embedding
- **M7-M11 Storage & Learning Layer**: PostgreSQL + Milvus + Redis + ACE Framework

---

## 🚀 Quick Start

### Prerequisites

- Python 3.11+
- Docker & Docker Compose
- (Optional) OpenAI API Key or local LLM
- Node.js 18+ (for frontend development)

### 1. Install AgenticX

```bash
cd /Users/damon/myWork/AgenticX
pip install -e .
```

### 2. Install Backend Dependencies

```bash
cd FinnewsHunter/backend
pip install -r requirements.txt
```

### 3. Configure Environment Variables

```bash
cd FinnewsHunter/backend
cp env.example .env
# Edit .env file and fill in LLM API Key and other configurations
```

**Multi-Provider LLM Configuration:**

The system supports 5 LLM providers, at least one needs to be configured:

| Provider | Environment Variable | Registration URL |
|----------|---------------------|------------------|
| Bailian (Alibaba Cloud) | `DASHSCOPE_API_KEY` | https://dashscope.console.aliyun.com/ |
| OpenAI | `OPENAI_API_KEY` | https://platform.openai.com/api-keys |
| DeepSeek | `DEEPSEEK_API_KEY` | https://platform.deepseek.com/ |
| Kimi (Moonshot) | `MOONSHOT_API_KEY` | https://platform.moonshot.cn/ |
| Zhipu | `ZHIPU_API_KEY` | https://open.bigmodel.cn/ |

**Example Configuration (Recommended: Bailian):**

```bash
# Bailian (Alibaba Cloud) - Recommended, fast access in China
DASHSCOPE_API_KEY=sk-your-dashscope-key
DASHSCOPE_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
BAILIAN_MODELS=qwen-plus,qwen-max,qwen-turbo

# Optional: Other providers
OPENAI_API_KEY=sk-your-openai-key
DEEPSEEK_API_KEY=sk-your-deepseek-key
```

### 4. Start Base Services (PostgreSQL, Redis, Milvus)

```bash
cd FinnewsHunter
docker compose -f deploy/docker-compose.dev.yml up -d postgres redis milvus-etcd milvus-minio milvus-standalone
```

### 5. Initialize Database

```bash
cd FinnewsHunter/backend
python init_db.py
```

### 5.1 Initialize Stock Data (Optional, for stock search functionality)

```bash
cd FinnewsHunter/backend
python -m app.scripts.init_stocks
# Will fetch all A-share data (approximately 5000+ stocks) from akshare and save to database
```

### 6. Start Backend API Service

```bash
cd FinnewsHunter/backend
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
```

### 7. Start Celery Worker and Beat (Auto Crawling)

```bash
# Open a new terminal
cd FinnewsHunter
docker compose -f deploy/docker-compose.dev.yml up -d celery-worker celery-beat
```

### 8. Start Frontend Service

```bash
# Open a new terminal
cd FinnewsHunter/frontend
npm install  # First time requires dependency installation
npm run dev
```

### 9. Access Application

- **Frontend Interface**: http://localhost:3000
- **Backend API**: http://localhost:8000
- **API Documentation**: http://localhost:8000/docs

---

## 🔄 Service Management

### View All Service Status

```bash
cd FinnewsHunter
docker compose -f deploy/docker-compose.dev.yml ps
```

### Restart All Services

```bash
cd FinnewsHunter

# Restart Docker services (infrastructure + Celery)
docker compose -f deploy/docker-compose.dev.yml restart

# If backend API is started independently, manually restart it
# Press Ctrl+C to stop backend process, then rerun:
cd backend
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
```

### Restart Specific Service

```bash
cd FinnewsHunter

# Restart only Celery (after code changes)
docker compose -f deploy/docker-compose.dev.yml restart celery-worker celery-beat

# Restart only database
docker compose -f deploy/docker-compose.dev.yml restart postgres

# Restart only Redis
docker compose -f deploy/docker-compose.dev.yml restart redis
```

### Stop All Services

```bash
cd FinnewsHunter
docker compose -f deploy/docker-compose.dev.yml down
```

### View Logs

```bash
cd FinnewsHunter

# View Celery Worker logs
docker compose -f deploy/docker-compose.dev.yml logs -f celery-worker

# View Celery Beat logs (scheduled task dispatch)
docker compose -f deploy/docker-compose.dev.yml logs -f celery-beat

# View PostgreSQL logs
docker compose -f deploy/docker-compose.dev.yml logs -f postgres

# View all service logs
docker compose -f deploy/docker-compose.dev.yml logs -f
```

---

## 🗑️ Reset Database

### Method 1: Use One-Click Reset Script (Recommended) ⭐

```bash
cd FinnewsHunter

# Execute reset script
./reset_all_data.sh

# Enter yes to confirm
```

**The script will automatically complete:**
1. ✅ Clear all news and task data in PostgreSQL
2. ✅ Clear Redis cache
3. ✅ Reset database auto-increment IDs (restart from 1)
4. ✅ Clear Celery schedule files
5. ✅ Automatically restart Celery services

**After execution, wait:**
- 5-10 minutes for the system to automatically re-crawl data
- Access frontend to view new data

---

### Method 2: Manual Reset (Advanced)

#### Step 1: Clear PostgreSQL Data

```bash
# Enter PostgreSQL container
docker exec -it finnews_postgres psql -U finnews -d finnews_db
```

Execute in PostgreSQL command line:

```sql
-- Clear news table
DELETE FROM news;

-- Clear task table
DELETE FROM crawl_tasks;

-- Clear analysis table
DELETE FROM analyses;

-- Reset auto-increment IDs
ALTER SEQUENCE news_id_seq RESTART WITH 1;
ALTER SEQUENCE crawl_tasks_id_seq RESTART WITH 1;
ALTER SEQUENCE analyses_id_seq RESTART WITH 1;

-- Verify results (should all be 0)
SELECT 'news table', COUNT(*) FROM news;
SELECT 'crawl_tasks table', COUNT(*) FROM crawl_tasks;
SELECT 'analyses table', COUNT(*) FROM analyses;

-- Exit
\q
```

#### Step 2: Clear Redis Cache

```bash
cd FinnewsHunter
docker exec finnews_redis redis-cli FLUSHDB
```

#### Step 3: Clear Celery Schedule Files

```bash
cd FinnewsHunter/backend
rm -f celerybeat-schedule*
```

#### Step 4: Restart Celery Services

```bash
cd FinnewsHunter
docker compose -f deploy/docker-compose.dev.yml restart celery-worker celery-beat
```

#### Step 5: Verify Data Cleared

```bash
# Check news count (should be 0)
docker exec finnews_postgres psql -U finnews -d finnews_db -c "SELECT COUNT(*) FROM news;"

# Check Redis (should be 0 or very small)
docker exec finnews_redis redis-cli DBSIZE

# Check if Celery has started crawling
docker compose -f deploy/docker-compose.dev.yml logs -f celery-beat
# Should see 10 crawl tasks triggered per minute
```

---

### Method 3: Use Python Script Reset

```bash
cd FinnewsHunter/backend
python reset_database.py
# Enter yes to confirm
```

---

### Method 4: Quick Manual Cleanup (One-Line Commands) 🔥

**Use Case:** When reset script doesn't work, this is the fastest method

```bash
cd FinnewsHunter

# Step 1: Clear database tables
docker exec finnews_postgres psql -U finnews -d finnews_db -c "DELETE FROM news; DELETE FROM crawl_tasks; DELETE FROM analyses;"

# Step 2: Reset auto-increment IDs
docker exec finnews_postgres psql -U finnews -d finnews_db -c "ALTER SEQUENCE news_id_seq RESTART WITH 1; ALTER SEQUENCE crawl_tasks_id_seq RESTART WITH 1; ALTER SEQUENCE analyses_id_seq RESTART WITH 1;"

# Step 3: Clear Redis cache
docker exec finnews_redis redis-cli FLUSHDB

# Step 4: Clear Celery schedule files
rm -f backend/celerybeat-schedule*

# Step 5: Restart Celery services
docker compose -f deploy/docker-compose.dev.yml restart celery-worker celery-beat

# Step 6: Verify cleared (should display 0)
docker exec finnews_postgres psql -U finnews -d finnews_db -c "SELECT COUNT(*) FROM news;"
```

**Immediately refresh browser after execution:**
- Mac: `Command + Shift + R`
- Windows: `Ctrl + Shift + R`

---

### 🖥️ Clear Frontend Cache (Important!)

**After data is cleared, frontend may still display old data due to browser cache.**

#### Method 1: Hard Refresh Browser (Recommended) ⭐

**Mac System:**
```
Press Command + Shift + R
or Command + Option + R
```

**Windows/Linux System:**
```
Press Ctrl + Shift + R
or Ctrl + F5
```

#### Method 2: Developer Tools Clear Cache

1. Press `F12` to open developer tools
2. Right-click the refresh button (next to address bar)
3. Select **"Empty Cache and Hard Reload"**

#### Method 3: Clear Browser Cache

1. **Chrome/Edge:**
   - `Command + Shift + Delete` (Mac) or `Ctrl + Shift + Delete` (Windows)
   - Check "Cached images and files"
   - Time range select "All time"
   - Click "Clear data"

2. **After refreshing page, hard refresh again**
   - Ensure React Query cache is also cleared

#### Method 4: Restart Frontend Dev Server (Most Thorough)

```bash
# Press Ctrl+C in frontend terminal to stop service
# Then restart
cd FinnewsHunter/frontend
npm run dev
```

---

## 📊 Data Recovery Timeline After Reset

| Time | Event | Expected Result |
|------|-------|----------------|
| 0 min | Execute reset script | Database cleared, Redis cleared |
| 1 min | Celery Beat starts scheduling | 10 crawl tasks triggered |
| 2-5 min | First batch of news saved | Database starts having data |
| 5-10 min | All sources have data | Frontend can see 100+ news |
| 30 min | Data continues growing | 500+ news |
| 1 hour | Stable operation | 1000-2000 news |

**Notes:**
- Need to wait 5-10 minutes after reset to see new data
- **Frontend must hard refresh** (Command+Shift+R / Ctrl+Shift+R) to clear cache
- Don't reset frequently, affects system stability

**Steps to immediately hard refresh frontend after reset:**
1. Execute reset command
2. **Immediately** press `Command + Shift + R` (Mac) or `Ctrl + Shift + R` (Windows) in browser
3. Wait 5-10 minutes then refresh again to view new data

---

## ⚠️ Crawler Status Check

### Check Which Sources Are Working

```bash
cd FinnewsHunter

# View news count by source
docker exec finnews_postgres psql -U finnews -d finnews_db -c "
SELECT source, COUNT(*) as count 
FROM news 
WHERE created_at > NOW() - INTERVAL '1 hour'
GROUP BY source 
ORDER BY count DESC;
"

# View recent crawl task status
docker exec finnews_postgres psql -U finnews -d finnews_db -c "
SELECT source, 
       crawled_count, 
       saved_count, 
       status,
       error_message 
FROM crawl_tasks 
WHERE created_at > NOW() - INTERVAL '10 minutes'
ORDER BY created_at DESC 
LIMIT 20;
"
```

### View Crawl Errors

```bash
cd FinnewsHunter

# View ERROR logs
docker compose -f deploy/docker-compose.dev.yml logs celery-worker | grep ERROR

# View specific source issues
docker compose -f deploy/docker-compose.dev.yml logs celery-worker | grep "jwview"
```

---

## 📚 User Guide

### Auto Crawl Mode (Recommended) ⭐

**System is configured with automatic crawling for 10 news sources:**

1. 🌐 Sina Finance
2. 🐧 Tencent Finance
3. 💰 Financial World
4. 📊 Economic Observer
5. 📈 Caijing.com
6. 📉 21st Century Business Herald
7. 📰 National Business Daily
8. 🎯 Yicai
9. 📧 NetEase Finance
10. 💎 East Money

**How it works:**
- ✅ Celery Beat automatically triggers crawling for all sources every 1 minute
- ✅ Automatic deduplication (URL level)
- ✅ Smart time filtering (keep news within 24 hours)
- ✅ Stock keyword filtering
- ✅ No manual operation needed

**View crawl progress:**

```bash
# View Celery Beat scheduling logs
cd FinnewsHunter
docker compose -f deploy/docker-compose.dev.yml logs -f celery-beat

# View Celery Worker execution logs
docker compose -f deploy/docker-compose.dev.yml logs -f celery-worker
```

---

### Manual Refresh (Get Latest Immediately)

**Method 1: Via Frontend**
1. Visit http://localhost:3000/news
2. Click the "🔄 Refresh Now" button in the top right
3. System will immediately trigger crawling, data updates in about 2 minutes

**Method 2: Via API**
```bash
# Force refresh Sina Finance
curl -X POST "http://localhost:8000/api/v1/news/refresh?source=sina"

# Force refresh all sources (need to call individually)
for source in sina tencent jwview eeo caijing jingji21 nbd yicai 163 eastmoney; do
  curl -X POST "http://localhost:8000/api/v1/news/refresh?source=$source"
  sleep 1
done
```

---

### View News List

**Method 1: Via Frontend (Recommended)**
- Visit http://localhost:3000
- Homepage: View source statistics and latest news
- News Feed: Filter news by source and sentiment
- Batch selection support: Use checkboxes to select multiple news, supports Shift key range selection
- Batch operations: Select all/deselect all, batch delete, batch analyze

**Method 2: Via API**

```bash
# Get latest news from all sources (200 items)
curl "http://localhost:8000/api/v1/news/latest?limit=200"

# Get news from specific source
curl "http://localhost:8000/api/v1/news/latest?source=sina&limit=50"

# Filter by sentiment (using old API)
curl "http://localhost:8000/api/v1/news/?sentiment=positive&limit=20"

# Get all available news source list
curl "http://localhost:8000/api/v1/news/sources"
```

---

### Batch Operations on News

**Frontend Operations:**
1. **Batch Selection**:
   - Click checkbox on the left of news card to select single news
   - Hold Shift key and click for range selection
   - Use "Select All" button in top toolbar to select all news in current filter results
   - Selection state automatically clears when switching news source or filter conditions

2. **Batch Delete**:
   - After selecting multiple news, click "Batch Delete" button in top toolbar
   - After confirming delete dialog, selected news will be deleted
   - List automatically refreshes after deletion

3. **Batch Analysis**:
   - After selecting multiple news, click "Batch Analyze" button in top toolbar
   - System will analyze selected news sequentially, showing progress and result statistics
   - After analysis completes, shows success/failure count

**API Operations:**
```bash
# Batch delete news
curl -X POST "http://localhost:8000/api/v1/news/batch/delete" \
  -H "Content-Type: application/json" \
  -d '{"news_ids": [1, 2, 3]}'

# Batch analyze news
curl -X POST "http://localhost:8000/api/v1/analysis/batch" \
  -H "Content-Type: application/json" \
  -d '{"news_ids": [1, 2, 3], "provider": "bailian", "model": "qwen-plus"}'
```

---

### Analyze News

**Method 1: Via Frontend**
- Click "✨ Analyze" button on news card
- Wait 3-5 seconds to view analysis results
- Click news card to open detail drawer, view complete analysis content

**Method 2: Via API**
```bash
# Analyze news with specified ID (using default model)
curl -X POST http://localhost:8000/api/v1/analysis/news/1

# Analyze news (specify model)
curl -X POST http://localhost:8000/api/v1/analysis/news/1 \
  -H "Content-Type: application/json" \
  -d '{"provider": "bailian", "model": "qwen-max"}'

# View analysis results
curl http://localhost:8000/api/v1/analysis/1
```

---

### Switch LLM Model

**Frontend Operations:**
1. Click model selector in top right (shows current model name)
2. Select different provider and model from dropdown menu
3. Selection automatically saves, subsequent analyses will use new model

**Supported Models:**
- 🔥 **Bailian**: qwen-plus, qwen-max, qwen-turbo, qwen-long
- 🤖 **OpenAI**: gpt-4, gpt-4-turbo, gpt-3.5-turbo
- 🧠 **DeepSeek**: deepseek-chat, deepseek-coder
- 🌙 **Kimi**: moonshot-v1-8k, moonshot-v1-32k, moonshot-v1-128k
- 🔮 **Zhipu**: glm-4, glm-4-plus, glm-4-air

**API to Get Available Model List:**
```bash
curl http://localhost:8000/api/v1/llm/config
```

---

### Search News

**Frontend Operations:**
1. Enter keywords in top search box
2. Supports search: title, content, stock code, source
3. Matching keywords will be highlighted
4. Search has 300ms debounce, automatically searches after input stops

**Search Examples:**
- Search stock code: `600519` (Kweichow Moutai)
- Search keywords: `新能源` (new energy), `半导体` (semiconductor)
- Search source: `sina`, `eastmoney`

---

### View News Details

**Frontend Operations:**
1. Click any news card
2. Detail drawer slides out from right, displaying:
   - 📰 News title and source
   - 📊 Sentiment score (positive/negative/neutral)
   - 📈 Associated stock codes
   - 📝 Complete news content
   - 🤖 AI analysis results (Markdown format)
   - 🔗 Original article link
3. Click "Copy Analysis Content" to copy analysis report in Markdown format

---

### Stock K-Line Analysis

**Frontend Operations:**
1. Visit http://localhost:3000/stocks/SH600519 (Kweichow Moutai example)
2. Use top right search box to enter stock code or name (e.g., `茅台` (Moutai), `600519`)
3. Select time period: Daily K, 60min, 30min, 15min, 5min, 1min
4. Chart supports:
   - 📈 K-line candlestick chart (OHLC)
   - 📊 Volume bar chart
   - 📉 MA moving averages (5/10/30/60 day)

**API Operations:**

```bash
# Get K-line data (daily, default 180 items)
curl "http://localhost:8000/api/v1/stocks/SH600519/kline?period=daily&limit=180"

# Get minute K-line (60-minute line)
curl "http://localhost:8000/api/v1/stocks/SH600519/kline?period=60m&limit=200"

# Search stocks
curl "http://localhost:8000/api/v1/stocks/search/realtime?q=茅台&limit=10"

# View stock count in database
curl "http://localhost:8000/api/v1/stocks/count"
```

---

### Filter by Source

**Frontend Operations:**

1. **Homepage (Dashboard)**
   - View "News Source Statistics" card
   - Click any source button to filter
   - Display news count and list for that source

2. **News Feed Page**
   - Top has 10 source filter buttons
   - Click to switch and view different sources
   - Supports source + sentiment dual filtering

**API Operations:**

```bash
# View Sina Finance news
curl "http://localhost:8000/api/v1/news/latest?source=sina&limit=50"

# View National Business Daily news
curl "http://localhost:8000/api/
↑