A Bloomberg Terminal for your command line. AI-powered financial analysis.
npm install devfolio-cli
A Bloomberg Terminal for your command line.
AI-powered financial analysis in a terminal-native interface.
Install •
Features •
Architecture •
Why I Built This
---
```
╭──────────────────────────────────────────────────────────────────────────────╮
│ │
│ ██████╗ ███████╗██╗ ██╗███████╗ ██████╗ ██╗ ██╗ ██████╗ │
│ ██╔══██╗██╔════╝██║ ██║██╔════╝██╔═══██╗██║ ██║██╔═══██╗ │
│ ██║ ██║█████╗ ██║ ██║█████╗ ██║ ██║██║ ██║██║ ██║ │
│ ██║ ██║██╔══╝ ╚██╗ ██╔╝██╔══╝ ██║ ██║██║ ██║██║ ██║ │
│ ██████╔╝███████╗ ╚████╔╝ ██║ ╚██████╔╝███████╗██║╚██████╔╝ │
│ ╚═════╝ ╚══════╝ ╚═══╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ │
│ │
│ Real-time market data • AI analysis • SEC filings • Options chains │
│ │
├──────────────────────────────────────────────────────────────────────────────┤
│ > s NVDA 1y │
│ │
│ NVIDIA Corporation (NVDA) $142.50 +2.3% │
│ Semiconductors | Santa Clara, CA │
│ │
│ 150 ┤ ╭─── │
│ 125 ┤ ╭────────────╯ │
│ 100 ┤ ╭─────────────────────╯ │
│ 75 ┤ ╭────────────────────╯ │
│ 50 ┼───╯ │
│ Jan Mar May Jul Sep Nov Jan │
│ │
│ P/E: 65.2 │ Mkt Cap: $3.5T │ 52W: $45.01 - $152.89 │ Vol: 42.1M │
│ │
│ AI: NVDA continues to dominate the AI chip market with 80%+ data center │
│ GPU share. Strong demand from hyperscalers and enterprise AI adoption. │
│ │
╰──────────────────────────────────────────────────────────────────────────────╯
I've worked in finance tech for most of my career. When tools like Claude Code and Gemini CLI started gaining traction, I got curious. Why does AI feel better in the terminal?
The only way I know how to understand something is to build it. So I picked a domain I know—financial data—and explored what an AI-native terminal experience could look like.
This is what I learned.
- Terminal UI Architecture: Building responsive, stateful UIs with React + Ink pushed me to think differently about component design
- Multi-Provider AI Abstraction: Designing a provider-agnostic AI layer with automatic fallback, streaming, and tool calling
- Real-World API Integration: Parsing messy financial data from Yahoo Finance, SEC EDGAR, and CoinGecko
- RAG Implementation: Building retrieval-augmented generation for SEC filing search using SQLite FTS5
- Caching Strategies: Multi-layer caching with different TTLs for quotes vs fundamentals vs AI responses
---
| Feature | Description |
|---------|-------------|
| AI Market Brief | Daily market narrative with indices, sectors, and outlook |
| Market Pulse | Real-time alerts with customizable thresholds |
| Live Mode | 10-second quote refresh for active monitoring |
| News Reader | Financial news with AI sentiment analysis |
| Feature | Description |
|---------|-------------|
| Stock Profiles | Company data, ASCII charts, metrics, AI quick takes |
| Research Reports | AI-generated deep-dive analysis |
| Financial Statements | Income, balance sheet, cash flow |
| Stock Comparison | Side-by-side with AI verdict |
| Earnings Analysis | Historical earnings + SEC data |
| Feature | Description |
|---------|-------------|
| Options Chains | Full chain with Greeks (delta, gamma, theta, vega) |
| IV Surface | Implied volatility analysis |
| Cryptocurrency | Top 50 via CoinGecko (free, no key) |
| ETF Profiles | Holdings, performance, expense ratios |
| Feature | Description |
|---------|-------------|
| Filing Browser | Read 10-K, 10-Q, 8-K directly in terminal |
| AI Extraction | Key section summarization |
| RAG Search | Full-text search over filings with FTS5 |
| Feature | Description |
|---------|-------------|
| Multi-Provider | Groq, OpenAI, Anthropic, Ollama |
| Tool Calling | AI can fetch live data during conversation |
| Conversational Memory | Multi-turn context with session persistence |
| Preference Learning | AI learns your investment style over time |
---
`bashRun directly (no install)
npx devfolio-cli
$3
All market data is free. AI features use BYOK (Bring Your Own Key).
`bash
Recommended: Groq (free tier, fastest)
export GROQ_API_KEY=your_key_hereOr use other providers
export OPENAI_API_KEY=sk-...
export ANTHROPIC_API_KEY=sk-ant-...
`Get a free Groq key at console.groq.com.
---
Quick Start
`bash
Start DevFolio
devfolio-cliGet AI market analysis
> briefLook up a stock with 1-year chart
> s NVDA 1yAI research report
> r AAPLCompare stocks with AI verdict
> cs AAPL MSFT GOOGLCheck options chain
> options TSLARead SEC filings
> filings AMZN
> filing 1Chat naturally
> what do you think about NVDA given the AI chip competition?
`---
Architecture
`
┌─────────────────────────────────────────────────────────────────────────────┐
│ DevFolio Architecture │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ Terminal UI (Ink + React) │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │
│ │ │ Views │ │ Widgets │ │ Input │ │ Output │ │ Layout │ │ │
│ │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ┌────────────────┴────────────────┐ │
│ ▼ ▼ │
│ ┌─────────────────────────────┐ ┌─────────────────────────────────┐ │
│ │ AI Infrastructure │ │ Data Services │ │
│ │ ┌───────────────────────┐ │ │ ┌───────────────────────────┐ │ │
│ │ │ Provider Adapters │ │ │ │ Market Data Service │ │ │
│ │ │ Groq│OpenAI│Anthropic│ │ │ │ Yahoo Finance│CoinGecko │ │ │
│ │ └───────────────────────┘ │ │ └───────────────────────────┘ │ │
│ │ ┌───────────────────────┐ │ │ ┌───────────────────────────┐ │ │
│ │ │ Chat Agent │ │ │ │ SEC EDGAR Service │ │ │
│ │ │ Tools│Memory│Stream │ │ │ │ Filings│RAG│Search │ │ │
│ │ └───────────────────────┘ │ │ └───────────────────────────┘ │ │
│ │ ┌───────────────────────┐ │ │ ┌───────────────────────────┐ │ │
│ │ │ Cost Tracking │ │ │ │ Options Service │ │ │
│ │ │ Token│$│Provider │ │ │ │ Chains│Greeks│IV │ │ │
│ │ └───────────────────────┘ │ │ └───────────────────────────┘ │ │
│ └─────────────────────────────┘ └─────────────────────────────────┘ │
│ │ │ │
│ └────────────────┬────────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ Persistence Layer (SQLite) │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │
│ │ │Watchlist │ │Portfolio │ │ Memory │ │ Prefs │ │ FTS5/RAG │ │ │
│ │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
`$3
Multi-Provider AI Abstraction
`typescript
// Single interface, multiple backends
const response = await aiClient.complete({
prompt: "Analyze AAPL",
stream: true,
tools: [lookupStock, compareStocks]
});
// Works with Groq, OpenAI, Anthropic, or Ollama
`Layered Caching
`typescript
// Different TTLs for different data types
CACHE_TTL = {
quotes: 10_000, // 10 seconds (real-time)
fundamentals: 3600_000, // 1 hour (stable)
aiResponses: 300_000, // 5 minutes (context-dependent)
}
`RAG for SEC Filings
`typescript
// Full-text search over chunked filings
const results = await ragSearch({
query: "revenue guidance",
symbol: "AAPL",
limit: 5
});
// Uses SQLite FTS5 for fast retrieval
`---
Tech Stack
| Layer | Technology |
|-------|------------|
| Runtime | Node.js 20+ |
| Language | TypeScript 5.7 |
| UI Framework | React 18 + Ink 5 (terminal rendering) |
| Market Data | yahoo-finance2, CoinGecko |
| SEC Data | SEC EDGAR API |
| AI Providers | Groq, OpenAI, Anthropic, Ollama |
| Database | SQLite 3 (better-sqlite3) with FTS5 |
| Validation | Zod |
| Build | tsup (esbuild) |
| Testing | Vitest |
---
Commands Reference
Market Commands
| Command | Description |
|---------|-------------|
|
b, brief | AI market analysis |
| pulse | Real-time market alerts |
| live [SYM...] | Live mode (10s refresh) |
| news [SYM] | News with sentiment |
| screen | Stock screener |
Stock Commands
| Command | Description |
|---------|-------------|
|
s | Stock profile with chart |
| r | AI research report |
| e | Earnings analysis |
| fin | Financial statements |
| cs | Compare stocks |
| why | Explain price movement |
Options & Crypto
| Command | Description |
|---------|-------------|
|
options | Options overview |
| chain | Full options chain |
| crypto | Top 50 cryptocurrencies |
| c | Crypto profile |
Portfolio & SEC
| Command | Description |
|---------|-------------|
|
w, watchlist | View watchlist |
| p, portfolio | View portfolio |
| add | Add to watchlist |
| filings | SEC filings |
| filing | Read filing |---
Data Sources
All market data is free with no API keys required:
| Data | Provider | Cost |
|------|----------|------|
| Stocks, ETFs, Options | Yahoo Finance | Free |
| SEC Filings | SEC EDGAR | Free |
| Cryptocurrency | CoinGecko | Free |
AI features require a key from any supported provider. Groq offers a generous free tier.
---
Project Structure
`
src/
├── app/ # Main application + routing
├── ai/ # AI infrastructure
│ ├── providers/ # Groq, OpenAI, Anthropic, Ollama
│ ├── client.ts # Multi-provider orchestrator
│ ├── agent.ts # Chat agent with tools
│ └── tools.ts # AI function definitions
├── services/ # Data fetching layer
│ ├── market.ts # Stocks, quotes, charts
│ ├── options.ts # Options chains, Greeks
│ ├── sec.ts # SEC EDGAR integration
│ ├── crypto.ts # CoinGecko client
│ └── rag/ # RAG for filing search
├── views/ # Full-page view components
├── components/ # Reusable UI components
├── db/ # SQLite persistence
│ ├── memory.ts # Chat memory
│ ├── preferences.ts # Preference learning
│ └── watchlist.ts # Portfolio data
├── alerts/ # Alert system
├── hooks/ # React hooks
├── design/ # Design tokens
└── utils/ # Utilities
`228 TypeScript files organized by domain with single-responsibility modules.
---
Development
`bash
git clone https://github.com/blancas-armando/devfolio.git
cd devfolio
npm installDevelopment
npm run devType check
npm run typecheckTest
npm testBuild
npm run build
``---
MIT
---
Built by Armando Blancas