From c451e16caaebaa4ca0e6376a361e1141d8c937d3 Mon Sep 17 00:00:00 2001 From: TIANHE Date: Tue, 30 Dec 2025 21:14:30 +0800 Subject: [PATCH] new Signed-off-by: TIANHE --- README.md | 87 +++++++++++++++++++++++++++++++-------- README_CN.md | 113 +++++++++++++++++++++++++++++++-------------------- README_JA.md | 86 ++++++++++++++++++++++++++++++++------- README_KO.md | 86 ++++++++++++++++++++++++++++++++------- README_TW.md | 106 ++++++++++++++++++++++++++++++----------------- 5 files changed, 351 insertions(+), 127 deletions(-) diff --git a/README.md b/README.md index f9d7c32..32cf091 100644 --- a/README.md +++ b/README.md @@ -124,25 +124,80 @@ QuantDinger’s agents don’t start from scratch every time. The backend includ - **Where it lives**: Local SQLite files under `backend_api_python/data/memory/` (privacy-first). ```mermaid -flowchart TD - A[POST /api/analysis/multi] --> B[AnalysisService] - B --> C[AgentCoordinator] - C --> D[Build context: price/kline/news/indicators] +flowchart TB + %% ===== 🌐 Entry Layer ===== + subgraph Entry["🌐 API Entry"] + A["📡 POST /api/analysis/multi"] + A2["🔄 POST /api/analysis/reflect"] + end - subgraph Agents[Agents] - E[Analysts + Researchers + Trader] - end + %% ===== ⚙️ Service Layer ===== + subgraph Service["⚙️ Service Orchestration"] + B[AnalysisService] + C[AgentCoordinator] + D["📊 Build Context
price · kline · news · indicators"] + end - C --> E - E -->|get_memories()| M[(SQLite: role_memory.db)] - M -->|Top-K memories| E - E -->|memory_prompt injected into system prompt| LLM[LLMService (OpenRouter)] + %% ===== 🤖 Multi-Agent Workflow ===== + subgraph Agents["🤖 Multi-Agent Workflow"] - C --> R[ReflectionService.record_analysis] - R --> RR[(SQLite: reflection_records.db)] - W[ReflectionWorker (optional)] --> RR - W -->|auto-verify + learn| M - A2[POST /api/analysis/reflect] -->|manual learn| M + subgraph P1["📈 Phase 1 · Analysis (Parallel)"] + E1["🔍 MarketAnalyst
Technical"] + E2["📑 FundamentalAnalyst
Fundamentals"] + E3["📰 NewsAnalyst
News & Events"] + E4["💭 SentimentAnalyst
Market Mood"] + E5["⚠️ RiskAnalyst
Risk Assessment"] + end + + subgraph P2["🎯 Phase 2 · Debate (Parallel)"] + F1["🐂 BullResearcher
Bullish Case"] + F2["🐻 BearResearcher
Bearish Case"] + end + + subgraph P3["💹 Phase 3 · Decision"] + G["🎰 TraderAgent
Final Verdict → BUY / SELL / HOLD"] + end + + end + + %% ===== 🧠 Memory Layer ===== + subgraph Memory["🧠 Local SQLite Memory (data/memory/)"] + M1[("market_analyst")] + M2[("fundamental")] + M3[("news_analyst")] + M4[("sentiment")] + M5[("risk_analyst")] + M6[("bull_researcher")] + M7[("bear_researcher")] + M8[("trader_agent")] + end + + %% ===== 🔄 Reflection Loop ===== + subgraph Reflect["🔄 Reflection Loop (Optional)"] + R[ReflectionService] + RR[("reflection_records.db")] + W["⏰ ReflectionWorker"] + end + + %% ===== Main Flow ===== + A --> B --> C --> D + D --> P1 --> P2 --> P3 + + %% ===== Memory Read/Write ===== + E1 <-.-> M1 + E2 <-.-> M2 + E3 <-.-> M3 + E4 <-.-> M4 + E5 <-.-> M5 + F1 <-.-> M6 + F2 <-.-> M7 + G <-.-> M8 + + %% ===== Reflection Flow ===== + C --> R --> RR + W --> RR + W -.->|"verify + learn"| M8 + A2 -.->|"manual review"| M8 ``` **Retrieval ranking (simplified)**: diff --git a/README_CN.md b/README_CN.md index b1d40eb..e59914a 100644 --- a/README_CN.md +++ b/README_CN.md @@ -126,57 +126,80 @@ QuantDinger 的多智能体不是“每次从零开始”。它内置了一个** #### 逻辑图(从请求到记忆闭环) ```mermaid -flowchart TD - A[POST /api/analysis/multi] --> B[AnalysisService] - B --> C[AgentCoordinator] +flowchart TB + %% ===== 🌐 入口层 ===== + subgraph Entry["🌐 API 入口"] + A["📡 POST /api/analysis/multi"] + A2["🔄 POST /api/analysis/reflect"] + end - C --> D[构建上下文: price/kline/news/indicators] + %% ===== ⚙️ 服务编排层 ===== + subgraph Service["⚙️ 服务编排"] + B[AnalysisService] + C[AgentCoordinator] + D["📊 构建上下文
price · kline · news · indicators"] + end - subgraph Agents[多智能体并行/串行工作流] - E1[MarketAnalyst] - E2[FundamentalAnalyst] - E3[NewsAnalyst] - E4[SentimentAnalyst] - E5[RiskAnalyst] - F1[BullResearcher] - F2[BearResearcher] - G[TraderAgent] - end + %% ===== 🤖 多智能体工作流 ===== + subgraph Agents["🤖 多智能体工作流"] - C -->|Phase 1 并行| E1 - C -->|Phase 1 并行| E2 - C -->|Phase 1 并行| E3 - C -->|Phase 1 并行| E4 - C -->|Phase 1 并行| E5 - C -->|Phase 2 并行| F1 - C -->|Phase 2 并行| F2 - C -->|Phase 3| G + subgraph P1["📈 Phase 1 · 多维分析(并行)"] + E1["🔍 MarketAnalyst
技术面分析"] + E2["📑 FundamentalAnalyst
基本面分析"] + E3["📰 NewsAnalyst
新闻舆情"] + E4["💭 SentimentAnalyst
市场情绪"] + E5["⚠️ RiskAnalyst
风险评估"] + end - subgraph MemDB[本地 SQLite 记忆库(按角色拆分)] - M1[(data/memory/market_analyst_memory.db)] - M2[(data/memory/fundamental_analyst_memory.db)] - M3[(data/memory/news_analyst_memory.db)] - M4[(data/memory/sentiment_analyst_memory.db)] - M5[(data/memory/risk_analyst_memory.db)] - M6[(data/memory/bull_researcher_memory.db)] - M7[(data/memory/bear_researcher_memory.db)] - M8[(data/memory/trader_agent_memory.db)] - end + subgraph P2["🎯 Phase 2 · 多空博弈(并行)"] + F1["🐂 BullResearcher
看多论据"] + F2["🐻 BearResearcher
看空论据"] + end - E1 <-->|get_memories / add_memory| M1 - E2 <-->|get_memories / add_memory| M2 - E3 <-->|get_memories / add_memory| M3 - E4 <-->|get_memories / add_memory| M4 - E5 <-->|get_memories / add_memory| M5 - F1 <-->|get_memories / add_memory| M6 - F2 <-->|get_memories / add_memory| M7 - G <-->|get_memories / add_memory| M8 + subgraph P3["💹 Phase 3 · 交易决策"] + G["🎰 TraderAgent
综合研判 → BUY / SELL / HOLD"] + end - C --> R[ReflectionService.record_analysis] - R --> RR[(data/memory/reflection_records.db)] - W[ReflectionWorker(可选,定时)] --> RR - W -->|到期验证 + 写回经验| M8 - A2[POST /api/analysis/reflect(手动复盘)] -->|reflect_and_learn| M8 + end + + %% ===== 🧠 记忆层 ===== + subgraph Memory["🧠 本地记忆库 SQLite(data/memory/)"] + M1[("market_analyst")] + M2[("fundamental")] + M3[("news_analyst")] + M4[("sentiment")] + M5[("risk_analyst")] + M6[("bull_researcher")] + M7[("bear_researcher")] + M8[("trader_agent")] + end + + %% ===== 🔄 反思闭环 ===== + subgraph Reflect["🔄 反思闭环(可选)"] + R[ReflectionService] + RR[("reflection_records.db")] + W["⏰ ReflectionWorker"] + end + + %% ===== 主流程 ===== + A --> B --> C --> D + D --> P1 --> P2 --> P3 + + %% ===== 记忆读写 ===== + E1 <-.-> M1 + E2 <-.-> M2 + E3 <-.-> M3 + E4 <-.-> M4 + E5 <-.-> M5 + F1 <-.-> M6 + F2 <-.-> M7 + G <-.-> M8 + + %% ===== 反思流程 ===== + C --> R --> RR + W --> RR + W -.->|"验证 + 学习"| M8 + A2 -.->|"手动复盘"| M8 ``` #### 1) 记忆是如何“注入提示词”的? diff --git a/README_JA.md b/README_JA.md index a5515d3..e523358 100644 --- a/README_JA.md +++ b/README_JA.md @@ -126,22 +126,80 @@ QuantDinger のエージェントは毎回「ゼロから」ではありませ #### フロー図(リクエスト → 記憶閉ループ) ```mermaid -flowchart TD - A[POST /api/analysis/multi] --> B[AnalysisService] - B --> C[AgentCoordinator] - C --> D[コンテキスト構築: price/kline/news/indicators] +flowchart TB + %% ===== 🌐 入口層 ===== + subgraph Entry["🌐 API エントリー"] + A["📡 POST /api/analysis/multi"] + A2["🔄 POST /api/analysis/reflect"] + end - subgraph Agents[Agents] - E[Analysts + Researchers + Trader] - end + %% ===== ⚙️ サービス層 ===== + subgraph Service["⚙️ サービス編成"] + B[AnalysisService] + C[AgentCoordinator] + D["📊 コンテキスト構築
price · kline · news · indicators"] + end - C --> E - E -->|get_memories / add_memory| M[(SQLite: data/memory/*_memory.db)] - C --> R[ReflectionService.record_analysis] - R --> RR[(SQLite: data/memory/reflection_records.db)] - W[ReflectionWorker(任意)] --> RR - W -->|期限到来を検証し学習| M - A2[POST /api/analysis/reflect] -->|手動で学習| M + %% ===== 🤖 マルチエージェントワークフロー ===== + subgraph Agents["🤖 マルチエージェントワークフロー"] + + subgraph P1["📈 Phase 1 · 多次元分析(並列)"] + E1["🔍 MarketAnalyst
テクニカル"] + E2["📑 FundamentalAnalyst
ファンダメンタル"] + E3["📰 NewsAnalyst
ニュース"] + E4["💭 SentimentAnalyst
センチメント"] + E5["⚠️ RiskAnalyst
リスク評価"] + end + + subgraph P2["🎯 Phase 2 · 強気弱気論争(並列)"] + F1["🐂 BullResearcher
強気の論点"] + F2["🐻 BearResearcher
弱気の論点"] + end + + subgraph P3["💹 Phase 3 · 取引判断"] + G["🎰 TraderAgent
総合判定 → BUY / SELL / HOLD"] + end + + end + + %% ===== 🧠 記憶層 ===== + subgraph Memory["🧠 ローカル SQLite 記憶庫(data/memory/)"] + M1[("market_analyst")] + M2[("fundamental")] + M3[("news_analyst")] + M4[("sentiment")] + M5[("risk_analyst")] + M6[("bull_researcher")] + M7[("bear_researcher")] + M8[("trader_agent")] + end + + %% ===== 🔄 反省ループ ===== + subgraph Reflect["🔄 反省ループ(オプション)"] + R[ReflectionService] + RR[("reflection_records.db")] + W["⏰ ReflectionWorker"] + end + + %% ===== メインフロー ===== + A --> B --> C --> D + D --> P1 --> P2 --> P3 + + %% ===== 記憶読み書き ===== + E1 <-.-> M1 + E2 <-.-> M2 + E3 <-.-> M3 + E4 <-.-> M4 + E5 <-.-> M5 + F1 <-.-> M6 + F2 <-.-> M7 + G <-.-> M8 + + %% ===== 反省フロー ===== + C --> R --> RR + W --> RR + W -.->|"検証 + 学習"| M8 + A2 -.->|"手動復習"| M8 ``` #### 検索ランキング(簡略) diff --git a/README_KO.md b/README_KO.md index e6cf0b7..d221e56 100644 --- a/README_KO.md +++ b/README_KO.md @@ -126,22 +126,80 @@ QuantDinger의 에이전트는 매번 “처음부터” 시작하지 않습니 #### 흐름도(요청 → 메모리 폐루프) ```mermaid -flowchart TD - A[POST /api/analysis/multi] --> B[AnalysisService] - B --> C[AgentCoordinator] - C --> D[컨텍스트 구성: price/kline/news/indicators] +flowchart TB + %% ===== 🌐 진입 레이어 ===== + subgraph Entry["🌐 API 진입점"] + A["📡 POST /api/analysis/multi"] + A2["🔄 POST /api/analysis/reflect"] + end - subgraph Agents[Agents] - E[Analysts + Researchers + Trader] - end + %% ===== ⚙️ 서비스 레이어 ===== + subgraph Service["⚙️ 서비스 오케스트레이션"] + B[AnalysisService] + C[AgentCoordinator] + D["📊 컨텍스트 구성
price · kline · news · indicators"] + end - C --> E - E -->|get_memories / add_memory| M[(SQLite: data/memory/*_memory.db)] - C --> R[ReflectionService.record_analysis] - R --> RR[(SQLite: data/memory/reflection_records.db)] - W[ReflectionWorker(옵션)] --> RR - W -->|만기 검증 + 학습 반영| M - A2[POST /api/analysis/reflect] -->|수동 학습| M + %% ===== 🤖 멀티에이전트 워크플로우 ===== + subgraph Agents["🤖 멀티에이전트 워크플로우"] + + subgraph P1["📈 Phase 1 · 다차원 분석(병렬)"] + E1["🔍 MarketAnalyst
기술적 분석"] + E2["📑 FundamentalAnalyst
펀더멘털"] + E3["📰 NewsAnalyst
뉴스"] + E4["💭 SentimentAnalyst
심리"] + E5["⚠️ RiskAnalyst
리스크 평가"] + end + + subgraph P2["🎯 Phase 2 · 강세/약세 논쟁(병렬)"] + F1["🐂 BullResearcher
강세 논거"] + F2["🐻 BearResearcher
약세 논거"] + end + + subgraph P3["💹 Phase 3 · 거래 결정"] + G["🎰 TraderAgent
종합 판단 → BUY / SELL / HOLD"] + end + + end + + %% ===== 🧠 메모리 레이어 ===== + subgraph Memory["🧠 로컬 SQLite 메모리(data/memory/)"] + M1[("market_analyst")] + M2[("fundamental")] + M3[("news_analyst")] + M4[("sentiment")] + M5[("risk_analyst")] + M6[("bull_researcher")] + M7[("bear_researcher")] + M8[("trader_agent")] + end + + %% ===== 🔄 리플렉션 루프 ===== + subgraph Reflect["🔄 리플렉션 루프(옵션)"] + R[ReflectionService] + RR[("reflection_records.db")] + W["⏰ ReflectionWorker"] + end + + %% ===== 메인 흐름 ===== + A --> B --> C --> D + D --> P1 --> P2 --> P3 + + %% ===== 메모리 읽기/쓰기 ===== + E1 <-.-> M1 + E2 <-.-> M2 + E3 <-.-> M3 + E4 <-.-> M4 + E5 <-.-> M5 + F1 <-.-> M6 + F2 <-.-> M7 + G <-.-> M8 + + %% ===== 리플렉션 흐름 ===== + C --> R --> RR + W --> RR + W -.->|"검증 + 학습"| M8 + A2 -.->|"수동 회고"| M8 ``` #### 검색 랭킹(간략) diff --git a/README_TW.md b/README_TW.md index 3ea6d34..8d47e9e 100644 --- a/README_TW.md +++ b/README_TW.md @@ -126,50 +126,80 @@ QuantDinger 的多智能體不是「每次從零開始」。後端內建**本地 #### 邏輯圖(從請求到記憶閉環) ```mermaid -flowchart TD - A[POST /api/analysis/multi] --> B[AnalysisService] - B --> C[AgentCoordinator] +flowchart TB + %% ===== 🌐 入口層 ===== + subgraph Entry["🌐 API 入口"] + A["📡 POST /api/analysis/multi"] + A2["🔄 POST /api/analysis/reflect"] + end - C --> D[建構上下文: price/kline/news/indicators] + %% ===== ⚙️ 服務編排層 ===== + subgraph Service["⚙️ 服務編排"] + B[AnalysisService] + C[AgentCoordinator] + D["📊 建構上下文
price · kline · news · indicators"] + end - subgraph Agents[多智能體並行/串行工作流] - E1[MarketAnalyst] - E2[FundamentalAnalyst] - E3[NewsAnalyst] - E4[SentimentAnalyst] - E5[RiskAnalyst] - F1[BullResearcher] - F2[BearResearcher] - G[TraderAgent] - end + %% ===== 🤖 多智能體工作流 ===== + subgraph Agents["🤖 多智能體工作流"] - C -->|Phase 1 並行| E1 - C -->|Phase 1 並行| E2 - C -->|Phase 1 並行| E3 - C -->|Phase 1 並行| E4 - C -->|Phase 1 並行| E5 - C -->|Phase 2 並行| F1 - C -->|Phase 2 並行| F2 - C -->|Phase 3| G + subgraph P1["📈 Phase 1 · 多維分析(並行)"] + E1["🔍 MarketAnalyst
技術面分析"] + E2["📑 FundamentalAnalyst
基本面分析"] + E3["📰 NewsAnalyst
新聞輿情"] + E4["💭 SentimentAnalyst
市場情緒"] + E5["⚠️ RiskAnalyst
風險評估"] + end - subgraph MemDB[本地 SQLite 記憶庫(按角色拆分)] - M1[(data/memory/*_memory.db)] - end + subgraph P2["🎯 Phase 2 · 多空博弈(並行)"] + F1["🐂 BullResearcher
看多論據"] + F2["🐻 BearResearcher
看空論據"] + end - E1 <-->|get_memories / add_memory| M1 - E2 <-->|get_memories / add_memory| M1 - E3 <-->|get_memories / add_memory| M1 - E4 <-->|get_memories / add_memory| M1 - E5 <-->|get_memories / add_memory| M1 - F1 <-->|get_memories / add_memory| M1 - F2 <-->|get_memories / add_memory| M1 - G <-->|get_memories / add_memory| M1 + subgraph P3["💹 Phase 3 · 交易決策"] + G["🎰 TraderAgent
綜合研判 → BUY / SELL / HOLD"] + end - C --> R[ReflectionService.record_analysis] - R --> RR[(data/memory/reflection_records.db)] - W[ReflectionWorker(可選,定時)] --> RR - W -->|到期驗證 + 寫回經驗| M1 - A2[POST /api/analysis/reflect(手動復盤)] -->|reflect_and_learn| M1 + end + + %% ===== 🧠 記憶層 ===== + subgraph Memory["🧠 本地記憶庫 SQLite(data/memory/)"] + M1[("market_analyst")] + M2[("fundamental")] + M3[("news_analyst")] + M4[("sentiment")] + M5[("risk_analyst")] + M6[("bull_researcher")] + M7[("bear_researcher")] + M8[("trader_agent")] + end + + %% ===== 🔄 反思閉環 ===== + subgraph Reflect["🔄 反思閉環(可選)"] + R[ReflectionService] + RR[("reflection_records.db")] + W["⏰ ReflectionWorker"] + end + + %% ===== 主流程 ===== + A --> B --> C --> D + D --> P1 --> P2 --> P3 + + %% ===== 記憶讀寫 ===== + E1 <-.-> M1 + E2 <-.-> M2 + E3 <-.-> M3 + E4 <-.-> M4 + E5 <-.-> M5 + F1 <-.-> M6 + F2 <-.-> M7 + G <-.-> M8 + + %% ===== 反思流程 ===== + C --> R --> RR + W --> RR + W -.->|"驗證 + 學習"| M8 + A2 -.->|"手動復盤"| M8 ``` #### 檢索排序(簡化)