Configuration
Environment variables and configuration options for StockBud
Configuration
StockBud is configured through environment variables. All settings can be placed in a .env file in the project root.
Required Variables
These must be set for StockBud to function:
| Variable | Description | Example |
|---|---|---|
ALPACA_API_KEY | Your Alpaca API key | PKABC123... |
ALPACA_SECRET_KEY | Your Alpaca secret key | xyz789... |
Alpaca Settings
| Variable | Description | Default |
|---|---|---|
ALPACA_BASE_URL | Alpaca API endpoint | https://paper-api.alpaca.markets |
ALPACA_DATA_URL | Alpaca data endpoint | https://data.alpaca.markets |
For live trading, change ALPACA_BASE_URL to https://api.alpaca.markets. Only do this when you're ready to trade with real money.
AI Provider Settings
Optional integrations for enhanced AI analysis:
| Variable | Description | Required For |
|---|---|---|
OPENAI_API_KEY | OpenAI API key | AI analysis features |
ANTHROPIC_API_KEY | Anthropic API key | Claude-based analysis |
PERPLEXITY_API_KEY | Perplexity API key | Research queries |
Database Settings
| Variable | Description | Default |
|---|---|---|
SUPABASE_URL | Supabase project URL | Optional |
SUPABASE_KEY | Supabase anon key | Optional |
FIREBASE_PROJECT_ID | Firebase project | Optional |
Server Settings
| Variable | Description | Default |
|---|---|---|
STOCKBUD_PORT | Server port (for HTTP mode) | 8080 |
STOCKBUD_LOG_LEVEL | Logging verbosity | INFO |
STOCKBUD_DEMO_MODE | Enable demo mode with mock data | 0 |
Example .env File
Feature Flags
Enable or disable specific features:
| Variable | Description | Default |
|---|---|---|
STOCKBUD_ENABLE_TRADING | Allow trade execution | true |
STOCKBUD_ENABLE_ALERTS | Enable price alerts | true |
STOCKBUD_ENABLE_ANALYTICS | Track usage analytics | false |
Per-Client Configuration
When running StockBud for multiple AI clients, you can override settings per-client in the MCP configuration:
Validation
Check your configuration is valid:
This will verify:
- ✅ Required variables are set
- ✅ Alpaca credentials work
- ✅ Optional services are reachable