About this project

# Finance Assistant · licai **Put A-shares / funds / bank wealth management / cash / digital assets / quant bots into one dashboard**, plus market AI Q&A, stock details (K-line/order book/intraday), full-market rankings, sector radar, global indices, morning briefs, and post-market review attribution. **No cloud · No accounts · All data runs on your own machine**, stored in a single SQLite file, easily copied, deleted, or backed up anytime. **Provides objective information only, no buy/sell advice.** ## Feature Map | Module | One-liner | |---|---| | Ask the Market | Q&A agent with 40 data tools, decides which tools to call for data and interprets objectively | | All-Asset Dashboard | Six categories on one screen, including fee-inclusive costs, share-split auto-entry, concentration, and same-source risk | | Sector Radar | Real-time alpha for each stock vs. Tonghuashun industry, plus sentiment cycle timeline and sector turnover share migration | | Morning Brief / Closing Summary | 9:00 objective info summary + risk alerts; 15:10 full-portfolio floating attribution + event zone | | Allocation Suggestions | Conservative/Balanced/Aggressive templates showing current vs. target gaps | | Fund Proxy Targets | Pulls real top-10 holdings' real-time moves to fill the intraday blind spot of T+1 NAV for OTC funds | | Full-Market Rankings | Nine tabs + concept rotation board + broker-grade K-line overlay + Dragon-Tiger list seat profiles + order book anomalies | | Risk Alerts | Concentration / same-source exposure after fund look-through / fundamental red-yellow lights, warns only, no signals | | Stock Detail Page | Multi-timeframe K-line + own buy/sell points + chip distribution + five-level order book + tick-by-tick trades + panic exit index / institutional accumulation tags | | News Feed + AI Interpretation | Five sources merged, three-part interpretation: "What it says / Why it matters / How it relates to your holdings" | | ETF Theme Insight | Uses real quarterly-report holdings vs. claimed theme, targets fake-theme ETFs | | Review | TWR NAV curve vs. CSI 300 + holdings correlation matrix + daily portfolio attribution + buy-point retrospective | | Global Index Bar | Top bar switches across 16 indices, click for K-line/intraday | ## Quick Start ```bash git clone https://github.com/SnowWarri0r/licai cd licai # Python backend python3 -m venv venv && source venv/bin/activate pip install -r requirements.txt # Copy config template cp config.example.py config.py # Frontend build cd frontend && npm install && npm run build && cd .. # Start python run.py # Visit http://localhost:8888 ``` First launch auto-creates an empty SQLite (`portfolio.db`) in the project root. ### Demo Mode ```bash python scripts/seed_demo.py --use # Backup your DB + write demo data python scripts/seed_demo.py --restore # Restore real DB after viewing ``` ### Optional Configurations - **Feishu Notifications**: Settings → Feishu Webhook → paste URL and save, all pushes go there - **Exchange Auto-Sync**: Settings → Exchange → fill API Key + Secret + Passphrase (recommend read-only permissions only) - **LLM Morning Brief**: Requires Claude API credentials (OAuth or API key), works without it too - **Tongdaxin Data Source**: Intraday / weekly-monthly K / order book / tick-by-tick need local Tongdaxin protocol service, works without it (detail page narrows to just "Daily" tab) - **Knowledge Planet**: Read-only opinion feed via official MCP endpoint, five constraints (read-only whitelist / can narrow by planet owner / originals not stored / attachments read on demand / separate credibility tier) - **Extended Data Sources**: Provider plugin protocol, defines interfaces only without implementations, installed ≠ enabled - **Analysis Plugins**: Analyzer adds a computation layer on existing market data, inputs forward-adjusted daily K and outputs structured interpretation ## Core Capabilities ### 1. All-Asset Dashboard Six categories in one stop: A-shares (real-time quotes, fee-inclusive costs), funds (real-time market price for listed ETFs, official NAV for OTC public funds), wealth management (bank T+30 locked type), cash (T+0 money market funds + bank demand deposits), digital assets (exchange spot real-time), bots (grid / DCA auto-synced P&L). - Share splits auto-detected and booked, P&L uses diluted cost basis - Category pie chart + subcategory subtotals, concentration warnings + look-through same-source detection - Add-position 4 modes: buy by shares / principal + NAV / principal + shares / pending confirmation ### 2. Sector Radar Real-time comparison of each A-share vs. Tonghuashun industry sector (90 fine-grained sectors auto-matched), sentiment cycle timeline (last 30 trading days with four series: limit-up / limit-down / money-making effect / max consecutive limit-up height), sector turnover share (90 industries' share of total market turnover + share migration). ### 3. Morning LLM Brief + Closing Summary Morning brief auto-runs daily at 9:00, based on recent news + announcements + K-line + fundamental health for each holding, giving objective info summary + risk alerts, no action advice. Closing summary auto-generates at 15:10, pure data assembly without LLM, includes today's floating P&L sorted by contribution + event zone + one-line market overview. ### 4. Allocation Suggestions 3 preset templates (Conservative / Balanced / Aggressive) × 4 tiers by total assets, showing current vs. target allocation + how much to add / reduce. 10 buckets look through by "substance"—ETF / QDII first classified to underlying buckets. ### 5. Fund Proxy Targets Pulls real top-10 holdings' real-time weighted moves for prediction, with A-share / HK / US stock real-time quotes all via Sina free API. Once historical NAV exists, auto-switches to ridge regression estimation (regressing last 120 NAV days against an index set). ### 6. Full-Market Rankings Nine tabs (watchlist / order book anomalies / gainers / turnover leaders / Dragon-Tiger list / accumulation-strength / institutional / earnings / capital heat) + free stock search + K-line overlay + AI drawer. Rotation board clusters the same list by concept/industry to see where money flows. ### 7. Risk Alerts - Portfolio volatility: EWMA covariance, gives "next trading day / 5 trading days, max loss in yuan at 95% confidence" - Single sector > 50% / 70% concentration warnings - Look-through same-source risk: breaks funds/ETFs into top-10 quarterly holdings, merges direct and indirect holdings of the same target - Fundamental health red/yellow lights ### 8. Stock Detail Page Multi-timeframe K-line (daily / weekly / monthly) + own buy/sell point markers + chip distribution + same-day intraday (tick-precision toggle) + five-level order book + tick-by-tick trades. Historical intraday uses previous close baseline with accurate ex-rights restoration. ### 9. News Feed + AI Interpretation Five sources merged (Eastmoney + CLS + Tonghuashun + Jin10 + others), three-part interpretation "What it says / Why it matters / How it relates to your holdings". ### 10. ETF Theme Insight Uses real quarterly-report holdings vs. claimed theme, targets fake-theme ETFs. ### 11. Review TWR NAV curve vs. CSI 300 + holdings correlation matrix + daily portfolio attribution + closing market panorama + buy-point retrospective (each buy grouped by then-status, showing how it actually played out). ## Ask the Market · Market AI Q&A A Q&A agent with 40 data tools (plus Knowledge Planet +3, extended data sources +4, full config 47), freely ask about stock moves / market style / capital mainline / industry chain / your own trades. Tools cover seven dimensions: quotes/trends, capital flows, earnings, fundamentals/company profile, news, my holdings, industry chain panorama. Several cross-cutting "market-reading principles": - Bare K-line price-volume as the main axis, capital flows only as clues - Credibility tiers + traceability ([Verified] / [Online] / [Pending] / [Planet View]) - Distinguish "happening now" from "background context" - US stocks clearly segmented by session - Strictly no action advice output ## Tech Stack - Python 3.9+ / FastAPI backend - React + Vite frontend - SQLite local-first storage - PWA installable ## Disclaimer This project provides objective information only, no buy/sell advice. All data comes from public APIs; users bear their own usage risk.