Files
daily_stock_analysis/requirements.txt
Alfred b19a4d0df9 feat: 支持图片识别股票代码、Anthropic Claude API 及通达信手动配置 (fix #257) (#329)
* feat: Add image stock code extraction, Anthropic API, and Pytdx config (Fixes #257)

- Add POST /api/v1/stocks/extract-from-image with Vision LLM (Gemini/Anthropic/OpenAI)
- Add image_stock_extractor service with 60s timeout, rate limit (10/min), X-Forwarded-For support
- Add ImageStockExtractor UI in Settings for upload and merge-to-watchlist
- Add ANTHROPIC_API_KEY, ANTHROPIC_MODEL to config and analyzer fallback chain
- Add PYTDX_HOST, PYTDX_PORT, PYTDX_SERVERS for custom Pytdx server
- Add OPENAI_VISION_MODEL for image-only models
- Handle 409 conflict in merge flow with user-friendly message

* fix: resolve TypeScript build error in stocks.ts (avoid Record<> generic parsing)

* feat: Redis rate limiter, API field unification, anthropic_max_tokens

- Add rate_limiter.py: Memory + Redis implementations for extract-from-image
- Integrate get_extract_rate_limiter() in stocks.py; remove image param, keep file only
- Add anthropic_max_tokens config for analyzer
- Update .env.example, config_registry, full-guide, CHANGELOG
- Add redis>=5.0 as optional dependency

* refactor: rename GeminiAnalyzer to LLMAnalyzer for multi-backend clarity

* revert: restore GeminiAnalyzer naming (keep original upstream convention)

* docs: add image extraction and from-image-add usage to README

* fix: Anthropic runtime fallback to OpenAI; remove Redis rate limiter

- Init both Anthropic and OpenAI at startup so Anthropic 429/network glitch can fall back to OpenAI
- Check Anthropic before OpenAI in _call_api_with_retry to preserve priority
- Remove Redis rate limiter per review; keep in-memory only

* remove rate limiter for extract-from-image per review

- Delete rate_limiter.py; extract-from-image has no rate limiting
- Remove Request param and 429 response from stocks endpoint
- Update docs to drop rate limit mentions
2026-02-15 19:10:42 +08:00

56 lines
2.2 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ===================================
# A股自选股智能分析系统 - 依赖列表
# ===================================
# 核心依赖
python-dotenv>=1.0.0 # 环境变量配置管理
tenacity>=8.2.0 # 重试机制(指数退避)
sqlalchemy>=2.0.0 # ORM数据库操作
schedule>=1.2.0 # 定时任务调度
# 数据源依赖(多源策略,按优先级排序)
efinance>=0.5.5 # Priority 0: 东方财富数据源最高优先级https://github.com/Micro-sheep/efinance
akshare>=1.12.0 # Priority 1: 东方财富爬虫数据源
tushare>=1.4.0 # Priority 2: 挖地兔 Pro API
pytdx>=1.72 # Priority 2: 通达信行情服务器
baostock>=0.8.0 # Priority 3: 证券宝数据
yfinance>=0.2.0 # Priority 4: Yahoo Finance (Fallback)
#飞书
lark-oapi>=1.0.0 # 飞书API
# 数据处理
pandas>=2.0.0 # 数据分析
numpy>=1.24.0 # 数值计算
json-repair>=0.55.1 # JSON 修复
# AI 分析
google-generativeai>=0.8.0 # Gemini API
anthropic>=0.18.0 # Anthropic Claude API可选
openai>=1.0.0 # OpenAI 兼容 API可选支持 DeepSeek/通义千问等)
# 搜索引擎(用于获取股票新闻)
tavily-python>=0.3.0 # Tavily 搜索 API每月 1000 次免费)
google-search-results>=2.4.0 # SerpAPI每月 100 次免费)
# 网络请求
requests>=2.31.0 # HTTP 请求
markdown2>=2.4.0 # Markdown 转 HTML
imgkit>=1.2.0 # Markdown 转图片(需安装 wkhtmltopdf
fake-useragent>=1.4.0 # 随机 User-Agent 防封禁
httpx[socks] # HTTP 客户端 + SOCKS 代理支持OpenAI 可选依赖)
dingtalk-stream >= 0.24.3 # 钉钉 Stream SDK
# 数据库
# SQLite 是 Python 内置,无需额外安装
# Discord 机器人
discord.py>=2.0.0 # Discord 机器人开发库
# Web Content Extraction
newspaper3k>=0.2.8 # Article extraction
lxml_html_clean # Fix for lxml.html.clean ImportError in newer lxml versions
# FastAPI Web 框架
fastapi>=0.109.0 # 现代 Python Web 框架
uvicorn[standard]>=0.27.0 # ASGI 服务器