Crypto & Investing — Finance Stack Integration
Finance Stack Integration¶
The Investment Coach pulls context from four self-hosted finance services already running in the homelab. This is what turns generic market analysis into personalized recommendations.
Why Integration Matters¶
Without portfolio context, every analysis is generic: "AAPL looks strong." With integration, the same analysis becomes: "AAPL looks strong, but you already hold 23% of your portfolio in AAPL — adding more increases concentration risk. You have $500 investable this month — here's how to allocate it across your current under-weighted sectors."
Services Used¶
| Service | Port | Role | Endpoints |
|---|---|---|---|
| Ghostfolio | :3333 |
Portfolio holdings & P&L | /api/v1/portfolio/holdings, /api/v1/portfolio/performance, /api/v1/order |
| Firefly III | :8695 |
Budget & investable cash | /api/v1/accounts?type=asset, /api/v1/budgets |
| OpenBB | :9921 |
Institutional data, options flow, SEC filings | Various platform endpoints |
| Freqtrade | :9922 |
Paper trading bot performance | /api/v1/profit, /api/v1/trades |
| n8n | :5678 |
Trigger downstream workflows, delayed reflections | POST /webhook/investment-coach |
All five run as Docker Compose services defined in apps/finance.yml. See the Productivity Stack page for the broader homelab context.
Ghostfolio — Your Holdings¶
Ghostfolio is the source of truth for what you own and how much. Every analysis pulls:
- Current positions (ticker, share count, average cost)
- Allocation breakdown (by sector, asset class, currency)
- P&L over time (today, week, month, year)
- Transaction history
The Portfolio Manager (agent #10) uses this to:
- Flag concentration risk ("23% AAPL exceeds the 10% per-stock guideline")
- Suggest rebalancing ("you're under-weighted in healthcare vs VTI baseline")
- Avoid double-buying ("you already hold this — here's your cost basis")
Firefly III — Your Cash Flow¶
Firefly III tells the coach what you can actually invest. It pulls:
- Asset account balances (cash available for investing)
- Budget status (have you overspent this month?)
- Recurring transactions (bills due before next paycheck)
The coach uses this for realistic recommendations:
- "You have $500 investable this month after expenses — here's how to allocate"
- "Hold off — your Pag-IBIG payment clears Friday, reassess then"
- "Your emergency fund is below 3 months — invest only $200, top up the rest"
OpenBB — Institutional Data¶
OpenBB gives the coach access to data retail APIs don't expose:
- Options flow (unusual whale activity, put/call ratios)
- SEC filings (10-K, 10-Q, insider transactions)
- Analyst estimates and consensus
- Macro data (Treasury yields, FRED economic indicators)
Used primarily by the Fundamentals Analyst and News Analyst when Alpha Vantage/Finnhub quotas are exhausted or when the analysis needs institutional-grade data.
Freqtrade — Paper Trading Results¶
Freqtrade runs paper-trading strategies on crypto pairs. The coach uses its performance as a sanity check:
- "Your Freqtrade RSI strategy returned 12% on BTC/USDT over 3 months (paper trading)"
- "Paper trade first before committing real capital — the coach can backtest a thesis before you act on it"
Relevant only once you reach Advanced stage (crypto unlocked). Foundation and Growth stages ignore Freqtrade output.
n8n — Automation Glue¶
n8n connects the coach to time-based triggers that Claude Code can't handle directly:
- Morning pulse cron (weekdays 8am Asia/Manila)
- 3-day reflection delays (triggered per analysis)
- Weekly/monthly report schedules
- Webhook endpoints other services can POST to
See the Notifications chapter for the full schedule list.
Error Handling¶
If a finance service is unreachable, the coach degrades gracefully rather than failing:
| Scenario | Behavior |
|---|---|
| Ghostfolio unreachable | Skip personalization, analyze with market data only, note "portfolio context unavailable" |
| Firefly III unreachable | Skip cash-flow checks, proceed with analysis |
| OpenBB unreachable | Fundamentals Analyst falls back to Alpha Vantage / Finnhub |
| Freqtrade unreachable | Skip paper trading context (non-critical) |
| n8n unreachable | Manual trigger still works; scheduled reflections queue until n8n recovers |
API Keys & Secrets¶
All keys live in the skill's .env file (never committed):
ALPHA_VANTAGE_API_KEY— 25 requests/day free tierFINNHUB_API_KEY— 60 req/min free tierYOUTUBE_API_KEY— 10,000 units/day free tierGHOSTFOLIO_API_TOKEN— generated in Ghostfolio UIFIREFLY_PERSONAL_ACCESS_TOKEN— generated in Firefly settingsFREQTRADE_USERNAME/FREQTRADE_PASSWORD— basic auth
TL;DR
Four self-hosted services turn generic market analysis into personalized recommendations: Ghostfolio (what you own), Firefly III (what you can spend), OpenBB (institutional data), Freqtrade (paper trading results), glued together by n8n for time-based automation. Services degrade gracefully if unreachable — the coach skips personalization rather than failing.
Previous: ← The 10-Agent Pipeline | Next: Learning Progression →