{"id":50808581,"url":"https://github.com/frostrain5015/investory","last_synced_at":"2026-06-13T03:05:47.704Z","repository":{"id":358787630,"uuid":"1243018162","full_name":"Frostrain5015/Investory","owner":"Frostrain5015","description":"Multi-market portfolio tracker with quant analytics, backtesting \u0026 AI copilot.","archived":false,"fork":false,"pushed_at":"2026-06-12T11:46:02.000Z","size":34748,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-06-12T13:23:48.876Z","etag":null,"topics":["data-analysis","finance","investment"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Frostrain5015.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-05-19T01:22:14.000Z","updated_at":"2026-06-12T11:46:07.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/Frostrain5015/Investory","commit_stats":null,"previous_names":["frostrain5015/investory"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/Frostrain5015/Investory","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frostrain5015%2FInvestory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frostrain5015%2FInvestory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frostrain5015%2FInvestory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frostrain5015%2FInvestory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Frostrain5015","download_url":"https://codeload.github.com/Frostrain5015/Investory/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frostrain5015%2FInvestory/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34270418,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-13T02:00:06.617Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-analysis","finance","investment"],"created_at":"2026-06-13T03:05:28.453Z","updated_at":"2026-06-13T03:05:47.691Z","avatar_url":"https://github.com/Frostrain5015.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"**[English](./README.md) | [中文](./README_zh-CN.md)**\n\n# Investory\n\nA full-featured personal investment portfolio tracker with quantitative analysis, strategy backtesting, and an AI-powered investment assistant.\n\nSupports A-shares (Shanghai/Shenzhen), Hong Kong stocks, and US equities with multi-currency P\u0026L tracking.\n\n---\n\n## Features\n\n### Portfolio Management\n- Multiple independent portfolios per user\n- BUY / SELL / TRANSFER_IN / TRANSFER_OUT transactions\n- Dividend recording with per-share amount tracking\n- Cash balance breakdown by currency (CNY / HKD / USD)\n- Closed positions history\n\n### Dashboard\n- Total asset value curve with selectable time ranges (1M / 6M / 1Y / all / custom)\n- Today's P\u0026L and cumulative P\u0026L summary cards\n- Position allocation — toggle between pie chart and word cloud\n- P\u0026L ranking across holdings — cumulative or daily\n\n### Holdings \u0026 Watchlist\n- Drag-to-reorder watchlist\n- 30-day price sparkline per stock\n- Optional quantitative columns: Beta, volatility, historical percentile\n- Inline distinction between held positions and watched-only stocks\n\n### Market Overview\n- Interactive world map with country-level index performance coloring\n- Live indices: Shanghai Composite, Hang Seng, S\u0026P 500 and more\n- Real-time exchange rates (CNY / HKD / USD)\n- Geolocated news pins (finance / geopolitics) with click-through links\n\n### P\u0026L Calendar\n- Yearly heat-map grid (12 months) and monthly day-level calendar\n- Color intensity mapped to P\u0026L amount or return percentage\n- Click any cell for a breakdown: per-stock contribution and transactions that day\n\n### Quantitative Analysis\n- **Risk tab**: portfolio style diagnosis (growth / value / defensive), weighted Beta, allocation chart, optimization recommendations\n- **Backtest tab**:\n  - Simple rule builder — SMA, EMA, RSI, MACD, Bollinger Bands, Volume, KDJ, stop-loss, take-profit conditions\n  - Advanced Python strategy editor for custom logic\n  - Real-time progress stream during backtest execution (SSE)\n  - Equity curve with buy/sell markers, Sharpe ratio, max drawdown, win rate, profit factor\n\n### AI Assistant — Guanlan\n- Floating chat panel with multi-turn conversation\n- Streaming token-by-token responses via SSE\n- Deep thinking mode for complex analysis\n- Tool use: can trigger portfolio analysis and backtests mid-conversation\n- Saves AI-generated strategies directly to the backtest library\n- Configurable provider: Alibaba Cloud Bailian, OpenAI, DeepSeek, Moonshot, Zhipu GLM, Anthropic Claude, or any OpenAI-compatible endpoint\n\n### Settings\n- Light / dark / system theme\n- Color scheme: red-up/green-down (A-share convention) or green-up/red-down (international)\n- Base currency selection\n- Avatar upload\n- Password change and account deletion\n\n### Admin Panel\n- Live database status: table sizes, stock counts, price row counts per market\n- Data crawler control: start / pause / resume / stop per market\n- Crawl history audit log\n- User management: list, delete, impersonate\n\n---\n\n## Tech Stack\n\n### Backend\n\n| | |\n|---|---|\n| Language | Java 17 |\n| Framework | Spring Boot 3.3.5 |\n| Database | MySQL (JdbcTemplate — no ORM) |\n| JSON | Gson 2.10.1 |\n| Password hashing | jBCrypt 0.4 |\n| Pinyin search | Pinyin4j 2.5.1 |\n| Build | Maven 3.x |\n\n### Frontend\n\n| | |\n|---|---|\n| Framework | React 19 |\n| Language | TypeScript |\n| Build tool | Vite 8 |\n| Routing | React Router 7 |\n| Styling | Tailwind CSS 4 |\n| Component primitives | Radix UI |\n| Charts | Recharts 3 · ECharts 6 |\n| Animation | Framer Motion 12 |\n| Icons | Lucide React |\n\n### Desktop\n\n| | |\n|---|---|\n| Framework | Electron 33 |\n| Auto-update | electron-updater |\n| Build tool | electron-builder |\n\n### Python Scripts\n\n| | |\n|---|---|\n| Runtime | Python 3.8+ |\n| Data fetching | Yahoo Finance, Sina Finance, East Money |\n| AI Agent | Custom agent framework with tool use |\n| Backtesting | Custom backtest engine |\n\n---\n\n## Project Structure\n\n```\ninvestory/\n├── backend/                          # Spring Boot (Maven)\n│   ├── pom.xml                       # parent: spring-boot-starter-parent 3.3.5, Java 17\n│   ├── src/main/java/com/investory/\n│   │   ├── InvestoryApplication.java # main class, @SpringBootApplication\n│   │   ├── controller/               # page controllers + api/ REST controllers\n│   │   ├── dao/                      # @Repository + JdbcTemplate (via BaseDao)\n│   │   ├── service/                  # @Service\n│   │   ├── model/                    # POJOs\n│   │   ├── crawler/                  # @Component, @Scheduled\n│   │   └── config/                   # WebConfig (interceptors, static resources)\n│   └── src/main/resources/\n│       ├── application.properties    # datasource, server.servlet.context-path=/investory\n│       ├── templates/                # Thymeleaf HTML\n│       └── static/                   # built frontend output (Vite writes here)\n├── frontend/\n│   ├── package.json                  # scripts: dev, build (tsc -b \u0026\u0026 vite build)\n│   ├── vite.config.ts                # proxy /investory → localhost:8443, base: /investory/\n│   └── src/\n│       ├── pages/                    # Dashboard, Holdings, Transactions, PnlCalendar, StockDetail, Portfolio, Settings\n│       ├── components/               # Layout, CloudChart, ui/*\n│       ├── hooks/                    # useAuth, useSettings\n│       ├── services/api.ts           # API client (prefix /investory)\n│       └── types/index.ts            # TypeScript interfaces\n├── desktop/\n│   ├── main.js                       # Electron main process\n│   ├── preload.js                    # Preload script (context isolation)\n│   ├── package.json                  # electron-builder configuration\n│   └── assets/                       # App icons and installer images\n└── script/\n    ├── ai_agent.py                   # AI investment assistant (Guanlan)\n    ├── backtest_engine.py            # Strategy backtesting engine\n    ├── fetch_stocks.py               # Market data crawler (A-shares, HK, US)\n    ├── fetch_news.py                 # Financial news aggregator\n    ├── analyze_quant.py              # Quantitative analysis\n    ├── portfolio_style_analyzer.py   # Portfolio style diagnosis\n    ├── optimizer.py                  # Portfolio optimization\n    ├── config.ini                    # Configuration (copy from config.ini.example)\n    └── agent_skills/                 # AI agent tool definitions\n```\n\n---\n\n## Live Demo\n\nThe project is deployed on a cloud server. You can access it directly at:\n\n**https://116.62.179.231:8443/investory/**\n\n\u003e **Note**: The server uses a self-signed SSL certificate. Your browser may show a security warning — click \"Advanced\" → \"Proceed\" to continue.\n\n---\n\n## Getting Started\n\n### Prerequisites\n\n- Java 17\n- Maven 3.9+\n- Node.js 20+ / npm\n- Python 3.8+\n- MySQL 8\n\n### Database\n\nCreate a schema and update credentials in `backend/src/main/resources/application.properties`:\n\n```sql\nCREATE DATABASE investory_db CHARACTER SET utf8mb4;\n```\n\n### Backend (Spring Boot)\n\nThe Maven build automatically compiles the frontend (`tsc -b \u0026\u0026 vite build`) and copies the output into `backend/src/main/resources/static/` before packaging the JAR.\n\n**Full stack build + run:**\n\n```bash\nexport JAVA_HOME=/path/to/jdk-17\nmvn -f backend/pom.xml spring-boot:run -DskipTests\n```\n\n**Build production JAR:**\n\n```bash\nmvn -f backend/pom.xml package -DskipTests\njava -jar backend/target/investory.jar\n```\n\nApp is served at `https://localhost:8443/investory/`.\n\n### Frontend (Vite)\n\n**Development (hot-reload):**\n\n```bash\ncd frontend\nnpm install\nnpm run dev\n# → http://localhost:5173/investory/\n# API calls are proxied to localhost:8443\n```\n\n**Build only:**\n\n```bash\ncd frontend\nnpm run build\n# Output goes to ../backend/src/main/resources/static/\n```\n\n### Python Scripts\n\nInstall dependencies:\n\n```bash\ncd script\npip install -r requirements.txt\n```\n\nConfigure database and proxy settings:\n\n```bash\ncp config.ini.example config.ini\n# Edit config.ini with your MySQL credentials and proxy settings\n```\n\nRun market data crawler:\n\n```bash\npython fetch_stocks.py --market a      # A-shares\npython fetch_stocks.py --market hk     # Hong Kong\npython fetch_stocks.py --market us     # US stocks\n```\n\nRun AI assistant:\n\n```bash\npython ai_agent.py\n```\n\n### Desktop (Electron)\n\n**Development:**\n\n```bash\ncd desktop\nnpm install\nnpm run build:frontend    # Build frontend for Electron\nnpm start                 # Launch Electron app\n```\n\n**Build installer:**\n\n```bash\ncd desktop\nnpm run build:exe         # Build NSIS installer (.exe)\nnpm run build:msi         # Build MSI installer\n```\n\n---\n\n## API Overview\n\n| Group | Endpoints |\n|---|---|\n| Auth | `GET /api/session` · `POST /api/password` · `DELETE /api/account` |\n| Portfolios | CRUD `/api/portfolios` · `POST /api/portfolio/refresh` |\n| Dashboard | `GET /api/dashboard` · `GET /api/cash` · `GET /api/closed-positions` |\n| Holdings | `GET /api/holdings` |\n| Transactions | CRUD `/api/transactions` |\n| Dividends | CRUD `/api/dividends` |\n| Stocks | `GET /api/search` · `GET /api/quote/{symbol}` · `GET /api/chart` · `GET /api/stocks/{symbol}` |\n| P\u0026L | `GET /api/daily-detail` · `GET /api/monthly-detail` |\n| Watchlist | CRUD `/api/watchlist` · `PUT /api/watchlist/reorder` |\n| Market | `GET /api/market/indices` · `/exchange-rates` · `/news` |\n| Quant | `GET /api/quant/holdings-metrics` · `/portfolio-style` · `/portfolio-scenario` |\n| Backtest | CRUD `/api/backtest/strategies` · `POST /api/backtest/start` · `GET /api/backtest/stream` (SSE) |\n| AI | `POST /api/ai/chat` · `GET /api/ai/stream` (SSE) · `GET/POST /api/ai/settings` |\n| Admin | `/api/admin/status` · `/users` · `/crawl-history` · `/crawl/{market}` |\n\n---\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrostrain5015%2Finvestory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrostrain5015%2Finvestory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrostrain5015%2Finvestory/lists"}