What Ghostfolio Does
Ghostfolio provides comprehensive investment tracking:
- Portfolio Dashboard: Real-time overview of all holdings with current values and gains/losses
- Multi-Asset Support: Stocks, ETFs, bonds, mutual funds, cryptocurrencies, commodities, and real estate
- Performance Analytics: Time-weighted return (TWR), money-weighted return (MWR), and historical performance charts
- Dividend Tracking: Track dividend income across all holdings with calendar view
- Market Data: Automatic price feeds from Yahoo Finance, Google Finance, and other providers
- Multi-Currency: Support for portfolios across multiple currencies with automatic conversion
- Allocation Analysis: Asset allocation by type, sector, region, and account
Architecture
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Angular │────▶│ NestJS │────▶│ PostgreSQL │
│ Frontend │ │ API Server │ │ (Prisma ORM)│
└──────────────┘ └──────┬───────┘ └──────────────┘
│
┌──────┴───────┐
│ Redis │
│ (Cache) │
└──────────────┘Self-Hosting
Docker Compose
services:
ghostfolio:
image: ghostfolio/ghostfolio:latest
ports:
- "4200:3333"
environment:
DATABASE_URL: postgresql://ghostfolio:ghostfolio@postgres:5432/ghostfolio
REDIS_HOST: redis
REDIS_PORT: 6379
ACCESS_TOKEN_SALT: your-random-salt
JWT_SECRET_KEY: your-jwt-secret
depends_on:
- postgres
- redis
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: ghostfolio
POSTGRES_PASSWORD: ghostfolio
POSTGRES_DB: ghostfolio
volumes:
- pg-data:/var/lib/postgresql/data
redis:
image: redis:7-alpine
volumes:
- redis-data:/data
volumes:
pg-data:
redis-data:Key Features
Activity Import
Import transactions from CSV files or connect to brokerages:
Date,Symbol,Type,Quantity,Price,Currency,Fee
2024-01-15,AAPL,BUY,10,185.50,USD,1.00
2024-01-20,VWCE.DE,BUY,5,108.20,EUR,0.00
2024-02-01,BTC,BUY,0.05,42500,USD,5.00Portfolio Allocation View
Ghostfolio breaks down your portfolio by:
- Asset Class: Equity, Fixed Income, Real Estate, Commodities, Cash
- Region: Americas, Europe, Asia Pacific, Emerging Markets
- Sector: Technology, Healthcare, Finance, Energy, etc.
- Account: Brokerage accounts, retirement accounts, crypto wallets
- Currency: Holdings grouped by base currency
Fire Calculator
Built-in Financial Independence / Retire Early (FIRE) calculator:
- Project when you can retire based on savings rate and expected returns
- Adjust for inflation and spending patterns
- Compare different withdrawal strategies (4% rule, variable)
API Access
# Get portfolio summary
curl http://localhost:4200/api/v1/portfolio/summary
-H "Authorization: Bearer YOUR_TOKEN"
# Get holdings
curl http://localhost:4200/api/v1/portfolio/holdings
-H "Authorization: Bearer YOUR_TOKEN"Ghostfolio vs Alternatives
| Feature | Ghostfolio | Portfolio Performance | Wealthica | Mint/Copilot |
|---|---|---|---|---|
| Open Source | Yes (AGPL-3.0) | Yes (EPL-1.0) | No | No |
| Self-hosted | Yes | Desktop app | No | No |
| Multi-currency | Yes | Yes | Yes | Limited |
| Crypto | Yes | Limited | Yes | No |
| Dividends | Yes | Yes | Yes | No |
| Web-based | Yes | No (Java desktop) | Yes | Yes |
| FIRE tools | Yes | No | No | No |
常见问题
Q: Ghostfolio 如何获取市场数据? A: 默认使用 Yahoo Finance API 获取实时和历史价格。也支持 Google Finance、CoinGecko(加密货币)等数据源。自托管版本无需付费 API key。
Q: 支持中国A股吗? A: 支持。通过 Yahoo Finance 可以获取上证(.SS)和深证(.SZ)股票数据。例如贵州茅台可以用 600519.SS 添加。
Q: 数据安全吗? A: 自托管版本所有数据存储在你自己的 PostgreSQL 数据库中,不会发送到任何第三方服务器。只有市场数据查询会访问外部 API。
来源与致谢
- GitHub: ghostfolio/ghostfolio — 8.1K+ ⭐ | AGPL-3.0
- 官网: ghostfol.io